Closes #40. New /stats route (client/stats.html + src/stats/), served by the same catch-all pattern as /admin. Reuses the admin login (STATS_PUBLIC env var on the server side decides whether it needs one at all). Three uPlot charts (daily revenue, daily transaction count, top-5-drink sold-qty trend) plus the same three tables Admin.tsx used to render inline — those move here wholesale, Admin.tsx now just links to /stats instead of fetching /admin/api/stats itself. The 'Statistik zurücksetzen' reset button moves here too, gated on an actual admin session (checked separately from whether /api/stats itself succeeded, since STATS_PUBLIC can make that true for an anonymous viewer). Chart lib is uPlot (~45kb) per mara's steer not to hand-roll this. Both client and server build/typecheck clean; manually smoke-tested the auth gate (401 unauthed, 200 after login) and the /stats route against a fresh DB.
21 lines
689 B
HTML
21 lines
689 B
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>wutzcalc — Statistik</title>
|
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
<script>
|
|
// Set the theme before first paint to avoid a flash of the wrong colors.
|
|
document.documentElement.setAttribute(
|
|
'data-theme',
|
|
localStorage.getItem('wutz.theme') === 'light' ? 'light' : 'dark'
|
|
);
|
|
</script>
|
|
<link rel="stylesheet" href="/src/styles.css" />
|
|
</head>
|
|
<body>
|
|
<div id="app"></div>
|
|
<script type="module" src="/src/stats/main.tsx"></script>
|
|
</body>
|
|
</html>
|