Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950<script lang="ts"> import { untrack } from "svelte"; import { getAuth } from "#lib/auth.svelte.ts"; import { createBobbinClient } from "#lib/api/client.ts"; import StringCard from "#lib/components/profile/StringCard.svelte"; import PagedList from "#lib/components/profile/PagedList.svelte"; import { listView } from "#lib/components/profile/listView.svelte.ts"; import { createOffsetPager, pageCount } from "#lib/components/profile/pagination.svelte.ts"; import { PROFILE_PAGE_LIMIT, fetchStringsPage } from "#lib/components/profile/pages.ts"; import profileStringcardDefault from "#lib/bones/profile-stringcard--default.bones.json"; import type { StringCardData } from "#lib/components/profile/types.ts";
interface Props { initialPage: number; initial: StringCardData[]; total: number; did: string; handle: string; }
let { initialPage, initial, total, did, handle }: Props = $props();
const auth = getAuth();
const pager = createOffsetPager( untrack(() => ({ page: initialPage, items: initial })), PROFILE_PAGE_LIMIT, (offset) => { const ctx = createBobbinClient({ serviceUrl: auth.bobbinUrl }); return fetchStringsPage(ctx, { did, handle, offset }).then((p) => p.items); } ); const pages = $derived(pageCount(total, PROFILE_PAGE_LIMIT));</script>
<PagedList {pager} {pages} {total} title="Strings" switchable emptyMessage="No strings yet." rowCapture={profileStringcardDefault} key={(entry) => entry.rkey}> {#snippet row(entry)} <StringCard {entry} layout={listView.current === "cards" ? "card" : "row"} /> {/snippet}</PagedList>