Skip to content

Commit 0a8dce4

Browse files
committed
Knip update + layout in root
1 parent 0476639 commit 0a8dce4

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

app/root.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { LanguageSwitcher } from "./library/language-switcher"
77
import tailwindcss from "./tailwind.css?url"
88

99
export async function loader({ context }: Route.LoaderArgs) {
10-
if (!context) throw new Error("No context")
1110
const { lang, clientEnv } = context
1211
return { lang, clientEnv }
1312
}
@@ -20,11 +19,21 @@ export const handle = {
2019

2120
export default function App({ loaderData }: Route.ComponentProps) {
2221
const { lang, clientEnv } = loaderData
23-
const { i18n } = useTranslation()
2422
useChangeLanguage(lang)
2523

2624
return (
27-
<html className="overflow-y-auto overflow-x-hidden" lang={lang} dir={i18n.dir()}>
25+
<>
26+
<Outlet />
27+
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: We set the window.env variable to the client env */}
28+
<script dangerouslySetInnerHTML={{ __html: `window.env = ${JSON.stringify(clientEnv)}` }} />
29+
</>
30+
)
31+
}
32+
33+
export const Layout = ({ children }: { children: React.ReactNode }) => {
34+
const { i18n } = useTranslation()
35+
return (
36+
<html className="overflow-y-auto overflow-x-hidden" lang={i18n.language} dir={i18n.dir()}>
2837
<head>
2938
<meta charSet="utf-8" />
3039
<meta name="viewport" content="width=device-width, initial-scale=1" />
@@ -33,11 +42,9 @@ export default function App({ loaderData }: Route.ComponentProps) {
3342
</head>
3443
<body className="w-full h-full">
3544
<LanguageSwitcher />
36-
<Outlet />
45+
{children}
3746
<ScrollRestoration />
3847
<Scripts />
39-
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: We set the window.env variable to the client env */}
40-
<script dangerouslySetInnerHTML={{ __html: `window.env = ${JSON.stringify(clientEnv)}` }} />
4148
</body>
4249
</html>
4350
)

knip.json

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
{
22
"$schema": "https://unpkg.com/knip@5/schema.json",
3-
"entry": [
4-
"scripts/*.{ts,js}",
5-
"app/routes.ts",
6-
"vite.config.ts",
7-
"vitest.workspace.ts",
8-
"vitest.config.ts",
9-
"app/server/*.ts"
10-
],
3+
"entry": ["scripts/*.{ts,js}", "app/routes.ts", "app/server/*.ts", "app/library/icon/Icon.tsx"],
114
"remix": true,
12-
"lefthook": true,
13-
"project": ["**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", "vite.config.ts", "vitest.workspace.ts", "vitest.config.ts"],
14-
"ignore": ["app/library/icon/icons/types.ts", "**/*.server.test.{ts,tsx}", "**/*.browser.test.{ts,tsx}"]
5+
"project": ["**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}"],
6+
"ignore": ["app/library/icon/icons/types.ts"],
7+
"ignoreDependencies": ["@babel/preset-typescript", "babel-plugin-react-compiler"]
158
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"babel-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
6565
"chalk": "5.3.0",
6666
"happy-dom": "15.11.6",
67-
"knip": "5.37.2",
67+
"knip": "5.39.4",
6868
"lefthook": "1.8.4",
6969
"playwright": "1.49.0",
7070
"postcss": "8.4.49",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)