flotilla/src/app/components/ChatMessageMenuMobile.svelte

43 lines
1.4 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"
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, sendWrapped} from "@app/commands"
import {pushModal} from "@app/modal"
import {clip} from "@app/toast"
const {event, pubkeys} = $props()
2024-10-24 23:28:56 +00:00
2025-02-18 01:33:21 +00:00
const onEmoji = ((event: TrustedEvent, emoji: NativeEmoji) => {
2024-10-24 23:28:56 +00:00
history.back()
sendWrapped({template: makeReaction({event, content: emoji.unicode}), pubkeys})
}).bind(undefined, event)
2024-10-24 23:28:56 +00:00
const showEmojiPicker = () => pushModal(EmojiPicker, {onClick: onEmoji}, {replaceState: true})
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>
<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>