flotilla/src/app/components/ProfileDetail.svelte

54 lines
1.8 KiB
Svelte
Raw Normal View History

2024-12-16 20:54:17 +00:00
<script lang="ts">
import {goto} from "$app/navigation"
import {shouldUnwrap} from "@welshman/app"
2025-09-10 22:26:39 +00:00
import AltArrowLeft from "@assets/icons/alt-arrow-left.svg?dataurl"
import Letter from "@assets/icons/letter-opened.svg?dataurl"
2024-12-16 20:54:17 +00:00
import Icon from "@lib/components/Icon.svelte"
import ImageIcon from "@lib/components/ImageIcon.svelte"
2024-12-16 20:54:17 +00:00
import Link from "@lib/components/Link.svelte"
import Button from "@lib/components/Button.svelte"
import ModalFooter from "@lib/components/ModalFooter.svelte"
import Profile from "@app/components/Profile.svelte"
2024-12-16 20:54:17 +00:00
import ProfileInfo from "@app/components/ProfileInfo.svelte"
2025-06-05 20:01:36 +00:00
import ProfileBadges from "@app/components/ProfileBadges.svelte"
2024-12-16 20:54:17 +00:00
import ChatEnable from "@app/components/ChatEnable.svelte"
import {pubkeyLink} from "@app/core/state"
import {pushModal} from "@app/util/modal"
import {makeChatPath} from "@app/util/routes"
2024-12-16 20:54:17 +00:00
2025-04-15 18:03:27 +00:00
export type Props = {
pubkey: string
url?: string
}
2024-12-16 20:54:17 +00:00
2025-04-15 18:03:27 +00:00
const {pubkey, url}: Props = $props()
2024-12-16 20:54:17 +00:00
const back = () => history.back()
const chatPath = makeChatPath([pubkey])
const openChat = () => ($shouldUnwrap ? goto(chatPath) : pushModal(ChatEnable, {next: chatPath}))
2024-12-16 20:54:17 +00:00
</script>
2025-06-05 20:01:36 +00:00
<div class="flex flex-col gap-4">
<Profile showPubkey avatarSize={14} {pubkey} {url} />
2025-04-15 18:03:27 +00:00
<ProfileInfo {pubkey} {url} />
2025-06-05 20:01:36 +00:00
<ProfileBadges {pubkey} {url} />
2024-12-16 20:54:17 +00:00
<ModalFooter>
2025-05-09 19:26:05 +00:00
<Button onclick={back} class="hidden md:btn md:btn-link">
2025-09-10 22:26:39 +00:00
<Icon icon={AltArrowLeft} />
2024-12-16 20:54:17 +00:00
Go back
</Button>
<div class="flex gap-2">
<Link external href={pubkeyLink(pubkey)} class="btn btn-neutral">
2025-11-13 16:59:32 +00:00
<ImageIcon alt="" src="/coracle.png" />
2025-06-05 19:25:55 +00:00
Open in Coracle
2024-12-16 20:54:17 +00:00
</Link>
<Button onclick={openChat} class="btn btn-primary">
2025-09-10 22:26:39 +00:00
<Icon icon={Letter} />
2024-12-16 20:54:17 +00:00
Open Chat
</Button>
</div>
</ModalFooter>
</div>