Skip to content

Instantly share code, notes, and snippets.

@dirtycajunrice
Last active October 3, 2023 18:55
Show Gist options
  • Save dirtycajunrice/b7952abf5f40de2da1538fb59e52eb4d to your computer and use it in GitHub Desktop.
Save dirtycajunrice/b7952abf5f40de2da1538fb59e52eb4d to your computer and use it in GitHub Desktop.
Custom theme via cookie
import CommandPalette from "@/app/_global/command-palette";
// noinspection JSUnusedGlobalSymbols
import NavBar from "@/app/_global/navbar";
import Settings from "@/app/_global/settings";
import Sidebar from "@/app/_global/sidebar";
import SVGGradient from "@/components/icons/SVGGradient";
import { ChildrenProps } from "@/interfaces/next";
import "@/styles/globals.css";
import "@/styles/notiflix.css";
import "@/types/prototypes";
import { getSettingsCookie } from "@/utils/serverActions/settingsCookie";
import { Analytics } from "@vercel/analytics/react";
import { Metadata } from "next";
import { Exo } from "next/font/google";
import Providers from "src/app/_global/providers";
// If loading a variable font, you don't need to specify the font weight
const exo = Exo({
subsets: [ "latin" ],
display: "swap",
variable: "--font-exo",
});
const AppName = "Tradescrow";
const AppDescription = "Trade anyone. Anything. Safely.";
const BaseURL = "https://tradescrow.io";
export const metadata: Metadata = {
metadataBase: new URL(BaseURL),
title: {
default: AppName,
template: "%s | Tradescrow",
},
description: AppDescription,
generator: "Next.js",
applicationName: AppName,
referrer: "origin-when-cross-origin",
keywords: [ "Trade", "Escrow", "Crypto", "Swap", "P2P", "NFT", "Token" ],
authors: [
{ name: "Nicholas St. Germain", url: "https://cajun.pro" },
],
colorScheme: "dark",
creator: "Nicholas St. Germain",
publisher: "Vercel",
alternates: {
canonical: "/",
languages: {
"en-US": "/", // /en-US
},
},
formatDetection: {
email: false,
address: false,
telephone: false,
},
viewport: {
width: "device-width",
initialScale: 1,
maximumScale: 5,
},
openGraph: {
title: AppName,
description: AppDescription,
url: BaseURL,
siteName: AppName,
images: [
{ url: "/FlyingCrow.gif", width: 300, height: 300, alt: "Tradescrow Crow" },
{ url: "/icon.png", width: 512, height: 512, alt: "Tradescrow Logo" },
],
videos: [ { url: "/FlyingCrow.mp4", width: 240, height: 240 } ],
locale: "en_US",
type: "website",
},
icons: {
icon: "/icon.png",
shortcut: "/icon.png",
apple: "/icon.png",
other: {
rel: "apple-touch-icon-precomposed",
url: "/icon.png",
},
},
robots: {
index: true,
follow: true,
nocache: true,
googleBot: {
index: true,
follow: true,
noimageindex: true,
nocache: true,
"max-video-preview": -1,
"max-image-preview": "large",
"max-snippet": -1,
},
},
};
const RootLayout = ({ children }: ChildrenProps) => {
let theme = getSettingsCookie().theme;
return (
<html lang="en" data-theme={theme} className={`${exo.variable} group/theme`}>
<body className="font-exo bg-gradient-site">
<SVGGradient color="silver" />
<SVGGradient color="gold" />
<Providers>
<NavBar />
<Sidebar />
{children}
<Settings />
<CommandPalette />
<Analytics />
</Providers>
</body>
</html>
);
};
export default RootLayout;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment