Phase 0 + 1: Dockerized Supabase core + attendee PWA
Phase 0 — Supabase core (Docker via CLI): - Schema: profiles, slots, sessions, preferences, connections, checkins, feedback, leaderboard (Realtime mirror), points_log - RLS on every table; transactional security-definer points RPCs - Seed: 6 slots, 18 sessions, 13 demo users (QR token as auth password) Phase 1 — Attendee web PWA (React + Vite + TS): - Login via QR token + email (GoTrue, no email sent) - Home, Agenda, Scan/Connect, staff Check-in, Feedback, live Leaderboard, Profile - Same-origin proxy to Supabase (Vite dev / nginx in Docker) - Docker: multi-stage build -> nginx sidecar on the Supabase network 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:
commit
63aa4ecfc8
45 files changed
+6922
No files matched your search
@@ -0,0 +1,94 @@
|
||||
import { useState } from 'react';
|
||||
import { AuthProvider, useAuth } from './context/AuthContext';
|
||||
import { ToastProvider } from './context/ToastContext';
|
||||
import { Login } from './screens/Login';
|
||||
import { Home } from './screens/Home';
|
||||
import { Agenda } from './screens/Agenda';
|
||||
import { Scan } from './screens/Scan';
|
||||
import { Connections } from './screens/Connections';
|
||||
import { Leaderboard } from './screens/Leaderboard';
|
||||
import { Profile } from './screens/Profile';
|
||||
import { Feedback } from './screens/Feedback';
|
||||
import { Spinner } from './components/ui';
|
||||
|
||||
type Tab = 'home' | 'agenda' | 'scan' | 'connections' | 'profile' | 'leaderboard';
|
||||
const TABS: { id: Tab; ico: string; label: string }[] = [
|
||||
{ id: 'home', ico: '🏠', label: 'Home' },
|
||||
{ id: 'agenda', ico: '📅', label: 'Agenda' },
|
||||
{ id: 'scan', ico: '📷', label: 'Scan' },
|
||||
{ id: 'connections', ico: '🤝', label: 'Connect' },
|
||||
{ id: 'profile', ico: '👤', label: 'Profile' },
|
||||
];
|
||||
|
||||
function Shell() {
|
||||
const { session, profile, loading } = useAuth();
|
||||
const [tab, setTab] = useState<Tab>('home');
|
||||
const [feedbackSession, setFeedbackSession] = useState<string | null>(null);
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="app">
|
||||
<div className="center" style={{ flex: 1 }}>
|
||||
<Spinner />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!session || !profile) {
|
||||
return (
|
||||
<div className="app">
|
||||
<Login />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Feedback is a full-screen takeover (no tab bar).
|
||||
if (feedbackSession) {
|
||||
return (
|
||||
<div className="app">
|
||||
<Feedback sessionId={feedbackSession} onDone={() => { setFeedbackSession(null); setTab('home'); }} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const scanLabel = profile.role === 'staff' || profile.role === 'admin' ? 'Check-in' : 'Scan';
|
||||
|
||||
return (
|
||||
<div className="app">
|
||||
{tab === 'home' && <Home go={(t) => setTab(t as Tab)} />}
|
||||
{tab === 'agenda' && <Agenda openFeedback={(id) => setFeedbackSession(id)} />}
|
||||
{tab === 'scan' && <Scan />}
|
||||
{tab === 'connections' && <Connections />}
|
||||
{tab === 'profile' && <Profile />}
|
||||
{tab === 'leaderboard' && <Leaderboard />}
|
||||
|
||||
<nav className="tabbar">
|
||||
{TABS.map((t) => (
|
||||
<button
|
||||
key={t.id}
|
||||
className={`tab ${t.id === 'scan' ? 'tab-scan' : ''} ${tab === t.id ? 'active' : ''}`}
|
||||
onClick={() => setTab(t.id)}
|
||||
>
|
||||
{t.id === 'scan' ? (
|
||||
<span className="scan-btn">📷</span>
|
||||
) : (
|
||||
<span className="ico">{t.ico}</span>
|
||||
)}
|
||||
<span>{t.id === 'scan' ? scanLabel : t.label}</span>
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<ToastProvider>
|
||||
<AuthProvider>
|
||||
<Shell />
|
||||
</AuthProvider>
|
||||
</ToastProvider>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user