flotilla/src/app/components/EventActions.svelte

44 lines
1.5 KiB
Svelte
Raw Normal View History

2025-02-06 18:00:25 +00:00
<script lang="ts">
2025-03-18 22:36:52 +00:00
import type {Snippet} from "svelte"
2026-08-29 17:20:39 +00:00
import type {Maybe} from "@welshman/lib"
2025-02-06 18:00:25 +00:00
import type {TrustedEvent} from "@welshman/util"
2025-09-10 22:26:39 +00:00
import MenuDots from "@assets/icons/menu-dots.svg?dataurl"
2025-02-06 18:00:25 +00:00
import Icon from "@lib/components/Icon.svelte"
import Tippy from "@lib/components/Tippy.svelte"
2026-08-29 17:20:39 +00:00
import type {TippyController} from "@lib/components/Tippy.svelte"
2025-02-06 18:00:25 +00:00
import Button from "@lib/components/Button.svelte"
2025-02-06 18:14:29 +00:00
import EventMenu from "@app/components/EventMenu.svelte"
import EventReactButtons from "@app/components/EventReactButtons.svelte"
2025-02-06 18:00:25 +00:00
2025-03-18 22:36:52 +00:00
type Props = {
2025-02-06 18:00:25 +00:00
url: string
2025-02-06 18:14:29 +00:00
noun: string
2025-02-06 18:00:25 +00:00
event: TrustedEvent
2025-07-15 22:56:55 +00:00
hideZap?: boolean
2025-03-18 22:36:52 +00:00
customActions?: Snippet
}
2025-07-15 22:56:55 +00:00
const {url, noun, event, hideZap, customActions}: Props = $props()
2025-02-06 18:00:25 +00:00
2026-08-29 17:20:39 +00:00
const showPopover = () => tippy?.show()
const hidePopover = () => tippy?.hide()
2025-02-06 18:00:25 +00:00
2026-08-29 17:20:39 +00:00
let tippy: Maybe<TippyController> = $state()
2025-02-06 18:00:25 +00:00
</script>
<!-- The compact segmented control a card footer gets. EventActionBar is the full-width
version a detail page gets. -->
<div class="items-center join">
<EventReactButtons {url} {event} {hideZap} class="button button-neutral button-xs join-item" />
<Button onclick={showPopover} class="flex join-item button button-neutral button-xs">
<Tippy
2026-08-29 17:20:39 +00:00
bind:controller={tippy}
component={EventMenu}
props={{url, noun, event, customActions, onClick: hidePopover}}
params={{trigger: "manual", interactive: true}}>
2025-09-10 22:26:39 +00:00
<Icon icon={MenuDots} size={4} />
</Tippy>
</Button>
</div>