refactor: clean architecture and remove unused code

This commit is contained in:
Tom Boullay
2026-04-30 13:33:28 +02:00
parent b1187b68ae
commit cfb1eaf39a
30 changed files with 303 additions and 696 deletions
+6 -1
View File
@@ -9,6 +9,10 @@ interface StoredDebugControls {
sceneMode: SceneMode;
}
function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null;
}
function isCameraMode(value: unknown): value is CameraMode {
return value === "player" || value === "debug";
}
@@ -22,7 +26,8 @@ function getStoredDebugControls(): Partial<StoredDebugControls> {
const rawValue = window.localStorage.getItem(DEBUG_CONTROLS_STORAGE_KEY);
if (!rawValue) return {};
const parsedValue = JSON.parse(rawValue) as Partial<StoredDebugControls>;
const parsedValue: unknown = JSON.parse(rawValue);
if (!isRecord(parsedValue)) return {};
return {
...(isCameraMode(parsedValue.cameraMode)