flotilla/src/app/components/ProfileCircle.svelte

27 lines
665 B
Svelte
Raw Normal View History

2024-10-04 00:04:00 +00:00
<script lang="ts">
import cx from "classnames"
import {removeUndefined} from "@welshman/lib"
import {deriveProfile} from "@welshman/app"
import UserRounded from "@assets/icons/user-rounded.svg?dataurl"
import ImageIcon from "@lib/components/ImageIcon.svelte"
2024-10-04 00:04:00 +00:00
2025-04-15 18:03:27 +00:00
type Props = {
pubkey?: string
class?: string
style?: string
size?: number
2025-04-15 18:03:27 +00:00
url?: string
}
2024-10-04 00:04:00 +00:00
const {pubkey, url, size = 7, style = undefined, ...props}: Props = $props()
2025-04-15 18:03:27 +00:00
const profile = deriveProfile(pubkey, removeUndefined([url]))
2024-10-04 00:04:00 +00:00
</script>
<ImageIcon
{size}
{style}
2025-11-13 16:59:32 +00:00
alt=""
class={cx(props.class, "rounded-full")}
2025-11-13 16:59:32 +00:00
src={$profile?.picture || UserRounded} />