~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0
56 lines · 1.5 KB Raw History
<script lang="ts">
	import Icon from '../atoms/Icon.svelte';
	import { signIn, XrpcError } from '../xrpc';

	/**
	 * Said on every canvas while the person signed in before HUD asked their
	 * account's server for all it asks for now: what needs the rest is
	 * refused until they sign in again, as `who` (their handle or DID),
	 * straight on to their account's server.
	 */
	let { who }: { who: string } = $props();

	let busy = $state(false);
	let problem = $state('');

	async function again() {
		busy = true;
		problem = '';
		try {
			location.assign(await signIn(who));
		} catch (error) {
			problem = error instanceof XrpcError ? error.message : 'Signing in did not work. Try again.';
			busy = false;
		}
	}
</script>

<div class="notice" role="status">
	<Icon name="info" />
	<span class="message">HUD can do more now than when you signed in. Sign in again to allow it.{#if problem}<br /><span class="problem" role="alert">{problem}</span>{/if}</span>
	<button type="button" class="btn sm" disabled={busy} aria-busy={busy} onclick={() => void again()}>{busy ? 'Signing in…' : 'Sign in again'}</button>
</div>

<style>
	.notice {
		display: flex;
		align-items: center;
		gap: var(--space-2);
		padding: var(--space-1-5) var(--space-3);
		border-bottom: var(--border);
		border-bottom-color: var(--notice-track);
		background: var(--notice);
		color: var(--fg);
		font-size: var(--text-sm);
	}

	.notice > :global(.i) {
		color: var(--notice-fg);
	}

	.message {
		flex: 1;
		min-width: 0;
		overflow-wrap: anywhere;
	}
</style>