import NavLinks from '@/app/ui/nav-links'
import styles from '@/app/page.module.scss'
import HeaderPanel from '../ui/header/headerPanel';
import { DataProvider } from '@/app/context/data-context';
import { fetchFruit } from '@/app/lib/action';
import { getSessionToken } from '@/app/lib/session';

export default async function Layout({ children }: { children: React.ReactNode }) {

	const fruitsData = await fetchFruit(100);
	const token = await getSessionToken();

	return (
		<DataProvider dataContext={fruitsData}>
			<div className="flex">
				<NavLinks />
				<div className={`${styles.mainContainter}`}>
					<HeaderPanel />
					<main>
						{children}
					</main>
				</div>
			</div>
		</DataProvider>
	);
}