feat(frontend): UX review followups — primitives + a11y/UX fixes across 4 passes

New shared primitives:
- Toaster + toast-store, ConfirmSheet, Modal, focusTrap action,
  pullToRefresh action, avatarPalette + initials helper, Skeleton,
  HeartBurst, haptics, export-status store with onClearAuth hook

Critical UX/a11y:
- Replaced window.confirm with branded ConfirmSheet
- Focus management + Escape on every modal (PIN, Lightbox,
  Onboarding, ContextSheet, data-mode sheet, leave-confirm,
  HTML guide, host/admin ban + PIN-display modals)
- Sheet backdrops are real buttons with aria-label
- Silent ApiError catches now surface via global Toaster

Major polish:
- Dark-mode parity on HashtagChips + avatars (shared palette)
- Conditional Export tab in BottomNav (badge dot when ZIP ready)
- Back chevrons on /recover (history-aware) and /export
- Upload composer discard confirmation when content is staged
- Camera segmented Photo/Video shutter
- PIN auto-submit on 4th digit, paste-flash-free (controlled input)
- Welcome-back toast on /feed after PIN recovery

Minor:
- Skeleton states on feed; pull-to-refresh with live drag indicator
- Haptics on like / capture / submit / PIN-copy / onboarding complete
- Comment 500-char counter; quota "Fast voll" / "Limit erreicht" labels
- Onboarding pip ≥24px tap targets; long-press hint step
- overscroll-behavior lock on <html> while feed mounted
- teardownExportStatus wired via onClearAuth (covers 401 + explicit logout)
- ConfirmSheet per-instance titleId; Modal requires titleId or ariaLabel

Tests (7 new Playwright specs):
- 01-auth/pin-auto-submit, 01-auth/back-chevron
- 03-feed/confirm-sheet-delete, 03-feed/toast-on-failure
- 09-mobile/focus-trap, 09-mobile/sheet-escape,
  09-mobile/upload-cancel-confirm

FOLLOWUPS.md captures the deferred AT inert containment work
with acceptance criteria + implementation sketches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-05-24 22:50:28 +02:00
parent b241ba6415
commit 309c25bc06
36 changed files with 1751 additions and 433 deletions

View File

@@ -0,0 +1,40 @@
import { writable } from 'svelte/store';
import { ApiError } from './api';
export type ToastTone = 'info' | 'success' | 'warning' | 'error';
export interface Toast {
id: number;
message: string;
tone: ToastTone;
ttl: number;
}
let nextId = 0;
const timers = new Map<number, ReturnType<typeof setTimeout>>();
export const toasts = writable<Toast[]>([]);
export function toast(message: string, tone: ToastTone = 'info', ttl = 4000): number {
const id = ++nextId;
const entry: Toast = { id, message, tone, ttl };
toasts.update((list) => [...list, entry]);
if (ttl > 0 && typeof window !== 'undefined') {
timers.set(id, setTimeout(() => dismissToast(id), ttl));
}
return id;
}
export function dismissToast(id: number): void {
const t = timers.get(id);
if (t) { clearTimeout(t); timers.delete(id); }
toasts.update((list) => list.filter((x) => x.id !== id));
}
// User-action error surface. Pulls the German message off ApiError; for
// anything else, falls back to a generic line so the user sees *something*.
export function toastError(err: unknown, fallback = 'Etwas ist schiefgelaufen.'): number {
if (err instanceof ApiError) return toast(err.message || fallback, 'error', 5000);
if (err instanceof Error && err.message) return toast(err.message, 'error', 5000);
return toast(fallback, 'error', 5000);
}