got started on new look. pivoting to api implementations now

This commit is contained in:
Chris Kruining 2025-04-01 14:17:20 +02:00
parent aa12f5443c
commit 17e769c598
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
29 changed files with 1080 additions and 136 deletions

View file

@ -1,7 +1,19 @@
import { ParentProps } from "solid-js";
import { Meta } from "@solidjs/meta";
import { createEffect, on, ParentProps } from "solid-js";
import { Shell } from "~/features/shell";
import { useTheme } from "~/features/theme";
export default function ShellPage(props: ParentProps) {
return <Shell>{props.children}</Shell>;
const themeContext = useTheme();
createEffect(on(() => themeContext.theme.colorScheme, (colorScheme) => {
document.documentElement.dataset.theme = colorScheme;
}));
return <Shell>
<Meta name="color-scheme" content={themeContext.theme.colorScheme} />
{props.children}
</Shell>;
}

36
src/routes/sitemap.xml.ts Normal file
View file

@ -0,0 +1,36 @@
import { SitemapStream, streamToPromise } from 'sitemap'
import { App } from 'vinxi';
const BASE_URL = 'https://ca-euw-prd-calque-app.purplecoast-f5b7f657.westeurope.azurecontainerapps.io';
export async function GET() {
const sitemap = new SitemapStream({ hostname: BASE_URL });
sitemap.write({ url: BASE_URL, changefreq: 'monthly', });
for (const route of await getRoutes()) {
sitemap.write({ url: route, changefreq: 'monthly', });
}
sitemap.end();
return new Response(
(await streamToPromise(sitemap)).toString(),
{ status: 200, headers: { 'Content-Type': 'text/xml' } }
);
}
const getRoutes = async () => {
const router = ((globalThis as any).app as App).getRouter('client').internals.routes;
if (router === undefined) {
return [];
}
const routes = await router.getRoutes() as { page: boolean, $$route?: object, path: string }[];
return routes
.filter(r => r.page === true && r.$$route === undefined && !r.path.match(/^.+\*\d+$/))
.map(r => r.path.replace(/\/\(\w+\)/g, ''));
};