refactor: move shared utilities to lib/shared/ sub-packages
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
23
frontend/src/lib/person/personHoverCard.ts
Normal file
23
frontend/src/lib/person/personHoverCard.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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[] };
|
||||
Reference in New Issue
Block a user