2024-11-17 17:17:40 +08:00
|
|
|
import {
|
|
|
|
Links,
|
|
|
|
Meta,
|
|
|
|
Outlet,
|
2024-11-27 19:52:49 +08:00
|
|
|
Scripts,
|
2024-11-17 17:17:40 +08:00
|
|
|
ScrollRestoration,
|
|
|
|
} from "@remix-run/react";
|
2024-12-03 01:37:02 +08:00
|
|
|
import { NotificationProvider } from "hooks/notification";
|
2024-12-04 02:35:06 +08:00
|
|
|
import { Theme } from "@radix-ui/themes";
|
2024-12-03 01:37:02 +08:00
|
|
|
import { useEffect, useState } from "react";
|
2024-11-17 17:17:40 +08:00
|
|
|
|
2024-11-27 19:52:49 +08:00
|
|
|
import "~/index.css";
|
2024-11-17 17:17:40 +08:00
|
|
|
|
2024-12-03 01:37:02 +08:00
|
|
|
export function Layout() {
|
2024-11-17 17:17:40 +08:00
|
|
|
return (
|
2024-12-04 02:35:06 +08:00
|
|
|
<html lang="en" className="h-full light" suppressHydrationWarning={true}>
|
2024-11-17 17:17:40 +08:00
|
|
|
<head>
|
|
|
|
<meta charSet="utf-8" />
|
2024-12-04 02:35:06 +08:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<meta name="generator" content="echoes" />
|
|
|
|
<title>Echoes</title>
|
2024-11-30 22:24:35 +08:00
|
|
|
<script
|
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
__html: `
|
2024-12-03 01:37:02 +08:00
|
|
|
(function() {
|
2024-12-04 02:35:06 +08:00
|
|
|
function getInitialTheme() {
|
|
|
|
const savedTheme = localStorage.getItem('theme-preference');
|
|
|
|
if (savedTheme) return savedTheme;
|
|
|
|
|
|
|
|
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
|
|
? 'dark'
|
|
|
|
: 'light';
|
2024-12-03 01:37:02 +08:00
|
|
|
}
|
2024-12-04 02:35:06 +08:00
|
|
|
|
|
|
|
document.documentElement.className = getInitialTheme();
|
|
|
|
})();
|
2024-12-03 01:37:02 +08:00
|
|
|
`,
|
2024-11-30 22:24:35 +08:00
|
|
|
}}
|
|
|
|
/>
|
2024-12-04 02:35:06 +08:00
|
|
|
<Meta />
|
|
|
|
<Links />
|
2024-12-03 01:37:02 +08:00
|
|
|
</head>
|
2024-12-04 02:35:06 +08:00
|
|
|
<body className="h-full" suppressHydrationWarning={true}>
|
|
|
|
<Theme grayColor="slate" radius="medium" scaling="100%">
|
2024-12-03 01:37:02 +08:00
|
|
|
<NotificationProvider>
|
|
|
|
<Outlet />
|
|
|
|
</NotificationProvider>
|
|
|
|
</Theme>
|
|
|
|
<ScrollRestoration />
|
2024-11-30 22:24:35 +08:00
|
|
|
<Scripts />
|
2024-11-17 17:17:40 +08:00
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
);
|
|
|
|
}
|
2024-12-03 01:37:02 +08:00
|
|
|
|
2024-11-17 17:17:40 +08:00
|
|
|
export default function App() {
|
2024-12-03 01:37:02 +08:00
|
|
|
return <Layout />;
|
2024-11-17 17:17:40 +08:00
|
|
|
}
|