27 lines
887 B
Svelte
27 lines
887 B
Svelte
<script lang="ts">
|
|
// One price tracker, a tab per thing (#lib/price-trackers). Each tab keeps its own page,
|
|
// loader and data; this only adds the tab bar. Private tabs are only listed for me.
|
|
import { page } from '$app/state';
|
|
import Tag from 'lucide-svelte/icons/tag';
|
|
import SpottingSwitcher from '#lib/components/SpottingSwitcher.svelte';
|
|
import { visiblePriceTabs } from '#lib/price-trackers.js';
|
|
|
|
let { children } = $props();
|
|
const tabs = $derived(visiblePriceTabs(Boolean(page.data.isOwner)));
|
|
const wide = $derived(
|
|
tabs.find((t) => page.url.pathname === t.href || page.url.pathname.startsWith(`${t.href}/`))
|
|
?.wide
|
|
);
|
|
</script>
|
|
|
|
<SpottingSwitcher
|
|
items={tabs}
|
|
home="/trackers/prices"
|
|
label="prices"
|
|
homeIcon={Tag}
|
|
class={wide
|
|
? 'relative mx-auto -mb-6 max-w-[1600px] px-[clamp(1rem,4vw,4rem)] pt-6 sm:-mb-8 sm:pt-8'
|
|
: undefined}
|
|
/>
|
|
{@render children()}
|