Merge branch 'main' into feature/add-language

This commit is contained in:
Chris Kruining 2024-12-03 13:25:36 +01:00
commit c31074de4b
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
8 changed files with 58 additions and 11 deletions

View file

@ -76,8 +76,9 @@ export default defineConfig({
},
server: {
preset: 'bun',
// prerender: {
// crawlLinks: true,
// },
prerender: {
crawlLinks: false,
routes: ['/sitemap.xml']
},
},
});

BIN
bun.lockb

Binary file not shown.

View file

@ -6,6 +6,7 @@
"@solidjs/start": "^1.0.10",
"dexie": "^4.0.10",
"iterator-helpers-polyfill": "^3.0.1",
"sitemap": "^8.0.0",
"solid-icons": "^1.1.0",
"solid-js": "^1.9.3",
"ts-pattern": "^5.5.0",

4
public/robots.txt Normal file
View file

@ -0,0 +1,4 @@
User-agent: *
Disallow:
Disallow: /cgi-bin/
Sitemap: https://ca-euw-prd-calque-app.purplecoast-f5b7f657.westeurope.azurecontainerapps.io/sitemap.xml

View file

@ -5,14 +5,16 @@
--primary-100: oklch(from var(--primary-500) .95 c h);
--primary-300: oklch(from var(--primary-500) .9 c h);
--primary-500: light-dark(oklch(.7503 0.117 var(--hue)), oklch(.8549 0.1149 var(--hue)));
--primary-700: oklch(from var(--primary-500) .7 c h);
--primary-900: oklch(from var(--primary-500) .6 c h);
--primary-600: oklch(from var(--primary-500) .7 c h);
--primary-700: oklch(from var(--primary-500) .6 c h);
--primary-900: oklch(from var(--primary-500) .35 calc(c + .15) h);
--secondary-100: oklch(from var(--primary-500) .95 c calc(h + var(--accent-ofset)));
--secondary-300: oklch(from var(--primary-500) .9 c calc(h + var(--accent-ofset)));
--secondary-500: oklch(from var(--primary-500) .85 c calc(h + var(--accent-ofset)));
--secondary-700: oklch(from var(--primary-500) .7 c calc(h + var(--accent-ofset)));
--secondary-900: oklch(from var(--primary-500) .6 c calc(h + var(--accent-ofset)));
--secondary-600: oklch(from var(--primary-500) .7 c calc(h + var(--accent-ofset)));
--secondary-700: oklch(from var(--primary-500) .6 c calc(h + var(--accent-ofset)));
--secondary-900: oklch(from var(--primary-500) .35 calc(c + .15) calc(h + var(--accent-ofset)));
--surface-300: light-dark(oklch(from var(--primary-500) .9 .02 h), oklch(from var(--primary-500) .2 .02 h));
--surface-400: oklch(from var(--surface-300) calc(l + .025) c h);
@ -115,7 +117,11 @@ body {
}
a {
color: var(--primary-500);
color: var(--primary-900);
&:visited {
color: var(--secondary-900);
}
}
h1 {

View file

@ -51,6 +51,7 @@ export default function Editor(props: ParentProps) {
<HttpHeader name="Accept-CH" value="Sec-CH-Prefers-Color-Scheme" />
<Title>Calque</Title>
<Meta name="description" content="Simple tool for managing translation files" />
<Meta name="color-scheme" content={theme.colorScheme} />
<Meta name="theme-color" content={`oklch(${lightness()} .02 ${theme.hue})`} />
@ -71,7 +72,7 @@ export default function Editor(props: ParentProps) {
<picture>
<source srcset="/images/favicon.dark.svg" media="screen and (prefers-color-scheme: dark)" />
<source srcset="/images/favicon.light.svg" media="screen and (prefers-color-scheme: light)" />
<img src="/images/favicon.dark.svg" alt="Calque logo" />
<img src="/images/favicon.dark.svg" alt="Calque logo" width="17.5" height="17.5" />
</picture>
</A>

View file

@ -347,8 +347,6 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
<Menu.Item command={commands.clearSelection} />
</Menu.Item>
<Menu.Item command={noop.withLabel('view')} />
</Menu.Root>
<Prompt api={setNewKeyPrompt} title="Which key do you want to create?" description={<>hint: use <code>.</code> to denote nested keys,<br /> i.e. <code>this.is.some.key</code> would be a key that is four levels deep</>}>

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, ''));
};