Redesign Phases 3-6: multi-event model, APPE Admin, Convivo App behaviors, APPE branding

- Phase 3: new migration 20260824000000_redesign.sql (contacts/events/registrations/sponsors, slot types, session speakers + feedback/material), seed rewrite
- Phase 4: APPE Admin rebrand + Contacts/Registrations/Sponsors/Schedule/Activity/Events views
- Phase 5: Convivo App (24h login, 5s polling, QR type badge, red dot, speaker material)
- Phase 6: APPE favicon + PWA icons for both apps
- Docs: schema/rpcs/rls/seed/screens/api-client/admin-app/architecture/next-steps/README/roadmap updated

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
committed 2026-08-23 02:53:16 +02:00
1 parent 2f53d47578
commit 7605c9bbf4
64 files changed
+4593 -1371

No files matched your search

+28 -20
View File
@@ -1,14 +1,16 @@
import { createContext, useCallback, useContext, useEffect, useMemo, useState, type ReactNode } from 'react';
import type { Session as SbSession, User } from '@supabase/supabase-js';
import { supabase } from '../lib/supabase';
import type { Profile } from '../lib/types';
import { getMyContact, getMyRegistration } from '../lib/api';
import type { Contact, Registration } from '../lib/types';
interface AuthContextValue {
session: SbSession | null;
user: User | null;
profile: Profile | null;
contact: Contact | null;
registration: Registration | null;
loading: boolean;
refreshProfile: () => Promise<void>;
refresh: () => Promise<void>;
signOut: () => Promise<void>;
}
@@ -16,16 +18,18 @@ const AuthContext = createContext<AuthContextValue | null>(null);
export function AuthProvider({ children }: { children: ReactNode }) {
const [session, setSession] = useState<SbSession | null>(null);
const [profile, setProfile] = useState<Profile | null>(null);
const [contact, setContact] = useState<Contact | null>(null);
const [registration, setRegistration] = useState<Registration | null>(null);
const [loading, setLoading] = useState(true);
const loadProfile = useCallback(async (userId: string) => {
const { data, error } = await supabase.from('profiles').select('*').eq('id', userId).maybeSingle();
if (error) {
console.error('Failed to load profile', error);
return;
const load = useCallback(async (email: string) => {
try {
const [c, r] = await Promise.all([getMyContact(email), getMyRegistration(email)]);
setContact(c);
setRegistration(r);
} catch (e) {
console.error('Failed to load contact', e);
}
setProfile((data as Profile) ?? null);
}, []);
useEffect(() => {
@@ -33,32 +37,36 @@ export function AuthProvider({ children }: { children: ReactNode }) {
supabase.auth.getSession().then(({ data }) => {
if (!active) return;
setSession(data.session);
if (data.session?.user) void loadProfile(data.session.user.id);
if (data.session?.user?.email) void load(data.session.user.email);
setLoading(false);
});
const { data: sub } = supabase.auth.onAuthStateChange((_event, newSession) => {
setSession(newSession);
if (newSession?.user) void loadProfile(newSession.user.id);
else setProfile(null);
if (newSession?.user?.email) void load(newSession.user.email);
else {
setContact(null);
setRegistration(null);
}
});
return () => {
active = false;
sub.subscription.unsubscribe();
};
}, [loadProfile]);
}, [load]);
const refreshProfile = useCallback(async () => {
if (session?.user) await loadProfile(session.user.id);
}, [session, loadProfile]);
const refresh = useCallback(async () => {
if (session?.user?.email) await load(session.user.email);
}, [session, load]);
const signOut = useCallback(async () => {
await supabase.auth.signOut();
setProfile(null);
setContact(null);
setRegistration(null);
}, []);
const value = useMemo<AuthContextValue>(
() => ({ session, user: session?.user ?? null, profile, loading, refreshProfile, signOut }),
[session, profile, loading, refreshProfile, signOut],
() => ({ session, user: session?.user ?? null, contact, registration, loading, refresh, signOut }),
[session, contact, registration, loading, refresh, signOut],
);
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;