Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647<script lang="ts"> import { untrack } from "svelte"; import { getAuth } from "$lib/auth.svelte"; import { createBobbinClient } from "$lib/api/client"; import StringCard from "$lib/components/profile/StringCard.svelte"; import PagedList from "$lib/components/profile/PagedList.svelte"; import { createOffsetPager, pageCount } from "$lib/components/profile/pagination.svelte"; import { PROFILE_PAGE_LIMIT, fetchStringsPage } from "$lib/components/profile/pages"; import profileStringcardDefault from "$lib/bones/profile-stringcard--default.bones.json"; import type { StringCardData } from "$lib/components/profile/types";
interface Props { initial: StringCardData[]; total: number; did: string; handle: string; }
let { initial, total, did, handle }: Props = $props();
const auth = getAuth();
const pager = createOffsetPager( untrack(() => 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" emptyMessage="No strings yet." rowCapture={profileStringcardDefault} key={(entry) => entry.rkey}> {#snippet row(entry)} <StringCard {entry} /> {/snippet}</PagedList>