File tree 4 files changed +15
-21
lines changed
4 files changed +15
-21
lines changed Original file line number Diff line number Diff line change 1
1
import type { LinksFunction , LoaderFunctionArgs } from "@remix-run/node" ;
2
2
import {
3
3
Links ,
4
- LiveReload ,
5
4
Meta ,
6
5
Scripts ,
7
6
ScrollRestoration ,
@@ -30,35 +29,37 @@ export default function AppWithProviders() {
30
29
return (
31
30
< RouterProvider >
32
31
< ThemeProvider specifiedTheme = { data . theme } themeAction = "/action/set-theme" >
33
- < App />
32
+ < RootLayout theme = { data . theme } />
34
33
</ ThemeProvider >
35
34
</ RouterProvider >
36
35
) ;
37
36
}
38
37
39
- function App ( ) {
40
- const data = useLoaderData < typeof loader > ( ) ;
41
- const [ theme ] = useTheme ( ) ;
38
+ function RootLayout ( { theme } : { theme : string | null } ) {
39
+ const [ currentTheme ] = useTheme ( ) ;
42
40
const location = useLocation ( ) ;
43
41
44
42
const guestRoutes = [ "/login" , "/signup" , "/forgot-password" ] ;
45
- const isGuestRoute = guestRoutes . includes ( location . pathname ) ;
43
+ const isGuestRoute = guestRoutes . some ( ( route ) => location . pathname . startsWith ( route ) ) ;
46
44
47
45
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
+ >
49
51
< head >
50
52
< meta charSet = "utf-8" />
51
53
< meta name = "viewport" content = "width=device-width,initial-scale=1" />
52
54
< Meta />
53
- < PreventFlashOnWrongTheme ssrTheme = { Boolean ( data . theme ) } />
55
+ < PreventFlashOnWrongTheme ssrTheme = { Boolean ( theme ) } />
54
56
< Links />
55
57
</ head >
56
58
< body className = "font-sans antialiased min-h-svh bg-tertiary" >
57
59
< Toast />
58
60
{ isGuestRoute ? < GuestLayout /> : < AppLayout /> }
59
61
< ScrollRestoration />
60
62
< Scripts />
61
- { process . env . NODE_ENV === "development" && < LiveReload /> }
62
63
</ body >
63
64
</ html >
64
65
) ;
Original file line number Diff line number Diff line change 9
9
"dev" : " remix vite:dev" ,
10
10
"lint" : " eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint ." ,
11
11
"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" ,
14
17
"format" : " bun run tailwind:format && biome check --write" ,
15
18
"format:unsafe" : " biome check --unsafe --write"
16
19
},
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments