fixed like action, better dark mode, bottom navigation working, added taskcollection

This commit is contained in:
2025-09-13 00:43:53 +02:00
parent fc1e64fea3
commit 216ee063ff
24 changed files with 2070 additions and 208 deletions

View File

@@ -0,0 +1,42 @@
import { getDeviceId } from '../lib/device';
export interface EventData {
id: number;
slug: string;
name: string;
default_locale: string;
created_at: string;
updated_at: string;
type?: {
slug: string;
name: string;
icon: string;
};
}
export interface EventStats {
onlineGuests: number;
tasksSolved: number;
latestPhotoAt: string | null;
}
export async function fetchEvent(slug: string): Promise<EventData> {
const res = await fetch(`/api/v1/events/${slug}`);
if (!res.ok) throw new Error('Event fetch failed');
return await res.json();
}
export async function fetchStats(slug: string): Promise<EventStats> {
const res = await fetch(`/api/v1/events/${slug}/stats`, {
headers: {
'X-Device-Id': getDeviceId(),
},
});
if (!res.ok) throw new Error('Stats fetch failed');
const json = await res.json();
return {
onlineGuests: json.onlineGuests ?? 0,
tasksSolved: json.tasksSolved ?? 0,
latestPhotoAt: json.latestPhotoAt ?? null,
};
}