Beute L3 Runden 2+3 und Review-Fixes: - Glas-Holo ohne warmes Leuchten, Wanderboden-Fuss, Fokusflug mit Geist-Ansicht, Inhalte im Fokus, Rähmchen mit Art-Farbe beim Anheben - Hinweis-Geometrie je Zarge nur einmal je Layout gebaut; Drehen mit Pointer-Capture, endet auch bei Loslassen ausserhalb (rig-pointer.ts) - Tiefenunschärfe ab 55 fps, Leistungsprobe bei jeder Bewegungsstufe, Context-Loss-Listener aufgeräumt, Trefferboxen als skalierte Einheitsbox Beute L4 Umbauen (/colonies/[id]/hive): Entwurf mit Basis-Schnappschuss beim ersten Schritt, Rückgängig/Wiederholen, Hinweis bei Serverstand- Änderung, Konfliktblatt. Beute L5: - Durchsicht-Abschnitt „Beute“: Aufbau-Änderungen in der Durchsicht, Blatt-Formulare stoppen das Submit-Bubbling durch Portale (sonst speicherte „Speichern“ im Blatt die ganze Durchsicht), Fokus nach Rückgängig, Folgevorschläge beim Speichern - Offline: Beute im Offline-Paket, Warteschlange pending-hive-changes (DB v5), Abarbeiten in Reihenfolge, keine Online-Änderung überholt wartende, Hinweis bei abgelehnter Änderung mit „Warteschlange öffnen“ T7 L1 Diktat: Spracherkennungs-Kapsel (Web Speech API), Einwilligung standardmässig aus, Diktat-Knopf an Freitextfeldern, Seite „Sprache & Datenschutz“; axe-core als exakte devDependency. Backend: NotificationsService liest Empfänger und schreibt in einer Transaktion mit FOR KEY SHARE (paralleles Löschen eines Benutzers führte zu P2003 und verzögerten Vorschlägen; Ursache der wackeligen Endtests). Zwei e2e-Prüfungen gegen geteilten DB-Zustand entschärft. Gates: Frontend lint, typecheck, 2740 Tests, build; Backend lint, typecheck, 4266 Unit-Tests, build; parallele e2e 3x grün (978). Browser-Prüfung 1280/390 px, Tastatur, offline, reduced motion. Refs #19 #20 #21 #22 #27 #32 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import type { StoredPack } from "@/lib/offline/db";
|
|
import type { HiveSetupView, HiveSystemDto } from "./types";
|
|
|
|
// What the offline packs say about hives (spec 10). Both fields are optional:
|
|
// a pack from before the hive card says nothing, and "nothing" is not "no hive".
|
|
|
|
function newestFirst(packs: readonly StoredPack[]): StoredPack[] {
|
|
return [...packs].sort((a, b) => b.savedAt.localeCompare(a.savedAt));
|
|
}
|
|
|
|
/**
|
|
* The colony's hive per its newest pack. `null`: no pack lists the colony or
|
|
* the pack predates hives, so it cannot tell. `{ setup: null }`: the pack
|
|
* knows the colony and the colony has no hive yet.
|
|
*/
|
|
export function hiveFromPacks(
|
|
packs: readonly StoredPack[],
|
|
colonyId: string,
|
|
): { setup: HiveSetupView | null } | null {
|
|
const holding = newestFirst(packs).find((stored) =>
|
|
stored.pack.colonies.some((colony) => colony.id === colonyId),
|
|
);
|
|
if (!holding?.pack.hives) return null;
|
|
return { setup: holding.pack.hives[colonyId] ?? null };
|
|
}
|
|
|
|
/** The hive systems of the newest pack that carries them; null when none does. */
|
|
export function hiveCatalogFromPacks(packs: readonly StoredPack[]): HiveSystemDto[] | null {
|
|
return newestFirst(packs).find((stored) => stored.pack.hiveCatalog)?.pack.hiveCatalog ?? null;
|
|
}
|