diff --git a/frontend/src/app.html b/frontend/src/app.html index 00860b9..687746d 100644 --- a/frontend/src/app.html +++ b/frontend/src/app.html @@ -6,6 +6,7 @@ Focus. + %sveltekit.head% diff --git a/frontend/src/lib/components/projects/SelectProject.svelte b/frontend/src/lib/components/projects/SelectProject.svelte index 9ca3fad..ac5f114 100644 --- a/frontend/src/lib/components/projects/SelectProject.svelte +++ b/frontend/src/lib/components/projects/SelectProject.svelte @@ -40,10 +40,10 @@ {:else}
(location.href = `/${project.id}`)} + on:click={() => (location.href = `/project/${project.id}`)} on:keydown={(e) => { if (e.key === 'Enter') { - location.href = `/${project.id}`; + location.href = `/project/${project.id}`; } }} tabindex="0" diff --git a/frontend/src/routes/manifest.json/+server.ts b/frontend/src/routes/manifest.json/+server.ts new file mode 100644 index 0000000..f073071 --- /dev/null +++ b/frontend/src/routes/manifest.json/+server.ts @@ -0,0 +1,45 @@ +import projectsApi from '$lib/api/projectsApi'; + +interface Shortcut { + name: string; + description: string; + url: string; + icons: { + src: string; + sizes: string; + }[]; +} + +export async function GET() { + const icon = { + src: '/img/icon.svg', + type: 'image/svg+xml', + sizes: 'any' + }; + + const projects = await projectsApi.getAll(); + + const shortcuts: Shortcut[] = projects.map((project) => { + return { + name: `Project ${project.title}`, + description: `Shortcut for project ${project.title}`, + url: `/${project.id}`, + icons: [icon] + }; + }); + + const manifest = { + short_name: 'Focus', + name: 'Focus', + start_url: '/', + display: 'standalone', + icons: [icon], + shortcuts + }; + + return new Response(JSON.stringify(manifest), { + headers: { + 'Content-Type': 'application/manifest+json' + } + }); +} diff --git a/frontend/src/routes/[project]/+page.svelte b/frontend/src/routes/project/[project]/+page.svelte similarity index 100% rename from frontend/src/routes/[project]/+page.svelte rename to frontend/src/routes/project/[project]/+page.svelte