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
67 lines
2.4 KiB
Svelte
67 lines
2.4 KiB
Svelte
<script lang="ts">
|
|
import type {TrustedEvent, EventContent} from "@welshman/util"
|
|
import {getTagValue, getAddress} from "@welshman/util"
|
|
import {pubkey} from "@app/welshman"
|
|
import Pen2 from "@assets/icons/pen-2.svg?dataurl"
|
|
import Icon from "@lib/components/Icon.svelte"
|
|
import Button from "@lib/components/Button.svelte"
|
|
import Link from "@lib/components/Link.svelte"
|
|
import RoomName from "@app/components/RoomName.svelte"
|
|
import ReactionSummary from "@app/components/ReactionSummary.svelte"
|
|
import ThunkStatusOrDeleted from "@app/components/ThunkStatusOrDeleted.svelte"
|
|
import EventActivity from "@app/components/EventActivity.svelte"
|
|
import EventActions from "@app/components/EventActions.svelte"
|
|
import CalendarEventEdit from "@app/components/CalendarEventEdit.svelte"
|
|
import {publishDelete} from "@app/deletes"
|
|
import {publishReaction} from "@app/reactions"
|
|
import {canEnforceNip70} from "@app/relays"
|
|
import {makeCalendarPath, makeSpacePath} from "@app/routes"
|
|
import {pushModal} from "@app/modal"
|
|
|
|
type Props = {
|
|
url: string
|
|
event: TrustedEvent
|
|
showRoom?: boolean
|
|
showActivity?: boolean
|
|
}
|
|
|
|
const {url, event, showRoom, showActivity}: Props = $props()
|
|
|
|
const h = getTagValue("h", event.tags)
|
|
const path = makeCalendarPath(url, getAddress(event))
|
|
const shouldProtect = canEnforceNip70(url)
|
|
|
|
const editEvent = () => pushModal(CalendarEventEdit, {url, event})
|
|
|
|
const deleteReaction = async (event: TrustedEvent) =>
|
|
publishDelete({relays: [url], event, protect: await shouldProtect})
|
|
|
|
const createReaction = async (template: EventContent) =>
|
|
publishReaction({...template, event, relays: [url], protect: await shouldProtect})
|
|
</script>
|
|
|
|
<div class="flex grow flex-wrap justify-end gap-2">
|
|
{#if h && showRoom}
|
|
<Link href={makeSpacePath(url, h)} class="btn btn-neutral btn-xs rounded-full">
|
|
Posted in #<RoomName {h} {url} />
|
|
</Link>
|
|
{/if}
|
|
<ReactionSummary {url} {event} {deleteReaction} {createReaction} reactionClass="tooltip-left" />
|
|
<ThunkStatusOrDeleted {event} />
|
|
{#if showActivity}
|
|
<EventActivity {url} {path} {event} />
|
|
{/if}
|
|
<EventActions {url} {event} noun="Event">
|
|
{#snippet customActions()}
|
|
{#if event.pubkey === $pubkey}
|
|
<li>
|
|
<Button onclick={editEvent}>
|
|
<Icon size={4} icon={Pen2} />
|
|
Edit Event
|
|
</Button>
|
|
</li>
|
|
{/if}
|
|
{/snippet}
|
|
</EventActions>
|
|
</div>
|