Support partials for homepage and contacts

Always using kind:30023 articles
This commit is contained in:
dtonon 2026-05-22 18:22:19 +01:00
parent 052bc45260
commit e453cafa76
4 changed files with 89 additions and 0 deletions

View file

@ -15,6 +15,7 @@
import { loadGroup } from "$lib/group.svelte";
import { loadGroups, groupsStore } from "$lib/groups.svelte";
import { loadResources } from "$lib/resources.svelte";
import { loadPartials } from "$lib/partials.svelte";
import { loadRoomAdmins } from "$lib/admins.svelte";
import { seedProfiles } from "$lib/profiles.svelte";
import { startChat } from "$lib/chat.svelte";
@ -28,6 +29,7 @@
onMount(async () => {
loadResources();
loadPartials();
const tasks = [restoreSession(), loadGroup()];
if (mode === "full") tasks.push(loadGroups());
await Promise.all(tasks);

View file

@ -1,10 +1,14 @@
<script lang="ts">
import DiscussionsFeed from "$lib/components/DiscussionsFeed.svelte";
import PostContent from "$lib/components/PostContent.svelte";
import { groupsStore } from "$lib/groups.svelte";
import { overviewStore, loadOverview } from "$lib/overview.svelte";
import { partialsStore } from "$lib/partials.svelte";
import { MODE, GROUP_ID } from "$lib/config";
import type { NostrUser } from "@nostr/gadgets/metadata";
const partial = $derived(partialsStore.get("home"));
// Full mode: load per-room activity + recent threads once the rooms are known.
$effect(() => {
if (MODE !== "full") return;
@ -46,6 +50,12 @@
{/if}
{/snippet}
{#if partial}
<div class="mt-4 mb-8">
<PostContent content={partial.content} headingOffset={0} />
</div>
{/if}
{#if MODE === "simple"}
<DiscussionsFeed groupId={GROUP_ID} title="Discussions" />
{:else}

View file

@ -13,6 +13,10 @@
ensureProfile,
type ProfileEntry,
} from "$lib/profiles.svelte";
import { partialsStore } from "$lib/partials.svelte";
import PostContent from "$lib/components/PostContent.svelte";
const partial = $derived(partialsStore.get("contacts"));
// Full mode pulls admins from every room; simple mode uses the one group.
$effect(() => {
@ -70,6 +74,12 @@
<div class="mx-auto max-w-6xl">
<h1 class="py-2 text-[1.65rem] text-brand">Contacts</h1>
{#if partial}
<div class="mb-8">
<PostContent content={partial.content} headingOffset={0} />
</div>
{/if}
{#if loading}
<p class="py-6 text-center text-neutral-400">Loading…</p>
{:else if contacts.length === 0}