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:
45 files changed
+6922

No files matched your search

+91
View File
@@ -0,0 +1,91 @@
import { useEffect, useState } from 'react';
import { useAuth } from '../context/AuthContext';
import { getMyPointsLog } from '../lib/api';
import type { PointsLogRow } from '../lib/types';
import { Avatar, QrImage, Spinner } from '../components/ui';
const CATEGORY_LABEL: Record<PointsLogRow['category'], string> = {
checkin: 'Session check-ins',
connection: 'Connections',
feedback: 'Feedback',
admin: 'Other',
};
export function Profile() {
const { profile, signOut } = useAuth();
const [log, setLog] = useState<PointsLogRow[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
let active = true;
(async () => {
try {
const data = await getMyPointsLog();
if (active) setLog(data);
} catch {
/* non-fatal */
} finally {
if (active) setLoading(false);
}
})();
return () => {
active = false;
};
}, []);
if (!profile) return null;
const totals: Record<string, number> = {};
for (const l of log) totals[l.category] = (totals[l.category] ?? 0) + l.delta;
return (
<section className="screen">
<div className="h1">Profile</div>
<div className="card" style={{ textAlign: 'center' }}>
<Avatar name={profile.full_name} id={profile.id} size={72} fs={26} />
<div className="h2" style={{ marginTop: 10 }}>{profile.full_name}</div>
<div className="muted small">{profile.company ?? ''}</div>
<div className="row" style={{ justifyContent: 'center', marginTop: 10, gap: 8 }}>
<span className="pill violet">{profile.role}</span>
<span className="pill amber">⚡ {profile.points} pts</span>
</div>
</div>
<div className="card qr-wrap">
<div className="h2">My QR code</div>
{profile.qr_token ? (
<QrImage value={profile.qr_token} size={180} />
) : (
<div className="muted small">No QR token assigned.</div>
)}
<div className="muted small" style={{ textAlign: 'center' }}>
Show this to <b>staff</b> for session check-in<br />and to <b>peers</b> to make a connection.
</div>
</div>
<div className="card">
<div className="h2" style={{ marginBottom: 6 }}>Points breakdown</div>
{loading ? (
<div className="center" style={{ padding: 12 }}>
<Spinner />
</div>
) : (
<>
{Object.entries(totals).map(([cat, val]) => (
<div className="break-row" key={cat}>
<span>{CATEGORY_LABEL[cat as PointsLogRow['category']] ?? cat}</span>
<span className="v">+{val}</span>
</div>
))}
<div className="break-row">
<span style={{ fontWeight: 700 }}>Total</span>
<span className="v">{profile.points}</span>
</div>
</>
)}
</div>
<button className="btn danger" onClick={() => void signOut()}>Log out</button>
</section>
);
}