created a demo mode for the guest pwa

This commit is contained in:
Codex Agent
2025-11-17 12:24:14 +01:00
parent 167734f87a
commit 2978b0ef15
11 changed files with 671 additions and 17 deletions

View File

@@ -0,0 +1,378 @@
import type { AchievementsPayload } from '../services/achievementApi';
import type { EventData, EventPackage, EventStats } from '../services/eventApi';
import type { GalleryMetaResponse, GalleryPhotoResource } from '../services/galleryApi';
export type DemoTask = {
id: number;
title: string;
description: string;
duration?: number;
emotion?: {
slug: string;
name: string;
emoji?: string;
} | null;
category?: string | null;
};
export type DemoPhoto = {
id: number;
url: string;
thumbnail_url: string;
created_at: string;
uploader_name: string;
likes_count: number;
task_id?: number | null;
task_title?: string | null;
ingest_source?: string | null;
};
export type DemoEmotion = {
id: number;
slug: string;
name: string;
emoji: string;
description?: string;
};
export type DemoNotification = {
id: number;
type: string;
title: string;
body: string;
status: 'new' | 'read' | 'dismissed';
created_at: string;
cta?: { label: string; href: string } | null;
};
export type DemoSharePayload = {
slug: string;
expires_at?: string;
photo: {
id: number;
title: string;
likes_count: number;
emotion?: { name: string; emoji: string } | null;
image_urls: { full: string; thumbnail: string };
};
event?: { id: number; name: string } | null;
};
export interface DemoFixtures {
token: string;
event: EventData;
stats: EventStats;
eventPackage: EventPackage;
tasks: DemoTask[];
photos: DemoPhoto[];
gallery: {
meta: GalleryMetaResponse;
photos: GalleryPhotoResource[];
};
achievements: AchievementsPayload;
emotions: DemoEmotion[];
notifications: DemoNotification[];
share: DemoSharePayload;
}
const now = () => new Date().toISOString();
export const demoFixtures: DemoFixtures = {
token: 'demo',
event: {
id: 999,
slug: 'demo-wedding-2025',
name: 'Demo Wedding 2025',
default_locale: 'de',
created_at: '2025-01-10T12:00:00Z',
updated_at: now(),
branding: {
primary_color: '#FF6B6B',
secondary_color: '#FEB47B',
background_color: '#FFF7F5',
font_family: '"General Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
logo_url: null,
},
join_token: 'demo',
type: {
slug: 'wedding',
name: 'Hochzeit',
icon: 'sparkles',
},
},
stats: {
onlineGuests: 42,
tasksSolved: 187,
latestPhotoAt: now(),
},
eventPackage: {
id: 501,
event_id: 999,
package_id: 301,
used_photos: 820,
used_guests: 95,
expires_at: '2025-12-31T23:59:59Z',
package: {
id: 301,
name: 'Soulmate Unlimited',
max_photos: 5000,
max_guests: 250,
gallery_days: 365,
},
limits: {
photos: {
limit: 5000,
used: 820,
remaining: 4180,
percentage: 0.164,
state: 'ok',
threshold_reached: null,
next_threshold: 0.5,
thresholds: [0.5, 0.8],
},
guests: {
limit: 250,
used: 95,
remaining: 155,
percentage: 0.38,
state: 'ok',
threshold_reached: null,
next_threshold: 0.6,
thresholds: [0.6, 0.9],
},
gallery: {
state: 'ok',
expires_at: '2025-12-31T23:59:59Z',
days_remaining: 320,
warning_thresholds: [30, 7],
warning_triggered: null,
warning_sent_at: null,
expired_notified_at: null,
},
can_upload_photos: true,
can_add_guests: true,
},
},
tasks: [
{
id: 101,
title: 'Der erste Blick',
description: 'Haltet den Moment fest, wenn sich das Paar zum ersten Mal sieht.',
duration: 4,
emotion: { slug: 'romance', name: 'Romantik', emoji: '💞' },
},
{
id: 102,
title: 'Dancefloor Close-Up',
description: 'Zoomt auf Hände, Schuhe oder Accessoires, die auf der Tanzfläche glänzen.',
duration: 3,
emotion: { slug: 'party', name: 'Party', emoji: '🎉' },
},
{
id: 103,
title: 'Tischgespräche',
description: 'Fotografiert zwei Personen, die heimlich lachen.',
duration: 2,
emotion: { slug: 'fun', name: 'Spaß', emoji: '😄' },
},
{
id: 104,
title: 'Team Selfie',
description: 'Mindestens fünf Gäste auf einem Selfie Bonus für wilde Posen.',
duration: 5,
emotion: { slug: 'squad', name: 'Squad Goals', emoji: '🤳' },
},
],
photos: [
{
id: 8801,
url: 'https://images.unsplash.com/photo-1520854223477-5e2c1a6610f0?auto=format&fit=crop&w=1600&q=80',
thumbnail_url: 'https://images.unsplash.com/photo-1520854223477-5e2c1a6610f0?auto=format&fit=crop&w=600&q=60',
created_at: '2025-05-10T18:45:00Z',
uploader_name: 'Lena',
likes_count: 24,
task_id: 101,
task_title: 'Der erste Blick',
ingest_source: 'guest',
},
{
id: 8802,
url: 'https://images.unsplash.com/photo-1502727135889-a63a201a02f9?auto=format&fit=crop&w=1600&q=80',
thumbnail_url: 'https://images.unsplash.com/photo-1502727135889-a63a201a02f9?auto=format&fit=crop&w=600&q=60',
created_at: '2025-05-10T19:12:00Z',
uploader_name: 'Nico',
likes_count: 31,
task_id: 102,
task_title: 'Dancefloor Close-Up',
ingest_source: 'guest',
},
{
id: 8803,
url: 'https://images.unsplash.com/photo-1524504388940-b1c1722653e1?auto=format&fit=crop&w=1600&q=80',
thumbnail_url: 'https://images.unsplash.com/photo-1524504388940-b1c1722653e1?auto=format&fit=crop&w=600&q=60',
created_at: '2025-05-10T19:40:00Z',
uploader_name: 'Aylin',
likes_count: 18,
task_id: 103,
task_title: 'Tischgespräche',
ingest_source: 'guest',
},
{
id: 8804,
url: 'https://images.unsplash.com/photo-1519741497674-611481863552?auto=format&fit=crop&w=1600&q=80',
thumbnail_url: 'https://images.unsplash.com/photo-1519741497674-611481863552?auto=format&fit=crop&w=600&q=60',
created_at: '2025-05-10T20:05:00Z',
uploader_name: 'Mara',
likes_count: 42,
task_id: 104,
task_title: 'Team Selfie',
ingest_source: 'guest',
},
],
gallery: {
meta: {
event: {
id: 999,
name: 'Demo Wedding 2025',
slug: 'demo-wedding-2025',
description: 'Erlebe die Story eines Demo-Events Fotos, Aufgaben und Emotionen live in der PWA.',
gallery_expires_at: '2025-12-31T23:59:59Z',
},
branding: {
primary_color: '#FF6B6B',
secondary_color: '#FEB47B',
background_color: '#FFF7F5',
},
},
photos: [
{
id: 9001,
thumbnail_url: 'https://images.unsplash.com/photo-1520854223477-5e2c1a6610f0?auto=format&fit=crop&w=400&q=60',
full_url: 'https://images.unsplash.com/photo-1520854223477-5e2c1a6610f0?auto=format&fit=crop&w=1600&q=80',
download_url: 'https://images.unsplash.com/photo-1520854223477-5e2c1a6610f0?auto=format&fit=crop&w=1600&q=80',
likes_count: 18,
guest_name: 'Leonie',
created_at: '2025-05-10T18:40:00Z',
},
{
id: 9002,
thumbnail_url: 'https://images.unsplash.com/photo-1502727135889-a63a201a02f9?auto=format&fit=crop&w=400&q=60',
full_url: 'https://images.unsplash.com/photo-1502727135889-a63a201a02f9?auto=format&fit=crop&w=1600&q=80',
download_url: 'https://images.unsplash.com/photo-1502727135889-a63a201a02f9?auto=format&fit=crop&w=1600&q=80',
likes_count: 25,
guest_name: 'Chris',
created_at: '2025-05-10T19:10:00Z',
},
],
},
achievements: {
summary: {
totalPhotos: 820,
uniqueGuests: 96,
tasksSolved: 312,
likesTotal: 2100,
},
personal: {
guestName: 'Demo Gast',
photos: 12,
tasks: 5,
likes: 38,
badges: [
{ id: 'starter', title: 'Warm-up', description: 'Deine ersten 3 Fotos', earned: true, progress: 3, target: 3 },
{ id: 'mission', title: 'Mission Master', description: '5 Aufgaben geschafft', earned: true, progress: 5, target: 5 },
{ id: 'marathon', title: 'Galerie-Profi', description: '50 Fotos hochladen', earned: false, progress: 12, target: 50 },
],
},
leaderboards: {
uploads: [
{ guest: 'Sven', photos: 35, likes: 120 },
{ guest: 'Lena', photos: 28, likes: 140 },
{ guest: 'Demo Gast', photos: 12, likes: 38 },
],
likes: [
{ guest: 'Mara', photos: 18, likes: 160 },
{ guest: 'Noah', photos: 22, likes: 150 },
{ guest: 'Sven', photos: 35, likes: 120 },
],
},
highlights: {
topPhoto: {
photoId: 8802,
guest: 'Nico',
likes: 31,
task: 'Dancefloor Close-Up',
createdAt: '2025-05-10T19:12:00Z',
thumbnail: 'https://images.unsplash.com/photo-1502727135889-a63a201a02f9?auto=format&fit=crop&w=600&q=60',
},
trendingEmotion: {
emotionId: 4,
name: 'Party',
count: 58,
},
timeline: [
{ date: '2025-05-08', photos: 120, guests: 25 },
{ date: '2025-05-09', photos: 240, guests: 40 },
{ date: '2025-05-10', photos: 460, guests: 55 },
],
},
feed: [
{
photoId: 8804,
guest: 'Mara',
task: 'Team Selfie',
likes: 42,
createdAt: '2025-05-10T20:05:00Z',
thumbnail: 'https://images.unsplash.com/photo-1519741497674-611481863552?auto=format&fit=crop&w=400&q=60',
},
{
photoId: 8803,
guest: 'Aylin',
task: 'Tischgespräche',
likes: 18,
createdAt: '2025-05-10T19:40:00Z',
thumbnail: 'https://images.unsplash.com/photo-1524504388940-b1c1722653e1?auto=format&fit=crop&w=400&q=60',
},
],
},
emotions: [
{ id: 1, slug: 'romance', name: 'Romantik', emoji: '💞', description: 'Samtweiche Szenen & verliebte Blicke' },
{ id: 2, slug: 'party', name: 'Party', emoji: '🎉', description: 'Alles, was knallt und funkelt' },
{ id: 3, slug: 'calm', name: 'Ruhepause', emoji: '🌙', description: 'Leise Momente zum Durchatmen' },
{ id: 4, slug: 'squad', name: 'Squad Goals', emoji: '🤳', description: 'Teams, Crews und wilde Selfies' },
],
notifications: [
{
id: 1,
type: 'broadcast',
title: 'Mission-Alarm',
body: 'Neue Spotlight-Aufgabe verfügbar: „Dancefloor Close-Up“. Schau gleich vorbei!'
+ ' ',
status: 'new',
created_at: now(),
cta: { label: 'Zur Aufgabe', href: '/e/demo/tasks' },
},
{
id: 2,
type: 'broadcast',
title: 'Galerie wächst',
body: '18 neue Uploads in den letzten 30 Minuten helft mit beim Kuratieren!',
status: 'read',
created_at: '2025-05-10T19:50:00Z',
},
],
share: {
slug: 'demo-share',
expires_at: null,
photo: {
id: 8801,
title: 'First Look',
likes_count: 24,
emotion: { name: 'Romantik', emoji: '💞' },
image_urls: {
full: 'https://images.unsplash.com/photo-1520854223477-5e2c1a6610f0?auto=format&fit=crop&w=1600&q=80',
thumbnail: 'https://images.unsplash.com/photo-1520854223477-5e2c1a6610f0?auto=format&fit=crop&w=600&q=60',
},
},
event: { id: 999, name: 'Demo Wedding 2025' },
},
};