Break out a few shared sub-components

This commit is contained in:
Jon Staab
2025-02-06 09:39:23 -08:00
parent 5684d1a9cf
commit d66371d573
6 changed files with 49 additions and 47 deletions
+4 -10
View File
@@ -3,16 +3,16 @@
import {type Instance} from "tippy.js"
import type {NativeEmoji} from "emoji-picker-element/shared"
import {max} from "@welshman/lib"
import {deriveEvents, deriveIsDeleted} from "@welshman/store"
import {deriveEvents} from "@welshman/store"
import type {TrustedEvent} from "@welshman/util"
import {COMMENT} from "@welshman/util"
import {thunks, load, pubkey, repository, formatTimestampRelative} from "@welshman/app"
import {load, pubkey, repository, formatTimestampRelative} from "@welshman/app"
import Icon from "@lib/components/Icon.svelte"
import Tippy from "@lib/components/Tippy.svelte"
import Button from "@lib/components/Button.svelte"
import EmojiButton from "@lib/components/EmojiButton.svelte"
import ReactionSummary from "@app/components/ReactionSummary.svelte"
import ThunkStatus from "@app/components/ThunkStatus.svelte"
import ThunkStatusOrDeleted from "@app/components/ThunkStatusOrDeleted.svelte"
import ThreadMenu from "@app/components/ThreadMenu.svelte"
import {publishDelete, publishReaction} from "@app/commands"
import {notifications} from "@app/notifications"
@@ -26,8 +26,6 @@
const {url, event, showActivity = false}: Props = $props()
const thunk = $derived($thunks[event.id])
const deleted = deriveIsDeleted(repository, event)
const path = makeThreadPath(url, event.id)
const filters = [{kinds: [COMMENT], "#E": [event.id]}]
const replies = deriveEvents(repository, {filters})
@@ -61,11 +59,7 @@
<div class="flex flex-wrap items-center justify-between gap-2">
<div class="flex flex-grow flex-wrap justify-end gap-2">
<ReactionSummary {url} {event} {onReactionClick} reactionClass="tooltip-left" />
{#if $deleted}
<div class="btn btn-error btn-xs rounded-full">Deleted</div>
{:else if thunk}
<ThunkStatus {thunk} />
{/if}
<ThunkStatusOrDeleted {event} />
{#if showActivity}
<div class="flex-inline btn btn-neutral btn-xs gap-1 rounded-full">
<Icon icon="reply" />