Files
familienarchiv/frontend/src/lib/shared
Marcel f10b0cb73e fix(journey): editor review round — labels, errors, pending state, a11y, tests
Addresses the remaining #792 review blockers and concerns in the journey
editor cluster:

- Interlude rows show 'Zwischentext' (dedicated key), not the add-button text
- All four mutation handlers route the backend ErrorCode through
  getErrorMessage (a 409 duplicate no longer says 'bitte Seite neu laden')
  and console.error their failures so client-side errors leave a trace
- Remove implements the spec'd pending state: row stays dimmed with an
  aria-live 'wird entfernt…' until the DELETE resolves; failure keeps the row
- Move announcements fire after the reorder resolves (no false 'verschoben')
- Touch targets ≥44px (remove ×, note links, create submit); focus moves to
  the new row after add, to a sensible neighbor after remove, back to × on
  confirm-cancel; drag handle is pointer-only; title/intro get aria-labels;
  publish-disabled reason is a visible hint, not a title tooltip
- Amber warning styles use new --color-warning-* tokens with dark remaps
- Blocked interlude-clear restores the draft instead of showing phantom text
- useBlockDragDrop moves to $lib/shared/hooks — geschichte no longer imports
  another domain's internals
- Test hardening: reorder-failure rollback (non-ok + reject), publish/
  unpublish/empty-warning surface, destructive confirm path, maxlength
  assertions, JourneyCreate failure path, edit-page STORY/JOURNEY branch,
  fixture factory, m.* assertions, all fixed sleeps replaced with polling

67 component tests green across 6 spec files; transcription consumer of the
moved hook re-verified (30 green).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 07:55:12 +02:00
..

shared (frontend)

Cross-domain utilities and UI primitives. Any file here is consumed by two or more domain folders and has no domain identity of its own.

Admission criteria (what belongs here)

A file belongs in shared/ if it meets all three conditions:

  1. No domain identity — it does not represent a Document, Person, Tag, etc.
  2. Consumed by ≥ 2 domain folders — or is framework infrastructure that every domain depends on.
  3. Generic — could work in a different SvelteKit project with zero business-logic changes.

If any condition fails, the file belongs in the domain folder of its primary consumer.

What this folder owns

Sub-folder / file Purpose
api.server.ts Typed openapi-fetch client factory — the standard entry point for all backend API calls in server-side load functions and actions
errors.ts Mirror of the backend ErrorCode enum + getErrorMessage() → Paraglide i18n key mapping
types.ts Cross-domain TypeScript interfaces
utils.ts Pure utility functions (date formatting, sorting, debounce)
relativeTime.ts Human-relative time formatting ("2 days ago")
primitives/ Generic UI components: BackButton.svelte, form inputs, pagination, layout shells
discussion/ Comment/mention editor shared by document/ and geschichte/
dashboard/ Family Pulse widget and recent-activity components assembled in the / route
hooks/ Svelte 5 reactive hooks: useTypeahead, useUnsavedWarning
services/ Generic client-side service helpers
actions/ Shared SvelteKit form action utilities
server/ Server-only shared utilities (load function helpers)
help/ Coach marks and empty-state components used across multiple domains

What does NOT belong here

  • Components owned by one domain — move to that domain's folder.
  • Domain-specific business logic — even if shared, it belongs in the owning domain's public surface.

Adding to shared/

If you need to add a file here, confirm it meets all three admission criteria. If it's domain-adjacent, check whether the owning domain should export it as part of its public surface instead.