feat: add route pages

This commit is contained in:
2026-08-22 10:25:35 +05:00
parent c0225552e4
commit 3ec11999d8
3 changed files with 139 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
<script lang="ts">
import ToolPage from '$lib/components/ToolPage.svelte';
import { getTool } from '$lib/registry';
let { data } = $props();
const tool = $derived(getTool(data.id));
</script>
<svelte:head>
<title>{tool?.title ?? 'Инструмент'} — easy-png-tools</title>
{#if tool}
<meta name="description" content={tool.description} />
{/if}
</svelte:head>
{#if tool}
<ToolPage {tool} />
{/if}
+13
View File
@@ -0,0 +1,13 @@
import { error } from '@sveltejs/kit';
import { getTool, TOOLS } from '$lib/registry';
import type { EntryGenerator, PageLoad } from './$types';
export const entries: EntryGenerator = () => TOOLS.map((tool) => ({ id: tool.id }));
export const load: PageLoad = ({ params }) => {
const tool = getTool(params.id);
if (!tool) {
error(404, 'Инструмент не найден');
}
return { id: tool.id };
};