35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { type PageProps } from "$fresh/server.ts";
|
|
import { Partial } from "$fresh/runtime.ts";
|
|
import { container } from "#/lib/container.ts";
|
|
import { ConfigLoader } from "#/lib/config/index.ts";
|
|
import { createContext } from "preact"
|
|
import type { Config } from "#/lib/config/types.ts";
|
|
const configLoader = container.get(ConfigLoader);
|
|
const config = configLoader.config()
|
|
export const ConfigContext = createContext<Config>(config)
|
|
|
|
|
|
export default function App({ Component }: PageProps) {
|
|
const config = configLoader.config()
|
|
return (
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>{config.title || "new tab"}</title>
|
|
<link rel="stylesheet" href="/styles.css" />
|
|
{
|
|
config.favicon && <link rel="icon" href={config.favicon} type={config.faviconType} />
|
|
}
|
|
</head>
|
|
<ConfigContext.Provider value={config}>
|
|
<body f-client-nav class="h-screen w-screen">
|
|
<Partial name="body">
|
|
<Component />
|
|
</Partial>
|
|
</body>
|
|
</ConfigContext.Provider>
|
|
</html>
|
|
);
|
|
}
|