Files
familienarchiv/frontend/src/lib/person/personHoverCard.ts
2026-05-05 14:35:15 +02:00

24 lines
853 B
TypeScript

import type { components } from '$lib/generated/api';
type Person = components['schemas']['Person'];
type RelationshipDTO = components['schemas']['RelationshipDTO'];
/**
* Data the PersonHoverCard needs to render its loaded state.
* Bundled here so the orchestrator (TranscriptionReadView) and the view
* (PersonHoverCard) share one canonical shape.
*/
export type HoverData = { person: Person; relationships: RelationshipDTO[] };
/**
* The hover card's three visible states.
*
* `loading` — initial fetch in flight; skeleton is shown
* `error` — fetch failed (non-404, non-OK); generic error message + footer link
* `loaded` — fetch succeeded; person + relationships available
*/
export type LoadState =
| { status: 'loading' }
| { status: 'error' }
| { status: 'loaded'; person: Person; relationships: RelationshipDTO[] };