mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
80 lines
2.1 KiB
Plaintext
80 lines
2.1 KiB
Plaintext
---
|
|
import { Flex } from '@radix-ui/themes';
|
|
import { BlitzKitTheme } from '../components/BlitzKitTheme';
|
|
import { Checks } from '../components/Checks';
|
|
import Footer from '../components/Footer.astro';
|
|
import Navbar from '../components/Navbar.astro';
|
|
import Party3 from '../components/Party3.astro';
|
|
import './base.css';
|
|
|
|
export interface Props {
|
|
noFooter?: boolean;
|
|
}
|
|
|
|
const { noFooter } = Astro.props;
|
|
const { locale } = Astro.params;
|
|
const { pathname } = Astro.url;
|
|
const isRoot = pathname === '/';
|
|
---
|
|
|
|
<html lang="en">
|
|
<head>
|
|
{
|
|
isRoot && (
|
|
<>
|
|
<title>BlitzKit</title>
|
|
<meta
|
|
name="description"
|
|
content="🎉 Tools for everything World of Tanks Blitz"
|
|
/>
|
|
</>
|
|
)
|
|
}
|
|
<meta property="og:site_name" content="BlitzKit" />
|
|
<meta charset="UTF-8" />
|
|
<link rel="icon" type="image/x-icon" href="/favicon.png" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<link rel="sitemap" href="/sitemap-index.xml" />
|
|
|
|
<Party3 />
|
|
|
|
<script>
|
|
import { SUPPORTED_LOCALES } from '@blitzkit/core';
|
|
import { getBestLocale } from '../core/i18n/getBestLocale';
|
|
|
|
const isI18nPath = SUPPORTED_LOCALES.some((locale) =>
|
|
window.location.pathname.startsWith(`/${locale}`),
|
|
);
|
|
const bestLocale = getBestLocale();
|
|
const currentPathLocale = SUPPORTED_LOCALES.find((locale) =>
|
|
window.location.pathname.startsWith(`/${locale}`),
|
|
);
|
|
|
|
console.log(bestLocale);
|
|
|
|
if (bestLocale !== currentPathLocale) {
|
|
window.location.pathname = isI18nPath
|
|
? window.location.pathname.replace(
|
|
`/${currentPathLocale}`,
|
|
bestLocale === undefined ? '' : `/${bestLocale}`,
|
|
)
|
|
: `/${bestLocale}${window.location.pathname}`;
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<BlitzKitTheme>
|
|
<Flex direction="column" minHeight="100vh">
|
|
<Navbar />
|
|
|
|
<Checks {locale} client:only="react" />
|
|
|
|
<slot />
|
|
|
|
{!noFooter && <Footer />}
|
|
</Flex>
|
|
</BlitzKitTheme>
|
|
</body>
|
|
</html>
|