flotilla/src/app/components/NoteItem.svelte

32 lines
1.3 KiB
Svelte
Raw Normal View History

2024-10-31 19:24:40 +00:00
<script lang="ts">
import type {NativeEmoji} from "emoji-picker-element/shared"
2025-05-12 22:10:24 +00:00
import type {TrustedEvent, EventContent} from "@welshman/util"
2024-10-31 19:24:40 +00:00
import Icon from "@lib/components/Icon.svelte"
import EmojiButton from "@lib/components/EmojiButton.svelte"
2025-02-11 23:37:50 +00:00
import NoteContent from "@app/components/NoteContent.svelte"
2024-10-31 19:24:40 +00:00
import NoteCard from "@app/components/NoteCard.svelte"
import ReactionSummary from "@app/components/ReactionSummary.svelte"
import {publishDelete, publishReaction} from "@app/commands"
const {url, event} = $props()
2024-10-31 19:24:40 +00:00
2025-05-12 22:10:24 +00:00
const deleteReaction = (event: TrustedEvent) => publishDelete({relays: [url], event})
2024-10-31 19:24:40 +00:00
2025-05-12 22:10:24 +00:00
const createReaction = (template: EventContent) =>
publishReaction({...template, event, relays: [url]})
2024-10-31 19:24:40 +00:00
const onEmoji = (emoji: NativeEmoji) =>
publishReaction({event, content: emoji.unicode, relays: [url]})
2024-10-31 19:24:40 +00:00
</script>
2025-04-15 18:03:27 +00:00
<NoteCard {event} {url} class="card2 bg-alt">
2025-02-11 23:37:50 +00:00
<NoteContent {event} expandMode="inline" />
2024-10-31 19:24:40 +00:00
<div class="flex w-full justify-between gap-2">
2025-05-12 22:10:24 +00:00
<ReactionSummary {url} {event} {deleteReaction} {createReaction} reactionClass="tooltip-right">
2024-10-31 19:24:40 +00:00
<EmojiButton {onEmoji} class="btn btn-neutral btn-xs h-[26px] rounded-box">
<Icon icon="smile-circle" size={4} />
</EmojiButton>
</ReactionSummary>
</div>
</NoteCard>