Files
chitai/frontend/src/routes/(root)/settings/libraries/+page.svelte
T
patrick d6207b5743 refactor: resolve() internal links instead of plain hrefs
Type-checks every link against the real route tree. Caught a dead one: the
book page linked tags to /tag/{id}, a route that has never existed.
2026-08-12 11:08:09 -04:00

54 lines
1.6 KiB
Svelte

<script lang="ts">
import { resolve } from '$app/paths';
import * as Table from '$lib/components/ui/table/index.js';
import * as Card from '$lib/components/ui/card/index.js';
import { getLibraryState } from '$lib/state/library.svelte';
import { EllipsisVertical, Plus } from '@lucide/svelte';
import Button from '$lib/components/ui/button/button.svelte';
const libraryState = getLibraryState();
</script>
<div class="mb-4 flex items-center justify-between">
<div>
<h2 class="text-lg font-semibold">Libraries</h2>
<p class="text-sm text-muted-foreground">Manage your libraries</p>
</div>
<Button variant="outline" onclick={() => libraryState.openLibraryCreateDialog()}>
<Plus />
Add Library
</Button>
</div>
<Card.Root>
<Card.Content class="p-0">
<Table.Root>
<Table.Header>
<Table.Row>
<Table.Head class="w-16 pl-4"></Table.Head>
<Table.Head>Name</Table.Head>
<Table.Head class="w-16"></Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
{#each libraryState.libraries as library}
<Table.Row class="h-14">
<Table.Cell class="w-16 pl-4 text-center text-lg font-semibold"
>{library.name[0]}</Table.Cell
>
<Table.Cell class="font-medium">
<a
href={resolve('/(root)/(library)/library/[libraryId]', { libraryId: String(library.id) })}
class="hover:underline">{library.name}</a
>
</Table.Cell>
<Table.Cell class="w-16 text-center">
<EllipsisVertical class="scale-75" />
</Table.Cell>
</Table.Row>
{/each}
</Table.Body>
</Table.Root>
</Card.Content>
</Card.Root>