---
import PlanetView from '../components/PlanetView.astro';
import { getHighestWeightedLanguage } from '../lib/utils/langDriver';

interface Props {
	title: string;
}

const { title } = Astro.props;

if(!Astro.cookies.has('language')) {
	const locale = await getHighestWeightedLanguage(Astro.request.headers.get('accept-language'));

	Astro.cookies.set('language', locale, {
		path: "/",
        maxAge: 60 * 60 * 24 * 365,
        sameSite: "lax",
        secure: true
	});
}
---
<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="description" content="Astro description" />
		<meta name="viewport" content="width=device-width" />
		<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
		<link rel="stylesheet" href="/css/markdown.css" />
		<meta name="generator" content={Astro.generator} />
		<title>{title}</title>
	</head>
	<body>
		<slot />
		<!-- <PlanetView /> -->
	</body>
</html>