flotilla/src/app/components/ProfileDetail.svelte

49 lines
1.5 KiB
Svelte
Raw Normal View History

2024-12-16 20:54:17 +00:00
<script lang="ts">
import {goto} from "$app/navigation"
import Icon from "@lib/components/Icon.svelte"
2025-06-05 19:25:55 +00:00
import Avatar from "@lib/components/Avatar.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"
import ChatEnable from "@app/components/ChatEnable.svelte"
import {canDecrypt, pubkeyLink} from "@app/state"
2024-12-16 20:54:17 +00:00
import {pushModal} from "@app/modal"
import {makeChatPath} from "@app/routes"
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 = () => ($canDecrypt ? goto(chatPath) : pushModal(ChatEnable, {next: chatPath}))
</script>
<div class="column gap-4">
<Profile showPubkey avatarSize={14} {pubkey} {url} />
2025-04-15 18:03:27 +00:00
<ProfileInfo {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">
2024-12-16 20:54:17 +00:00
<Icon icon="alt-arrow-left" />
Go back
</Button>
<div class="flex gap-2">
<Link external href={pubkeyLink(pubkey)} class="btn btn-neutral">
2025-06-05 19:25:55 +00:00
<Avatar src="/coracle.png" />
Open in Coracle
2024-12-16 20:54:17 +00:00
</Link>
<Button onclick={openChat} class="btn btn-primary">
2024-12-16 20:54:17 +00:00
<Icon icon="letter" />
Open Chat
</Button>
</div>
</ModalFooter>
</div>