chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.5.0 Latest 5 packages
0
0
<script lang="ts">
import type { IconName } from '../icons';
import Icon from './Icon.svelte';
/**
* An app's icon, as Bluesky shows a link's: its favicon, by its domain
* through HUD's own /icon/<domain>, or at `src`; 16px, its words beside
* it, or 32px (`md`) where it stands for the app alone. Where there is
* none, or it fails to load, the Lucide icon of what it is stands in.
*/
let { domain = null, src = null, fallback, size = 'sm' }: { domain?: string | null; src?: string | null; fallback: IconName; size?: 'sm' | 'md' } = $props();
const url = $derived(src ?? (domain ? `/icon/${encodeURIComponent(domain)}` : null));
let failed = $state<string | null>(null);
</script>
{#if url && failed !== url}
<img class="app {size}" src={url} alt="" width={size === 'md' ? 32 : 16} height={size === 'md' ? 32 : 16} loading="lazy" decoding="async" onerror={() => (failed = url)} />
{:else}
<Icon name={fallback} />
{/if}
<style>
.app {
flex: none;
width: var(--icon);
height: var(--icon);
object-fit: cover;
border-radius: var(--radius-icon);
vertical-align: -3px;
}
.app.md {
width: var(--avatar-md);
height: var(--avatar-md);
border-radius: var(--radius-md);
vertical-align: middle;
}
</style>