flotilla/src/app/components/ProfileMenu.svelte

35 lines
1.1 KiB
Svelte
Raw Normal View History

2026-07-03 00:27:28 +00:00
<script lang="ts">
import type {Snippet} from "svelte"
2026-08-29 17:20:39 +00:00
import type {Maybe} from "@welshman/lib"
2026-07-03 00:27:28 +00:00
import MenuDots from "@assets/icons/menu-dots.svg?dataurl"
import Icon from "@lib/components/Icon.svelte"
2026-07-03 00:32:44 +00:00
import Tippy from "@lib/components/Tippy.svelte"
2026-08-29 17:20:39 +00:00
import type {TippyController} from "@lib/components/Tippy.svelte"
2026-07-03 00:27:28 +00:00
import Button from "@lib/components/Button.svelte"
2026-07-03 00:32:44 +00:00
import ProfileMenuList from "@app/components/ProfileMenuList.svelte"
2026-07-03 00:27:28 +00:00
type Props = {
pubkey: string
url?: string
customActions?: Snippet
}
const {pubkey, url, customActions}: Props = $props()
2026-08-29 17:20:39 +00:00
const showPopover = () => tippy?.show()
2026-07-03 00:27:28 +00:00
2026-08-29 17:20:39 +00:00
const hidePopover = () => tippy?.hide()
let tippy: Maybe<TippyController> = $state()
2026-07-03 00:27:28 +00:00
</script>
2026-07-03 00:32:44 +00:00
<Button onclick={showPopover} class="button button-circle button-ghost button-sm">
<Tippy
2026-08-29 17:20:39 +00:00
bind:controller={tippy}
2026-07-03 00:32:44 +00:00
component={ProfileMenuList}
props={{pubkey, url, customActions, onClick: hidePopover}}
params={{trigger: "manual", interactive: true, placement: "bottom-end"}}>
2026-07-03 00:27:28 +00:00
<Icon icon={MenuDots} />
2026-07-03 00:32:44 +00:00
</Tippy>
</Button>