2026-06-17 16:08:58 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import {formatTimestamp, max} from "@welshman/lib"
|
|
|
|
|
import type {TrustedEvent} from "@welshman/util"
|
|
|
|
|
import {COMMENT, getTagValue} from "@welshman/util"
|
2026-06-24 18:19:13 +00:00
|
|
|
import {goto} from "$app/navigation"
|
2026-06-17 16:08:58 +00:00
|
|
|
import ProfileCircle from "@app/components/ProfileCircle.svelte"
|
|
|
|
|
import ProfileName from "@app/components/ProfileName.svelte"
|
|
|
|
|
import {deriveEventsForUrl} from "@app/repository"
|
|
|
|
|
import {makeThreadPath} from "@app/routes"
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
url: string
|
|
|
|
|
event: TrustedEvent
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {url, event}: Props = $props()
|
|
|
|
|
|
|
|
|
|
const filters = [{kinds: [COMMENT], "#E": [event.id]}]
|
|
|
|
|
const replies = deriveEventsForUrl(url, filters)
|
|
|
|
|
const replyCount = $derived($replies.length)
|
|
|
|
|
const lastActive = $derived(max([...$replies, event].map(e => e.created_at)))
|
|
|
|
|
const title = getTagValue("title", event.tags)
|
2026-06-24 18:19:13 +00:00
|
|
|
const path = makeThreadPath(url, event.id)
|
|
|
|
|
const goToThread = () => goto(path)
|
2026-06-17 16:08:58 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-07-02 18:36:05 +00:00
|
|
|
<tr
|
|
|
|
|
class="cursor-pointer transition-colors hover:bg-surface-less text-sm border-b border-solid border-line"
|
|
|
|
|
onclick={goToThread}>
|
|
|
|
|
<td class="px-4 py-3 align-top ellipsize">
|
|
|
|
|
{title || "Untitled thread"}
|
2026-06-24 18:09:44 +00:00
|
|
|
</td>
|
2026-07-02 18:36:05 +00:00
|
|
|
<td class="px-4 py-3 align-middle flex items-center gap-2">
|
|
|
|
|
<ProfileCircle pubkey={event.pubkey} {url} size={5} />
|
|
|
|
|
<span class="ellipsize">
|
|
|
|
|
<ProfileName pubkey={event.pubkey} {url} />
|
|
|
|
|
</span>
|
2026-06-24 18:09:44 +00:00
|
|
|
</td>
|
2026-07-02 18:36:05 +00:00
|
|
|
<td class="px-4 py-3 align-middle text-right">
|
2026-06-17 16:08:58 +00:00
|
|
|
{replyCount}
|
2026-06-24 18:09:44 +00:00
|
|
|
</td>
|
2026-06-24 18:19:13 +00:00
|
|
|
<td class="whitespace-nowrap px-4 py-2 align-middle text-right">
|
2026-06-17 16:08:58 +00:00
|
|
|
{formatTimestamp(lastActive)}
|
2026-06-24 18:09:44 +00:00
|
|
|
</td>
|
|
|
|
|
</tr>
|