forked from coracle/flotilla
9df8cee501
Adopts the rewritten welshman API: the removed @welshman/util helpers (Profile/List/Room/Handler/Encryptable) are now Reader/Builder classes in @welshman/domain, and @welshman/app dropped its global singletons for an App instance + app.use(Plugin) registry. - src/app/welshman.ts is now the app bootstrap + session-state module (one shared App instance, multi-account sessions/login, app-wide reactive views) rather than a compat shim re-exporting the old globals. - Rewrote ~100 callers to use app.use(Plugin) directly (thunks, profiles, relays, rooms, zaps, tags, wot, feeds, sync); thunk helpers are now thunk methods. - Added @welshman/domain dependency. - Resolved residual gaps (storage hydration via plugin.onItem/wrapManager/Plaintext, relay-list mutators, search-relay list, outbox #d filter). Best-effort: no toolchain/linking available, so this is not build- or type-checked. Remaining judgment calls are flagged with TODO(welshman-migration). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BsMjvv7krpZeHK1Njeneru
87 lines
2.6 KiB
Svelte
87 lines
2.6 KiB
Svelte
<script lang="ts">
|
|
import type {NativeEmoji} from "emoji-picker-element/shared"
|
|
import type {TrustedEvent} from "@welshman/util"
|
|
import {app} from "@app/welshman"
|
|
import {Wraps} from "@welshman/app"
|
|
import SmileCircle from "@assets/icons/smile-circle.svg?dataurl"
|
|
import Pen from "@assets/icons/pen.svg?dataurl"
|
|
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"
|
|
import Icon from "@lib/components/Icon.svelte"
|
|
import Modal from "@lib/components/Modal.svelte"
|
|
import ModalBody from "@lib/components/ModalBody.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/reactions"
|
|
import {pushModal} from "@app/modal"
|
|
import {clip} from "@app/toast"
|
|
|
|
type Props = {
|
|
pubkeys: string[]
|
|
event: TrustedEvent
|
|
reply: () => void
|
|
edit?: () => void
|
|
}
|
|
|
|
const {event, pubkeys, reply, edit}: Props = $props()
|
|
|
|
const onEmoji = ((event: TrustedEvent, pubkeys: string[], emoji: NativeEmoji) => {
|
|
history.back()
|
|
app.use(Wraps).publish({
|
|
event: makeReaction({event, content: emoji.unicode, protect: false}),
|
|
recipients: pubkeys,
|
|
pow: 16,
|
|
})
|
|
}).bind(undefined, event, pubkeys)
|
|
|
|
const showEmojiPicker = () => pushModal(EmojiPicker, {onClick: onEmoji}, {replaceState: true})
|
|
|
|
const sendReply = () => {
|
|
history.back()
|
|
reply()
|
|
}
|
|
|
|
const sendEdit = () => {
|
|
history.back()
|
|
edit?.()
|
|
}
|
|
|
|
const copyText = () => {
|
|
history.back()
|
|
clip(event.content)
|
|
}
|
|
|
|
const showInfo = () => pushModal(EventInfo, {event}, {replaceState: true})
|
|
</script>
|
|
|
|
<Modal>
|
|
<ModalBody>
|
|
<div class="flex flex-col gap-2">
|
|
<Button class="btn btn-neutral" onclick={showInfo}>
|
|
<Icon size={4} icon={Code2} />
|
|
Message Info
|
|
</Button>
|
|
<Button class="btn btn-neutral w-full" onclick={copyText}>
|
|
<Icon size={4} icon={Copy} />
|
|
Copy Text
|
|
</Button>
|
|
<Button class="btn btn-neutral w-full" onclick={sendReply}>
|
|
<Icon size={4} icon={Reply} />
|
|
Send Reply
|
|
</Button>
|
|
{#if edit}
|
|
<Button class="btn btn-neutral w-full" onclick={sendEdit}>
|
|
<Icon size={4} icon={Pen} />
|
|
Edit Message
|
|
</Button>
|
|
{/if}
|
|
<Button class="btn btn-primary w-full" onclick={showEmojiPicker}>
|
|
<Icon size={4} icon={SmileCircle} />
|
|
Send Reaction
|
|
</Button>
|
|
</div>
|
|
</ModalBody>
|
|
</Modal>
|