flotilla/src/app/components/ChatMessageMenuMobile.svelte

59 lines
1.7 KiB
Svelte
Raw Normal View History

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"
2024-10-24 23:28:56 +00:00
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import EmojiPicker from "@lib/components/EmojiPicker.svelte"
import EventInfo from "@app/components/EventInfo.svelte"
import {makeReaction} from "@app/core/commands"
import {pushModal} from "@app/util/modal"
import {clip} from "@app/util/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
}
const {event, pubkeys, reply}: 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()
sendWrapped({template: makeReaction({event, content: emoji.unicode, protect: false}), pubkeys})
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()
}
2024-10-24 23:28:56 +00:00
const copyText = () => {
history.back()
clip(event.content)
}
const showInfo = () => pushModal(EventInfo, {event}, {replaceState: true})
</script>
<div class="col-2">
<Button class="btn btn-primary w-full" onclick={showEmojiPicker}>
2024-10-24 23:28:56 +00:00
<Icon size={4} icon="smile-circle" />
Send Reaction
</Button>
2025-03-04 18:20:06 +00:00
<Button class="btn btn-neutral w-full" onclick={sendReply}>
<Icon size={4} icon="reply" />
Send Reply
</Button>
<Button class="btn btn-neutral w-full" onclick={copyText}>
2024-10-24 23:28:56 +00:00
<Icon size={4} icon="copy" />
Copy Text
</Button>
<Button class="btn btn-neutral" onclick={showInfo}>
2024-10-24 23:28:56 +00:00
<Icon size={4} icon="code-2" />
Message Details
</Button>
</div>