Files
jellytau/src/lib/components/library/LibraryViewTabs.svelte
T
dtourolle ad48d89dfe chore(format): run prettier over src/ and scripts/
Formatting was configured but never enforced: `bun run format:check`
reported 199 unformatted files and ran in no workflow and in no git hook,
so .prettierrc (printWidth 100, trailing commas) described an intention
rather than the tree.

This is the one-time sweep that makes the check gateable. Whitespace and
token-reflow only -- no behavioural change: `bun run check` reports 0
errors and all 1053 frontend tests pass before and after.

Kept out of every other commit on purpose. A 199-file diff mixed with
real changes is unreviewable, and the next commit turns format:check
into a hard CI gate so this cannot silently accumulate again.
2026-08-21 17:41:44 +02:00

45 lines
1.4 KiB
Svelte

<!--
Browse / All / Genres for a video library.
These were three routes per library with names that did not agree across the
two libraries; they are now tabs on one route, driven by `?view=` so a tab is
linkable and survives a back navigation.
TRACES: UR-063 | DR-105
-->
<script lang="ts">
import { goto } from "$app/navigation";
import { LIBRARY_VIEWS, libraryViewUrl, type LibraryView } from "$lib/utils/libraryView";
interface Props {
/** Route the tabs live on, e.g. `/library/tv`. */
basePath: string;
active: LibraryView;
/** Per-view labels — "All Shows" vs "All Movies". */
labels: Record<LibraryView, string>;
}
let { basePath, active, labels }: Props = $props();
function select(view: LibraryView) {
if (view === active) return;
// replaceState: switching tabs is not a navigation step worth a back press.
goto(libraryViewUrl(basePath, view), { replaceState: true, noScroll: true });
}
</script>
<nav class="flex items-center gap-1 px-4" aria-label="Library sections">
{#each LIBRARY_VIEWS as view (view)}
<button
onclick={() => select(view)}
aria-current={view === active ? "page" : undefined}
class="px-4 py-2 rounded-lg text-sm font-medium transition-colors
{view === active
? 'bg-[var(--color-jellyfin)] text-white'
: 'text-gray-400 hover:text-white hover:bg-white/10'}"
>
{labels[view]}
</button>
{/each}
</nav>