Skip to content

Commit a678100

Browse files
committed
wip
1 parent 33842c1 commit a678100

File tree

4 files changed

+15
-21
lines changed

4 files changed

+15
-21
lines changed

app/root.tsx

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { LinksFunction, LoaderFunctionArgs } from "@remix-run/node";
22
import {
33
Links,
4-
LiveReload,
54
Meta,
65
Scripts,
76
ScrollRestoration,
@@ -30,35 +29,37 @@ export default function AppWithProviders() {
3029
return (
3130
<RouterProvider>
3231
<ThemeProvider specifiedTheme={data.theme} themeAction="/action/set-theme">
33-
<App />
32+
<RootLayout theme={data.theme} />
3433
</ThemeProvider>
3534
</RouterProvider>
3635
);
3736
}
3837

39-
function App() {
40-
const data = useLoaderData<typeof loader>();
41-
const [theme] = useTheme();
38+
function RootLayout({ theme }: { theme: string | null }) {
39+
const [currentTheme] = useTheme();
4240
const location = useLocation();
4341

4442
const guestRoutes = ["/login", "/signup", "/forgot-password"];
45-
const isGuestRoute = guestRoutes.includes(location.pathname);
43+
const isGuestRoute = guestRoutes.some((route) => location.pathname.startsWith(route));
4644

4745
return (
48-
<html lang="en" data-theme={theme ?? ""} className={theme ?? ""}>
46+
<html
47+
lang="en"
48+
data-theme={currentTheme ?? theme ?? ""}
49+
className={currentTheme ?? theme ?? ""}
50+
>
4951
<head>
5052
<meta charSet="utf-8" />
5153
<meta name="viewport" content="width=device-width,initial-scale=1" />
5254
<Meta />
53-
<PreventFlashOnWrongTheme ssrTheme={Boolean(data.theme)} />
55+
<PreventFlashOnWrongTheme ssrTheme={Boolean(theme)} />
5456
<Links />
5557
</head>
5658
<body className="font-sans antialiased min-h-svh bg-tertiary">
5759
<Toast />
5860
{isGuestRoute ? <GuestLayout /> : <AppLayout />}
5961
<ScrollRestoration />
6062
<Scripts />
61-
{process.env.NODE_ENV === "development" && <LiveReload />}
6263
</body>
6364
</html>
6465
);

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
"dev": "remix vite:dev",
1010
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
1111
"start": "wrangler pages dev ./build/client",
12-
"typecheck": "react-router typegen && tsc",
13-
"tailwind:format": "rustywind --write .",
12+
"typecheck": "tsc",
13+
"typegen": "wrangler types",
14+
"preview": "bun run build && wrangler pages dev",
15+
"cf-typegen": "wrangler types",
16+
"tailwind:format": "rustywind --write ./app",
1417
"format": "bun run tailwind:format && biome check --write",
1518
"format:unsafe": "biome check --unsafe --write"
1619
},

public/_redirects

-1
This file was deleted.

remix.config.js

-9
This file was deleted.

0 commit comments

Comments
 (0)