chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.3.1 Latest 5 packages
0
0
<script lang="ts">
import ClampedText from '../ClampedText.svelte';
import LinkButton from '../LinkButton.svelte';
import type { Opener } from '../open';
import Picture from '../Picture.svelte';
import type { Run } from '../richtext';
import type { Source } from '../types';
// An account as its profile shows it, read by the
// server: a banner, an avatar, its
// name and handle (which opens the account, when `open` is given), and
// its description, its links and mentions opened through `onopenlink`
// and `onopenactor`.
let {
name = null,
handle = null,
description = null,
avatar = null,
banner = null,
open = null,
onopenlink,
onopenactor
}: {
name?: string | null;
handle?: string | null;
description?: Run[] | null;
avatar?: Source | null;
banner?: Source | null;
open?: Opener | null;
onopenlink?: (url: string) => void;
onopenactor?: (actor: string) => Opener;
} = $props();
</script>
<section class="profile">
<div class="banner" class:empty={banner === null}>
{#if banner !== null}<Picture src={banner} alt="" />{/if}
</div>
<div class="body">
<span class="avatar"><Picture src={avatar} alt="" placeholder="·" /></span>
<div class="names" translate="no">
{#if name}<h2>{name}</h2>{/if}
{#if handle}
{#if open}
<LinkButton onclick={open.run} href={open.href} title={handle}>@{handle.replace(/^@/, '')}</LinkButton>
{:else}
<span class="handle">@{handle.replace(/^@/, '')}</span>
{/if}
{/if}
</div>
{#if description?.length}<div class="description"><ClampedText runs={description} {onopenlink} {onopenactor} /></div>{/if}
</div>
</section>
<style>
.profile {
border: var(--border-width-regular) solid var(--color-border-secondary);
border-radius: var(--border-radius-lg);
background: var(--color-background-primary);
overflow: hidden;
}
.banner {
aspect-ratio: 3 / 1;
background: var(--color-background-tertiary);
}
.banner.empty {
aspect-ratio: 6 / 1;
}
/* The names sit beside the avatar while there is room for 14rem of
them, else under it: flex lines wrapping, so it is the box's own
width that decides, the same on the server and in the browser,
whatever holds it. The description is a line of its own. */
.body {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
gap: var(--hud-space-2) var(--hud-space-3);
padding: 0 var(--hud-space-3) var(--hud-space-3);
}
.avatar {
display: block;
flex: none;
width: 4.5rem;
height: 4.5rem;
margin-top: -2.25rem;
border: 3px solid var(--color-background-primary);
border-radius: var(--border-radius-full);
background: var(--color-background-tertiary);
overflow: hidden;
font-size: 1.5rem;
}
.names {
display: flex;
flex: 1 1 14rem;
flex-direction: column;
align-items: flex-start;
min-width: 0;
font-size: var(--font-text-sm-size);
}
.description {
flex: 1 0 100%;
}
h2 {
margin: 0;
font-size: var(--font-heading-md-size);
font-weight: var(--font-weight-semibold);
line-height: var(--font-heading-md-line-height);
overflow-wrap: anywhere;
}
.handle {
color: var(--color-text-secondary);
}
.description {
font-size: var(--font-text-sm-size);
line-height: var(--font-text-sm-line-height);
}
</style>