feat: tabbed setup, user metadata, light theme, scoped shift history

Consolidate the config screens under a single /setup hub with permission-
gated tabs (Devices/Tariff/Subscriptions/Site/Users/Roles/Shifts), collapsing
the top nav to Booth·Shift·Setup; old top-level paths redirect.

Users: add optional profile metadata (full name, phone, email, address) on
create/edit. Theme: a light palette saved to the user's profile (users.theme),
toggled in the header beside the language switch and applied on load like the
language preference. Both ride on a single additive migration (0008).

Shift history: a new GET /api/shifts folds the signed shift_z_report chain into
completed shifts, SCOPED server-side — operators see only their own; holders of
shift:cash see all with an operator + date-range filter. Surfaced as the Shifts
tab; an operator cannot read another operator's takings (param spoofing is
ignored).

These three features share the router, api client and i18n catalogs, so they
land together. Verified live: theme persists across reload, metadata round-
trips to the DB, and shift scoping holds (operator self-only, admin all+filter).

Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
This commit is contained in:
2026-06-19 10:09:18 +02:00
parent 8444bf34c3
commit 040c0ff4ca
16 changed files with 1062 additions and 99 deletions
+10 -3
View File
@@ -5,6 +5,7 @@ import { fetchMe, type SessionUser } from "./api.js";
import { Login } from "./Login.js";
import { queryClient } from "./lib/query.js";
import { setLanguage } from "./lib/i18n/index.js";
import { applyTheme } from "./lib/theme.js";
import { router } from "./router.js";
// App root: bootstraps the session (cookie-based, from /api/auth/me), then hands
@@ -23,10 +24,16 @@ export function App() {
.finally(() => setLoading(false));
}, []);
// Apply the signed-in user's preferred language whenever it resolves/changes
// (login, bootstrap, or a toggle). Albanian is the default before auth resolves.
// Apply the signed-in user's preferred language + theme whenever they resolve/
// change (login, bootstrap, or a toggle). Albanian + dark are the defaults before
// auth resolves; on logout, fall back to dark so the Login screen is consistent.
useEffect(() => {
if (user) setLanguage(user.language);
if (user) {
setLanguage(user.language);
applyTheme(user.theme);
} else {
applyTheme("dark");
}
}, [user]);
if (loading) {