diff --git a/src/lib/components/navigation/weather-nav.svelte b/src/lib/components/navigation/weather-nav.svelte index dcb7b01..872c818 100644 --- a/src/lib/components/navigation/weather-nav.svelte +++ b/src/lib/components/navigation/weather-nav.svelte @@ -14,17 +14,29 @@ { title: '7-Day Forecast', url: '/weather/week' as const, - icon: 'calendar' + iconPaths: [ + 'M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z' + ] }, { title: 'Model Comparison', url: '/weather/compare' as const, - icon: 'chart' + iconPaths: ['M13 7h8m0 0v8m0-8l-8 8-4-4-6 6'] }, { title: '14-Day Forecast', url: '/weather/14-day' as const, - icon: 'extended' + iconPaths: [ + 'M3 15a4 4 0 004 4h9a5 5 0 10-.1-9.999 5.002 5.002 0 10-9.78 2.096A4.001 4.001 0 003 15z' + ] + }, + { + title: 'Maps', + url: '/weather/maps' as const, + // Heroicons "map" outline icon + iconPaths: [ + 'M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l4.553 2.276A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7' + ] } ]; @@ -106,49 +118,17 @@ onclick={onMobileClose} >
- {#if link.icon === 'calendar'} - - - - {:else if link.icon === 'chart'} - - - - {:else if link.icon === 'extended'} - - - - {/if} + + {#each link.iconPaths as d (d)} + + {/each} +
{#if !collapsed} {link.title} diff --git a/src/routes/weather/maps/+page.svelte b/src/routes/weather/maps/+page.svelte new file mode 100644 index 0000000..1d3ae10 --- /dev/null +++ b/src/routes/weather/maps/+page.svelte @@ -0,0 +1,27 @@ + + + + Weather Map | Open-Meteo.com + + + + + +
+ +
diff --git a/vite.config.ts b/vite.config.ts index 4bf7adb..e791dab 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,8 +3,34 @@ import tailwindcss from '@tailwindcss/vite'; import { playwright } from '@vitest/browser-playwright'; import { defineConfig } from 'vitest/config'; +import type { IncomingMessage, ServerResponse } from 'http'; +import type { Plugin, PreviewServer, ViteDevServer } from 'vite'; + +const addHeaders = (res: ServerResponse) => { + res.setHeader('Access-Control-Allow-Origin', '*'); + res.setHeader('Access-Control-Allow-Methods', 'GET'); + res.setHeader('Cross-Origin-Opener-Policy', 'same-origin'); + res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp'); +}; + +const viteServerConfig = (): Plugin => ({ + name: 'add-headers', + configureServer: (server: ViteDevServer) => { + server.middlewares.use((_req: IncomingMessage, res: ServerResponse, next: () => void) => { + addHeaders(res); + next(); + }); + }, + configurePreviewServer: (server: PreviewServer) => { + server.middlewares.use((_req: IncomingMessage, res: ServerResponse, next: () => void) => { + addHeaders(res); + next(); + }); + } +}); + export default defineConfig({ - plugins: [tailwindcss(), sveltekit()], + plugins: [tailwindcss(), sveltekit(), viteServerConfig()], test: { expect: { requireAssertions: true },