Something went wrong. Try again.
Monorepo for Tangled
Something went wrong. Try again.
Svelte
at sl/gitmirror
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394<script lang="ts"> import { dev } from "$app/environment"; import { page } from "$app/state"; import SquareChartGantt from "$icon/square-chart-gantt"; import BookMarked from "$icon/book-marked"; import Star from "$icon/star"; import LineSquiggle from "$icon/line-squiggle"; import Shield from "$icon/shield"; import Settings from "$icon/settings"; import Tabs, { type TabDef } from "$lib/components/ui/Tabs.svelte"; import type { ProfileCounts } from "$lib/components/profile/types";
interface Props { handle: string; active: string; counts: ProfileCounts; organization?: boolean; settings?: boolean; }
let { handle, active, counts, organization = false, settings = false }: Props = $props();
const hrefFor = (id: string) => { const query = new URLSearchParams([ ...(id === "overview" ? [] : [["tab", id]]), ...(dev && page.url.searchParams.get("preview") === "organization" ? [["preview", "organization"]] : []) ]).toString(); return `/${handle}${query ? `?${query}` : ""}`; };
const tabs = $derived<TabDef[]>( organization ? [ { id: "overview", label: "Overview", icon: SquareChartGantt, href: hrefFor("overview") }, { id: "repos", label: "Repositories", icon: BookMarked, count: counts.repos, href: hrefFor("repos") }, ...(settings ? [ { id: "settings", label: "Settings", icon: Settings, href: hrefFor("settings") } ] : []) ] : [ { id: "overview", label: "Overview", icon: SquareChartGantt, href: hrefFor("overview") }, { id: "repos", label: "Repositories", icon: BookMarked, count: counts.repos, href: hrefFor("repos") }, { id: "starred", label: "Starred", icon: Star, count: counts.stars, href: hrefFor("starred") }, { id: "strings", label: "Strings", icon: LineSquiggle, count: counts.strings, href: hrefFor("strings") }, { id: "vouches", label: "Vouches", icon: Shield, href: hrefFor("vouches") } ] );</script>
<Tabs {tabs} {active} overlapBottom={true} label="profile sections" />