improved component composition and added tests.

This commit is contained in:
Moon.eth
2026-07-29 10:30:28 +09:00
parent 95f9d73681
commit 264ae17a8d
39 changed files with 1811 additions and 147 deletions
+4 -3
View File
@@ -6,9 +6,9 @@
import { untrack } from 'svelte'
import type { Status } from '$lib/api/types'
import type { TimelineKind } from '$lib/api/endpoints'
import { session } from '$lib/stores/session.svelte'
import { useAppServices } from '$lib/app-services'
import { Feed } from '$lib/stores/feed.svelte'
import { fetchTimeline, instanceDomain } from '$lib/api/endpoints'
import { instanceDomain } from '$lib/api/endpoints'
import Module from '$components/common/Module.svelte'
import TabBar from '$components/common/TabBar.svelte'
import BlogList from '$components/blog/BlogList.svelte'
@@ -21,6 +21,7 @@
let { kind, tag }: Props = $props()
const { endpoints, session } = useAppServices()
let feed = $state<Feed<Status>>(new Feed<Status>(async () => ({ items: [], links: {} })))
const domain = $derived(session.host ? instanceDomain(session.instance, session.host) : '')
@@ -54,7 +55,7 @@
// Home needs a token; fall back rather than showing a 401.
const resolved: TimelineKind = currentKind === 'home' && !authed ? 'local' : currentKind
feed = new Feed<Status>((cursor) =>
fetchTimeline(session.api, resolved, cursor, { tag: currentTag }),
endpoints.fetchTimeline(session.api, resolved, cursor, { tag: currentTag }),
)
void feed.reload()
document.title = `${title} | plspace`