impr: restructure src/lib

This commit is contained in:
Xylight committed 2025-09-24 17:12:19 -07:00
1 parent d85b889409
commit 75f907743e
376 files changed
+1000 -1033

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
<script lang="ts">
import type { PostView } from '$lib/api/types'
import Placeholder from '$lib/ui/info/Placeholder.svelte'
import { settings } from '$lib/settings.svelte.js'
import { Button } from 'mono-svelte'
import type { Snippet } from 'svelte'
import { ArchiveBox, Plus } from 'svelte-hero-icons'
import { Post } from '..'
interface Props {
posts: PostView[]
community?: boolean
children?: Snippet
}
let { posts = $bindable(), community = false, children }: Props = $props()
</script>
<ul
class="flex flex-col list-none divide-y divide-slate-200 dark:divide-zinc-800"
>
{#if posts?.length == 0}
<div class="h-full grid place-items-center">
<Placeholder
icon={ArchiveBox}
title="No posts"
description="There are no posts that match this filter."
>
<Button href="/communities" icon={Plus}>
<span>Follow some communities</span>
</Button>
</Placeholder>
</div>
{:else}
{#each posts as post, index (post.post.id)}
<li class="relative post-container">
<Post
hideCommunity={community}
view={(post.post.featured_community || post.post.featured_local) &&
settings.posts.compactFeatured
? 'compact'
: settings.view}
{post}
class="transition-all duration-250"
onhide={() => {
posts = posts.toSpliced(index, 1)
}}
/>
</li>
{/each}
{/if}
{@render children?.()}
</ul>