2024-09-24 21:12:38 +00:00
|
|
|
<script lang="ts">
|
2024-11-21 22:14:46 +00:00
|
|
|
import cx from "classnames"
|
2025-02-04 01:21:46 +00:00
|
|
|
import type {Snippet} from "svelte"
|
2025-05-05 17:11:02 +00:00
|
|
|
import {formatTimestamp} from "@welshman/lib"
|
2025-02-04 01:21:46 +00:00
|
|
|
import type {TrustedEvent} from "@welshman/util"
|
2025-09-10 22:26:39 +00:00
|
|
|
import Danger from "@assets/icons/danger-triangle.svg?dataurl"
|
2024-10-17 22:58:18 +00:00
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
|
|
|
|
import Button from "@lib/components/Button.svelte"
|
2024-09-24 21:12:38 +00:00
|
|
|
import Profile from "@app/components/Profile.svelte"
|
2024-11-21 22:14:46 +00:00
|
|
|
import ProfileName from "@app/components/ProfileName.svelte"
|
2026-06-08 21:14:40 +00:00
|
|
|
import {goToEvent} from "@app/routes"
|
2026-06-08 22:33:38 +00:00
|
|
|
import {isEventMuted} from "@app/social"
|
2024-09-24 21:12:38 +00:00
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
type Props = {
|
2025-02-04 00:37:14 +00:00
|
|
|
event: TrustedEvent
|
2026-06-24 20:10:06 +00:00
|
|
|
children?: Snippet
|
2025-02-04 01:21:46 +00:00
|
|
|
minimal?: boolean
|
|
|
|
|
hideProfile?: boolean
|
2025-04-15 18:03:27 +00:00
|
|
|
url?: string
|
2025-02-04 01:21:46 +00:00
|
|
|
class?: string
|
2026-06-24 20:56:53 +00:00
|
|
|
style?: string
|
2026-07-28 16:16:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {event, children, minimal = false, hideProfile = false, url, ...restProps}: Props = $props()
|
2024-10-01 23:27:25 +00:00
|
|
|
|
2024-10-17 22:58:18 +00:00
|
|
|
const ignoreMute = () => {
|
|
|
|
|
muted = false
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-28 16:16:26 +00:00
|
|
|
const goToNote = () => goToEvent(event)
|
|
|
|
|
|
2026-02-18 18:22:23 +00:00
|
|
|
let muted = $state($isEventMuted(event))
|
2024-09-24 21:12:38 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-06-23 23:30:54 +00:00
|
|
|
<div class="@container flex flex-col gap-2 {restProps.class}" style={restProps.style}>
|
2024-10-17 22:58:18 +00:00
|
|
|
{#if muted}
|
2024-10-17 23:03:50 +00:00
|
|
|
<div class="flex items-center justify-between">
|
2026-06-24 20:56:53 +00:00
|
|
|
<div class="flex gap-2 relative">
|
2025-09-10 22:26:39 +00:00
|
|
|
<Icon icon={Danger} class="mt-1" />
|
2024-10-17 23:03:50 +00:00
|
|
|
<p>You have muted this person.</p>
|
2024-10-17 22:58:18 +00:00
|
|
|
</div>
|
2025-02-04 01:21:46 +00:00
|
|
|
<Button class="link ml-8" onclick={ignoreMute}>Show anyway</Button>
|
2024-10-17 22:58:18 +00:00
|
|
|
</div>
|
|
|
|
|
{:else}
|
2026-02-03 17:49:44 +00:00
|
|
|
<div class="flex items-start justify-between gap-2">
|
2024-10-17 22:58:18 +00:00
|
|
|
{#if !hideProfile}
|
2024-11-21 22:14:46 +00:00
|
|
|
{#if minimal}
|
2025-04-15 18:03:27 +00:00
|
|
|
@<ProfileName pubkey={event.pubkey} {url} />
|
2024-11-21 22:14:46 +00:00
|
|
|
{:else}
|
2025-04-15 18:03:27 +00:00
|
|
|
<Profile pubkey={event.pubkey} {url} />
|
2024-11-21 22:14:46 +00:00
|
|
|
{/if}
|
2024-10-17 22:58:18 +00:00
|
|
|
{/if}
|
2025-11-14 19:35:19 +00:00
|
|
|
<Button
|
2026-06-23 23:30:54 +00:00
|
|
|
class={cx("text-sm opacity-75 @max-sm:hidden", {"text-xs": minimal})}
|
2026-07-28 16:16:26 +00:00
|
|
|
onclick={goToNote}>
|
2024-10-17 22:58:18 +00:00
|
|
|
{formatTimestamp(event.created_at)}
|
2025-11-14 19:35:19 +00:00
|
|
|
</Button>
|
2024-10-17 22:58:18 +00:00
|
|
|
</div>
|
2026-06-24 20:10:06 +00:00
|
|
|
{@render children?.()}
|
2024-10-17 22:58:18 +00:00
|
|
|
{/if}
|
2024-09-24 21:12:38 +00:00
|
|
|
</div>
|