Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 109 additions & 7 deletions bun.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"**/node_modules",
"web/workers/competition-api/test",
"web/workers/auth-api/src",
"web/workers/auth-api/test",
"web/workers/mcp-api/src",
"web/workers/mcp-api/test"
]
Expand Down
17 changes: 17 additions & 0 deletions web/db/migrations/0007_user_preferences.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- Per-user app preferences and custom theme. Replaces the
-- `glidecomp:preferences` and `glidecomp:theme` localStorage keys for
-- authenticated users so settings sync across devices.
--
-- One row per user. Both blobs are opaque JSON owned by the client; the
-- server only enforces size limits and treats them as strings.
--
-- theme_json is nullable so "reset to default" is a clean NULL rather than
-- a sentinel value. CASCADE on user delete piggybacks on the existing
-- account-deletion flow — no extra cleanup code needed.

CREATE TABLE "user_preferences" (
"user_id" TEXT PRIMARY KEY NOT NULL REFERENCES "user"("id") ON DELETE CASCADE,
"prefs_json" TEXT NOT NULL DEFAULT '{}',
"theme_json" TEXT,
"updated_at" TEXT NOT NULL DEFAULT (datetime('now'))
);
5 changes: 4 additions & 1 deletion web/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@
"build": "vite build",
"preview": "vite preview",
"deploy": "vite build && wrangler pages deploy dist --project-name=glidecomp",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"test": "vitest run"
},
"//": "Basecoat fork - see docs/basecoat-fork.md for build/publish instructions",
"devDependencies": {
"@cloudflare/workers-types": "^4.20260509.1",
"@tailwindcss/vite": "^4.3.0",
"@pokle/basecoat": "0.3.10-beta3.pokle-selections",
"jsdom": "^25.0.1",
"tailwindcss": "^4.3.0",
"typescript": "^6.0.3",
"vite": "^7.3.3",
"vitest": "^4.1.5",
"wrangler": "4.87.0"
},
"dependencies": {
Expand Down
8 changes: 7 additions & 1 deletion web/frontend/src/analysis/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/**
* Configuration storage abstraction.
* Currently backed by localStorage, designed for future migration to backend API.
*
* localStorage is the synchronous read cache; cloud sync (when signed in)
* is layered on top via auth/preferences-sync, which observes mutations
* through schedulePush() and reconciles on startup via clearCache().
*/

import { resolveThresholds, DEFAULT_GAP_PARAMETERS, type DetectionThresholds, type PartialThresholds, type GAPParameters } from '@glidecomp/engine';
import { preferencesSync } from '../auth/preferences-sync';

export interface MapLocation {
center: [lng: number, lat: number];
Expand Down Expand Up @@ -98,6 +102,8 @@ class ConfigStore {
detail: merged,
})
);

preferencesSync.schedulePush('prefs');
}

/**
Expand Down
Loading
Loading