Files
blitzkit/src/app/layout.tsx
T

87 lines
2.3 KiB
TypeScript
Raw Normal View History

2023-09-30 22:12:48 -05:00
'use client';
2024-05-22 14:16:46 -05:00
import { Flex, Theme } from '@radix-ui/themes';
2023-09-30 22:30:52 -05:00
import '@radix-ui/themes/styles.css';
2023-09-18 23:05:19 +00:00
import { config } from 'dotenv';
2023-09-12 02:38:50 +00:00
import { Roboto_Flex } from 'next/font/google';
2023-09-30 22:12:48 -05:00
import { usePathname } from 'next/navigation';
2024-05-23 13:20:07 -05:00
import { ReactNode, Suspense } from 'react';
2024-05-23 13:17:45 -05:00
import { Footer } from '../components/Footer';
2024-05-14 14:07:44 -05:00
import Navbar, { NAVBAR_HEIGHT } from '../components/Navbar';
2024-04-21 10:21:52 -05:00
import { Party3 } from '../components/Party3';
2024-07-09 20:05:34 -05:00
import * as App from '../stores/app';
2024-05-22 14:16:46 -05:00
import { Checks } from './components/Checks';
2024-07-10 19:16:00 -05:00
import { PageLoader } from './components/PageLoader';
2024-05-22 14:16:46 -05:00
import './layout.css';
2023-09-07 01:13:03 +00:00
2023-09-18 23:05:19 +00:00
config();
2023-09-07 01:13:03 +00:00
interface RootLayoutProps {
children: ReactNode;
}
2023-09-12 02:38:50 +00:00
const robotoFlex = Roboto_Flex({
subsets: ['latin'],
display: 'swap',
2024-06-03 16:47:21 -05:00
variable: '--font-roboto-flex',
2023-09-12 02:38:50 +00:00
});
2023-09-07 01:13:03 +00:00
export default function RootLayout({ children }: RootLayoutProps) {
2023-09-30 22:12:48 -05:00
const pathname = usePathname();
const isEmbed = pathname.split('/')[1] === 'embeds';
2024-04-18 18:28:46 -05:00
const isRoot = pathname === '/';
2023-09-30 22:12:48 -05:00
2023-09-07 01:13:03 +00:00
return (
2024-07-09 20:05:34 -05:00
<App.Provider>
<html lang="en" className={robotoFlex.className}>
<head>
{isRoot && (
<>
<title>BlitzKit</title>
<meta
name="description"
content="🎉 Tools for everything World of Tanks Blitz"
/>
</>
)}
<meta property="og:site_name" content="BlitzKit" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
2024-04-08 21:43:47 -05:00
2024-07-09 20:05:34 -05:00
<Party3 />
</head>
2023-10-01 17:26:08 -05:00
2024-07-09 20:05:34 -05:00
<body
style={{
margin: 0,
backgroundColor: isEmbed ? 'transparent' : undefined,
}}
2023-12-03 19:45:43 -06:00
>
2024-07-09 20:05:34 -05:00
<Theme
appearance="dark"
panelBackground="solid"
radius="full"
accentColor="amber"
suppressHydrationWarning
suppressContentEditableWarning
2024-04-06 12:28:29 -05:00
>
2024-07-09 20:05:34 -05:00
<Flex
direction="column"
style={{
minHeight: '100vh',
paddingTop: isEmbed ? undefined : NAVBAR_HEIGHT,
}}
2024-04-18 19:11:50 -05:00
>
2024-07-09 20:05:34 -05:00
{!isEmbed && <Navbar />}
2024-02-27 09:31:22 -06:00
2024-07-09 20:05:34 -05:00
<Checks />
2024-07-10 19:16:00 -05:00
<Suspense fallback={<PageLoader />}>{children}</Suspense>
2024-07-09 20:05:34 -05:00
{!isEmbed && <Footer />}
</Flex>
</Theme>
</body>
</html>
</App.Provider>
2023-09-07 01:13:03 +00:00
);
}