first commit
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import type { Metadata } from "next";
|
||||
import "./globals.css";
|
||||
import { getServerConfig } from "@/lib/config";
|
||||
import { Providers } from "@/components/Providers";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "LynkedUp Pro — Messages",
|
||||
description:
|
||||
"Slack-grade team messaging, inbox and support — a demo of the @lynkd/messaging-inbox-sdk.",
|
||||
};
|
||||
|
||||
// Runs before paint: restores the user's saved scheme + accent so returning
|
||||
// users never see a flash of the wrong theme.
|
||||
const NO_FLASH = `
|
||||
try {
|
||||
var s = localStorage.getItem('lynkd.scheme');
|
||||
if (s === 'dark') document.documentElement.classList.add('dark');
|
||||
else if (s === 'light') document.documentElement.classList.remove('dark');
|
||||
document.documentElement.style.colorScheme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
|
||||
var t = localStorage.getItem('lynkd.theme');
|
||||
if (t) { var p = JSON.parse(t); if (p && p.dark && p.dark.accent) {
|
||||
document.documentElement.style.setProperty('--c-accent', p.dark.accent);
|
||||
} }
|
||||
} catch (e) {}
|
||||
`;
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
const config = getServerConfig();
|
||||
const initialScheme = config.theme.mode === "light" ? "light" : "dark";
|
||||
|
||||
return (
|
||||
<html
|
||||
lang="en"
|
||||
className={initialScheme === "dark" ? "dark" : ""}
|
||||
style={{ colorScheme: initialScheme } as React.CSSProperties}
|
||||
suppressHydrationWarning
|
||||
>
|
||||
<head>
|
||||
{/* eslint-disable-next-line @next/next/no-before-interactive-script-outside-document */}
|
||||
<script dangerouslySetInnerHTML={{ __html: NO_FLASH }} />
|
||||
</head>
|
||||
<body suppressHydrationWarning>
|
||||
<Providers config={config}>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user