upgrade to tamagui v2 and guest pwa overhaul

This commit is contained in:
Codex Agent
2026-02-02 13:01:20 +01:00
parent 2e78f3ab8d
commit 7c6e14ffe2
168 changed files with 47462 additions and 8914 deletions

View File

@@ -0,0 +1,40 @@
import { getDeviceId } from '../lib/device';
import { fetchJson } from './apiClient';
import type { EventStats } from './eventApi';
const statsCache = new Map<string, { etag: string | null; data: EventStats }>();
export async function fetchEventStats(eventToken: string): Promise<EventStats> {
const cached = statsCache.get(eventToken);
const response = await fetchJson<{ online_guests?: number; tasks_solved?: number; latest_photo_at?: string | null }>(
`/api/v1/events/${encodeURIComponent(eventToken)}/stats`,
{
headers: {
'X-Device-Id': getDeviceId(),
},
etag: cached?.etag ?? null,
noStore: true,
}
);
if (response.notModified && cached) {
return cached.data;
}
const stats: EventStats = {
onlineGuests: response.data?.online_guests ?? 0,
tasksSolved: response.data?.tasks_solved ?? 0,
latestPhotoAt: response.data?.latest_photo_at ?? null,
};
statsCache.set(eventToken, { etag: response.etag, data: stats });
return stats;
}
export function clearStatsCache(eventToken?: string) {
if (eventToken) {
statsCache.delete(eventToken);
return;
}
statsCache.clear();
}