flotilla/src/app/components/ContentMention.svelte

24 lines
693 B
Svelte
Raw Normal View History

2024-09-24 21:12:38 +00:00
<script lang="ts">
import {removeUndefined} from "@welshman/lib"
2025-04-15 18:03:27 +00:00
import type {ProfilePointer} from "@welshman/content"
2025-06-25 00:23:07 +00:00
import {deriveProfileDisplay} from "@welshman/app"
2024-12-16 20:54:17 +00:00
import Button from "@lib/components/Button.svelte"
import ProfileDetail from "@app/components/ProfileDetail.svelte"
import {pushModal} from "@app/util/modal"
2024-09-24 21:12:38 +00:00
2025-04-15 18:03:27 +00:00
type Props = {
value: ProfilePointer
url?: string
}
2024-09-24 21:12:38 +00:00
2025-04-15 18:03:27 +00:00
const {value, url}: Props = $props()
2024-12-16 20:54:17 +00:00
const display = deriveProfileDisplay(value.pubkey, removeUndefined([url]))
2025-04-15 18:03:27 +00:00
const openProfile = () => pushModal(ProfileDetail, {pubkey: value.pubkey, url})
2024-09-24 21:12:38 +00:00
</script>
<Button onclick={openProfile} class="link-content">
2025-06-25 00:23:07 +00:00
@{$display}
2024-12-16 20:54:17 +00:00
</Button>