2024-10-16 18:27:27 +00:00
|
|
|
<script lang="ts">
|
2025-10-06 18:23:19 +00:00
|
|
|
import type {TrustedEvent} from "@welshman/util"
|
2024-10-17 23:03:50 +00:00
|
|
|
import {pubkey} from "@welshman/app"
|
2025-10-06 18:23:19 +00:00
|
|
|
import Code2 from "@assets/icons/code-2.svg?dataurl"
|
|
|
|
|
import TrashBin2 from "@assets/icons/trash-bin-2.svg?dataurl"
|
|
|
|
|
import Danger from "@assets/icons/danger.svg?dataurl"
|
2024-10-16 18:27:27 +00:00
|
|
|
import Button from "@lib/components/Button.svelte"
|
|
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
|
|
|
|
import EventInfo from "@app/components/EventInfo.svelte"
|
2025-01-15 01:23:27 +00:00
|
|
|
import EventReport from "@app/components/EventReport.svelte"
|
2025-02-18 17:03:10 +00:00
|
|
|
import EventDeleteConfirm from "@app/components/EventDeleteConfirm.svelte"
|
2025-08-21 22:01:31 +00:00
|
|
|
import {pushModal} from "@app/util/modal"
|
2024-10-16 18:27:27 +00:00
|
|
|
|
2025-10-06 18:23:19 +00:00
|
|
|
type Props = {
|
|
|
|
|
url: string
|
|
|
|
|
event: TrustedEvent
|
|
|
|
|
onClick: () => void
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {url, event, onClick}: Props = $props()
|
2024-10-16 18:27:27 +00:00
|
|
|
|
2025-01-15 01:23:27 +00:00
|
|
|
const report = () => {
|
|
|
|
|
onClick()
|
|
|
|
|
pushModal(EventReport, {url, event})
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-16 18:27:27 +00:00
|
|
|
const showInfo = () => {
|
|
|
|
|
onClick()
|
2025-03-03 20:10:47 +00:00
|
|
|
pushModal(EventInfo, {url, event})
|
2024-10-16 18:27:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const showDelete = () => {
|
|
|
|
|
onClick()
|
2025-02-18 17:03:10 +00:00
|
|
|
pushModal(EventDeleteConfirm, {url, event})
|
2024-10-16 18:27:27 +00:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2025-11-05 23:32:55 +00:00
|
|
|
<ul class="menu whitespace-nowrap rounded-box bg-base-100 p-2 shadow-md">
|
2024-10-16 18:27:27 +00:00
|
|
|
<li>
|
2025-02-04 01:21:46 +00:00
|
|
|
<Button onclick={showInfo}>
|
2025-09-10 22:26:39 +00:00
|
|
|
<Icon size={4} icon={Code2} />
|
2025-10-06 18:23:19 +00:00
|
|
|
Show JSON
|
2024-10-16 18:27:27 +00:00
|
|
|
</Button>
|
|
|
|
|
</li>
|
|
|
|
|
{#if event.pubkey === $pubkey}
|
|
|
|
|
<li>
|
2025-02-04 01:21:46 +00:00
|
|
|
<Button onclick={showDelete} class="text-error">
|
2025-09-10 22:26:39 +00:00
|
|
|
<Icon size={4} icon={TrashBin2} />
|
2024-10-16 18:27:27 +00:00
|
|
|
Delete Message
|
|
|
|
|
</Button>
|
|
|
|
|
</li>
|
2025-01-15 01:23:27 +00:00
|
|
|
{:else}
|
|
|
|
|
<li>
|
2025-02-04 01:21:46 +00:00
|
|
|
<Button class="text-error" onclick={report}>
|
2025-09-10 22:26:39 +00:00
|
|
|
<Icon size={4} icon={Danger} />
|
2025-01-15 01:23:27 +00:00
|
|
|
Report Content
|
|
|
|
|
</Button>
|
|
|
|
|
</li>
|
2024-10-16 18:27:27 +00:00
|
|
|
{/if}
|
|
|
|
|
</ul>
|