2024-10-24 23:28:56 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import type {NativeEmoji} from "emoji-picker-element/shared"
|
2025-02-18 01:33:21 +00:00
|
|
|
import type {TrustedEvent} from "@welshman/util"
|
2025-05-05 17:11:02 +00:00
|
|
|
import {sendWrapped} from "@welshman/app"
|
2026-02-09 16:49:55 +00:00
|
|
|
import SmileCircle from "@assets/icons/smile-circle.svg?dataurl"
|
2026-03-10 22:13:33 +00:00
|
|
|
import Pen from "@assets/icons/pen.svg?dataurl"
|
2026-02-09 16:49:55 +00:00
|
|
|
import Reply from "@assets/icons/reply-2.svg?dataurl"
|
|
|
|
|
import Copy from "@assets/icons/copy.svg?dataurl"
|
|
|
|
|
import Code2 from "@assets/icons/code-2.svg?dataurl"
|
2024-10-24 23:28:56 +00:00
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
2026-02-09 16:49:55 +00:00
|
|
|
import Modal from "@lib/components/Modal.svelte"
|
|
|
|
|
import ModalBody from "@lib/components/ModalBody.svelte"
|
2024-10-24 23:28:56 +00:00
|
|
|
import Button from "@lib/components/Button.svelte"
|
|
|
|
|
import EmojiPicker from "@lib/components/EmojiPicker.svelte"
|
|
|
|
|
import EventInfo from "@app/components/EventInfo.svelte"
|
2026-06-08 22:33:38 +00:00
|
|
|
import {makeReaction} from "@app/reactions"
|
2026-06-08 21:14:40 +00:00
|
|
|
import {pushModal} from "@app/modal"
|
|
|
|
|
import {clip} from "@app/toast"
|
2024-10-24 23:28:56 +00:00
|
|
|
|
2025-03-04 18:20:06 +00:00
|
|
|
type Props = {
|
|
|
|
|
pubkeys: string[]
|
|
|
|
|
event: TrustedEvent
|
|
|
|
|
reply: () => void
|
2026-03-10 22:13:33 +00:00
|
|
|
edit?: () => void
|
2025-03-04 18:20:06 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-10 22:13:33 +00:00
|
|
|
const {event, pubkeys, reply, edit}: Props = $props()
|
2024-10-24 23:28:56 +00:00
|
|
|
|
2025-04-03 22:40:52 +00:00
|
|
|
const onEmoji = ((event: TrustedEvent, pubkeys: string[], emoji: NativeEmoji) => {
|
2024-10-24 23:28:56 +00:00
|
|
|
history.back()
|
2025-10-17 17:19:21 +00:00
|
|
|
sendWrapped({
|
|
|
|
|
event: makeReaction({event, content: emoji.unicode, protect: false}),
|
|
|
|
|
recipients: pubkeys,
|
2026-03-30 18:22:22 +00:00
|
|
|
pow: 16,
|
2025-10-17 17:19:21 +00:00
|
|
|
})
|
2025-04-03 22:40:52 +00:00
|
|
|
}).bind(undefined, event, pubkeys)
|
2024-10-24 23:28:56 +00:00
|
|
|
|
|
|
|
|
const showEmojiPicker = () => pushModal(EmojiPicker, {onClick: onEmoji}, {replaceState: true})
|
|
|
|
|
|
2025-03-04 18:20:06 +00:00
|
|
|
const sendReply = () => {
|
|
|
|
|
history.back()
|
|
|
|
|
reply()
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-10 22:13:33 +00:00
|
|
|
const sendEdit = () => {
|
|
|
|
|
history.back()
|
|
|
|
|
edit?.()
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-24 23:28:56 +00:00
|
|
|
const copyText = () => {
|
|
|
|
|
history.back()
|
|
|
|
|
clip(event.content)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const showInfo = () => pushModal(EventInfo, {event}, {replaceState: true})
|
|
|
|
|
</script>
|
|
|
|
|
|
2026-02-09 16:49:55 +00:00
|
|
|
<Modal>
|
|
|
|
|
<ModalBody>
|
2026-02-10 19:39:29 +00:00
|
|
|
<div class="flex flex-col gap-2">
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-neutral" onclick={showInfo}>
|
2026-02-10 19:39:29 +00:00
|
|
|
<Icon size={4} icon={Code2} />
|
|
|
|
|
Message Info
|
|
|
|
|
</Button>
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-neutral w-full" onclick={copyText}>
|
2026-02-10 19:39:29 +00:00
|
|
|
<Icon size={4} icon={Copy} />
|
|
|
|
|
Copy Text
|
|
|
|
|
</Button>
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-neutral w-full" onclick={sendReply}>
|
2026-02-10 19:39:29 +00:00
|
|
|
<Icon size={4} icon={Reply} />
|
|
|
|
|
Send Reply
|
|
|
|
|
</Button>
|
2026-03-10 22:13:33 +00:00
|
|
|
{#if edit}
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-neutral w-full" onclick={sendEdit}>
|
2026-03-10 22:13:33 +00:00
|
|
|
<Icon size={4} icon={Pen} />
|
|
|
|
|
Edit Message
|
|
|
|
|
</Button>
|
|
|
|
|
{/if}
|
2026-06-24 20:56:53 +00:00
|
|
|
<Button class="button button-primary w-full" onclick={showEmojiPicker}>
|
2026-02-10 19:39:29 +00:00
|
|
|
<Icon size={4} icon={SmileCircle} />
|
|
|
|
|
Send Reaction
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
2026-02-09 16:49:55 +00:00
|
|
|
</ModalBody>
|
|
|
|
|
</Modal>
|