feat [2/3]: add feed viewing

This commit is contained in:
James Xylight authored and xylight committed 2025-09-17 00:27:11 +00:00
1 parent 5ed8346027
commit 82a8747ad4
6 files changed
+202 -10

No files matched your search

@@ -50,7 +50,7 @@
blocked?: boolean
banner?: boolean
class?: string
compact?: 'lg'
compact?: 'always' | 'lg'
avatarCircle?: boolean
}
+6 -3
View File
@@ -22,7 +22,7 @@
nameDetail?: import('svelte').Snippet
actions?: import('svelte').Snippet
children?: import('svelte').Snippet
compact?: 'lg'
compact?: 'always' | 'lg'
avatarCircle?: boolean
}
@@ -48,6 +48,7 @@
<div
class={[
compact == 'lg' && 'lg:hidden',
compact == 'always' && 'hidden',
'absolute inset-0 h-96 overflow-x-hidden -z-10',
]}
>
@@ -80,7 +81,7 @@
!avatarCircle && 'rounded-3xl!',
]}
/>
<div class="py-4 flex flex-col xl:flex-row gap-4">
<div class="py-4 flex flex-col gap-4">
<div class="flex flex-col flex-1">
<svelte:element
this={url ? 'a' : 'span'}
@@ -107,7 +108,8 @@
<div
class={[
compact == 'lg' && 'lg:hidden',
'text-sm flex flex-row flex-wrap overflow-hidden gap-4 h-full',
compact == 'always' ? 'hidden' : 'flex',
'text-sm flex-row flex-wrap overflow-hidden gap-4 h-full',
]}
>
{#each stats as stat}
@@ -136,6 +138,7 @@
<div
class={[
compact == 'lg' && 'lg:hidden',
compact == 'always' && 'hidden',
'relative w-full mb-4 text-base',
center ? 'text-center' : 'text-left',
]}
@@ -37,11 +37,17 @@
{style}
aria-label={$t('aria.element.pageHeader')}
>
<h1
class={[sizes[size], 'flex gap-2 w-full tracking-tight font-medium', clazz]}
>
{@render children?.()}
</h1>
{#if children}
<h1
class={[
sizes[size],
'flex gap-2 w-full tracking-tight font-medium',
clazz,
]}
>
{@render children?.()}
</h1>
{/if}
{#if extended}
<div class="flex flex-col gap-3 mt-3">
{@render extended?.()}
+16 -1
View File
@@ -3,6 +3,7 @@ import { profile } from '$lib/auth.svelte'
import type {
CommentView,
CommunityView,
FeedView,
GetComments,
GetCommunityResponse,
GetPersonDetails,
@@ -48,7 +49,7 @@ export class Feed<Params, Response> {
}
}
interface FeedTypes {
export interface FeedTypes {
'/': [
GetPosts,
{
@@ -94,6 +95,20 @@ interface FeedTypes {
params: { posts: GetPost; comments: GetComments }
},
]
'/f/[id]': [
GetPosts,
{
posts: PostView[]
next_page?: string
params: GetPosts
feed: Promise<FeedView | undefined>
client: {
itemHeights?: (number | null)[]
lastSeen?: number
}
},
]
}
const feeds = new SvelteMap<keyof FeedTypes, Feed<any, any>>()