8 changed files with 85 additions and 2 deletions
@ -0,0 +1,14 @@ |
|||||||
|
<script lang="ts"> |
||||||
|
import UserHeader from "../users/UserHeader.svelte"; |
||||||
|
import type { User } from "../users/type"; |
||||||
|
import { defaults as user_defaults } from "../users/type"; |
||||||
|
|
||||||
|
export let author: User = { ...user_defaults }; |
||||||
|
</script> |
||||||
|
|
||||||
|
<div class="pl-3 p-3 border-b border-base-300"> |
||||||
|
<UserHeader user={author} /> |
||||||
|
<div class="ml-11"> |
||||||
|
<slot /> |
||||||
|
</div> |
||||||
|
</div> |
||||||
@ -0,0 +1,3 @@ |
|||||||
|
<div class="border-l border-blue-500 pl-1"> |
||||||
|
<slot /> |
||||||
|
</div> |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
import { defaults as user_defaults } from "../users/type"; |
||||||
|
import type { User } from "../users/type"; |
||||||
|
|
||||||
|
export interface Event { |
||||||
|
author: User; |
||||||
|
content: any; |
||||||
|
} |
||||||
|
|
||||||
|
let defaults: Event = { |
||||||
|
author: { ...user_defaults }, |
||||||
|
content: [], |
||||||
|
} |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
<script lang="ts"> |
||||||
|
import EventWrapper from "$lib/components/events/EventWrapper.svelte"; |
||||||
|
import type { User } from "$lib/components/users/type"; |
||||||
|
import { defaults as user_defaults } from "$lib/components/users/type"; |
||||||
|
import { ensureUser } from "$lib/stores/users"; |
||||||
|
import type { NDKEvent } from "@nostr-dev-kit/ndk"; |
||||||
|
import { onDestroy } from "svelte"; |
||||||
|
import { writable } from "svelte/store"; |
||||||
|
|
||||||
|
export let event: NDKEvent; |
||||||
|
|
||||||
|
let author = writable({ ...user_defaults }); |
||||||
|
let author_unsubsriber = ensureUser(event.pubkey).subscribe((u) => { |
||||||
|
author.set({ ...u }); |
||||||
|
}); |
||||||
|
onDestroy(() => { |
||||||
|
author_unsubsriber(); |
||||||
|
}); |
||||||
|
</script> |
||||||
|
|
||||||
|
<EventWrapper author={$author}>{event.content}</EventWrapper> |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
<script lang="ts"> |
||||||
|
import type { User } from "$lib/components/users/type"; |
||||||
|
import { defaults as user_defaults } from "$lib/components/users/type"; |
||||||
|
import { ndk } from "$lib/stores/ndk"; |
||||||
|
import { ensureUser } from "$lib/stores/users"; |
||||||
|
import type { NDKEvent } from "@nostr-dev-kit/ndk"; |
||||||
|
import { onDestroy } from "svelte"; |
||||||
|
import EventCard from "./EventCard.svelte"; |
||||||
|
import ThreadWrapper from "$lib/components/events/ThreadWrapper.svelte"; |
||||||
|
|
||||||
|
export let event: NDKEvent; |
||||||
|
|
||||||
|
let replies = ndk.storeSubscribe({ |
||||||
|
"#e": [event.id], |
||||||
|
}); |
||||||
|
</script> |
||||||
|
|
||||||
|
<EventCard {event} /> |
||||||
|
|
||||||
|
<ThreadWrapper> |
||||||
|
{#each $replies as event} |
||||||
|
<EventCard {event} /> |
||||||
|
{/each} |
||||||
|
</ThreadWrapper> |
||||||
Loading…
Reference in new issue