chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.4.0 Latest 5 packages
0
0
<script lang="ts">
import { ErrorMessage, Loading } from '@hud/renderer';
import { onMount } from 'svelte';
import { Workspace as State } from './lib/workspace.svelte';
import { onSignedOut } from './lib/xrpc';
import SignIn from './SignIn.svelte';
import Workspace from './Workspace.svelte';
// The workspace page: signed out, what HUD is and a way to sign in;
// signed in, the workspace itself, once getWorkspace has said who is
// signed in and which canvases are open. Any method that finds the
// session gone turns it back to the signed-out page.
type Phase = { kind: 'loading' } | { kind: 'signed-out' } | { kind: 'error'; message: string } | { kind: 'signed-in'; ws: State };
let phase: Phase = $state({ kind: 'loading' });
let signedOut = false;
onSignedOut(() => {
signedOut = true;
phase = { kind: 'signed-out' };
});
async function start() {
phase = { kind: 'loading' };
signedOut = false;
const ws = new State();
await ws.load();
if (signedOut) return;
phase = ws.failed ? { kind: 'error', message: ws.failed } : { kind: 'signed-in', ws };
}
onMount(() => {
void start();
});
</script>
{#if phase.kind === 'loading'}
<main class="center"><Loading label="Opening your workspace…" /></main>
{:else if phase.kind === 'signed-out'}
<SignIn />
{:else if phase.kind === 'error'}
<main class="center"><ErrorMessage message={phase.message} onretry={() => void start()} /></main>
{:else}
<Workspace ws={phase.ws} />
{/if}
<style>
.center {
display: grid;
place-items: center;
height: 100%;
}
</style>