2024-09-23 20:10:15 +00:00
|
|
|
<script lang="ts">
|
2025-05-05 17:11:02 +00:00
|
|
|
import {nthEq, formatTimestamp} from "@welshman/lib"
|
2025-02-06 17:53:50 +00:00
|
|
|
import type {TrustedEvent} from "@welshman/util"
|
2024-10-23 21:20:24 +00:00
|
|
|
import Link from "@lib/components/Link.svelte"
|
2024-09-24 21:12:38 +00:00
|
|
|
import Content from "@app/components/Content.svelte"
|
2025-02-06 19:12:15 +00:00
|
|
|
import ProfileLink from "@app/components/ProfileLink.svelte"
|
2024-10-24 16:45:27 +00:00
|
|
|
import ThreadActions from "@app/components/ThreadActions.svelte"
|
2025-08-21 22:01:31 +00:00
|
|
|
import {makeThreadPath} from "@app/util/routes"
|
2024-09-23 20:10:15 +00:00
|
|
|
|
2025-04-15 18:03:27 +00:00
|
|
|
type Props = {
|
2025-02-06 17:53:50 +00:00
|
|
|
url: string
|
|
|
|
|
event: TrustedEvent
|
2025-04-15 18:03:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {url, event}: Props = $props()
|
2024-10-29 21:02:51 +00:00
|
|
|
|
2024-10-31 19:24:40 +00:00
|
|
|
const title = event.tags.find(nthEq(0, "title"))?.[1]
|
2024-09-23 20:10:15 +00:00
|
|
|
</script>
|
|
|
|
|
|
2024-10-23 21:20:24 +00:00
|
|
|
<Link class="col-2 card2 bg-alt w-full cursor-pointer" href={makeThreadPath(url, event.id)}>
|
2024-12-05 23:32:27 +00:00
|
|
|
{#if title}
|
|
|
|
|
<div class="flex w-full items-center justify-between gap-2">
|
|
|
|
|
<p class="text-xl">{title}</p>
|
|
|
|
|
<p class="text-sm opacity-75">
|
|
|
|
|
{formatTimestamp(event.created_at)}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
{:else}
|
2025-01-02 23:08:16 +00:00
|
|
|
<p class="mb-3 h-0 text-xs opacity-75">
|
2024-10-23 21:20:24 +00:00
|
|
|
{formatTimestamp(event.created_at)}
|
|
|
|
|
</p>
|
2024-12-05 23:32:27 +00:00
|
|
|
{/if}
|
2025-04-15 18:03:27 +00:00
|
|
|
<Content {event} {url} expandMode="inline" />
|
2024-11-20 23:56:24 +00:00
|
|
|
<div class="flex w-full flex-col items-end justify-between gap-2 sm:flex-row">
|
2025-02-06 19:12:15 +00:00
|
|
|
<span class="whitespace-nowrap py-1 text-sm opacity-75">
|
2025-04-15 18:03:27 +00:00
|
|
|
Posted by <ProfileLink pubkey={event.pubkey} {url} />
|
2025-02-06 19:12:15 +00:00
|
|
|
</span>
|
2025-02-06 18:24:31 +00:00
|
|
|
<ThreadActions showActivity {url} {event} />
|
2024-10-23 21:20:24 +00:00
|
|
|
</div>
|
|
|
|
|
</Link>
|