Phase 2: Admin console (admin.appe.at)

A desktop-first React app for organizers, guarded to the admin role.

Backend (supabase/migrations/20260823000000_admin_app.sql):
- Admin-only SELECT policies on preferences, connections, feedback
- reset_qr_token RPC: regenerates a lanyard token, re-hashes it as the
  Auth password (old token stops working), and clears the attendee's
  sessions to force re-login

App (apps/admin, port 3001):
- Login: same QR+email flow, but non-admin sessions are rejected
- Dashboard: live stats + top points + recent activity
- Attendees: search, edit name/company/role, reset QR, adjust points
- Schedule: manage slots + sessions (create/edit/delete)
- Activity: check-ins / connections / feedback tables
- Same-origin proxy (Vite dev / nginx in Docker), same design tokens

Docker + scripts:
- convivo-admin service in docker-compose.yml (:3001)
- admin:dev / admin:build root scripts
- fixed db:reset script (supabase reset -> supabase db reset)

Docs: new frontend/admin-app.md; updated architecture, rls, rpcs,
docker, next-steps, and READMEs.

Verified: build clean, all views + flows browser-tested, Docker build +
proxy + login + admin guard confirmed. DB reset to clean seed.

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-22 19:47:22 +02:00
1 parent 015c0a3a06
commit 32c86767ef
45 files changed
+4425 -87

No files matched your search

+85
View File
@@ -0,0 +1,85 @@
import { type ReactNode } from 'react';
import { QRCodeSVG } from 'qrcode.react';
const AV_COLORS = ['#d50000', '#20b2aa', '#e11d48', '#0d9488', '#f59e0b', '#0ea5e9', '#dc2626', '#7c3aed', '#16a34a', '#ea580c', '#0891b2', '#db2777'];
export function initials(name: string): string {
return name
.split(' ')
.map((w) => w[0])
.slice(0, 2)
.join('')
.toUpperCase();
}
export function avColor(seed: string): string {
let h = 0;
for (const c of seed) h = (h * 31 + c.charCodeAt(0)) >>> 0;
return AV_COLORS[h % AV_COLORS.length];
}
export function Avatar({ name, id, size = 40, fs = 14 }: { name: string; id: string; size?: number; fs?: number }) {
return (
<span className="avatar" style={{ width: size, height: size, fontSize: fs, background: avColor(id) }}>
{initials(name)}
</span>
);
}
export function Spinner() {
return <span className="spinner" />;
}
export function Empty({ icon, text }: { icon: string; text: string }) {
return (
<div className="empty">
<div className="big">{icon}</div>
{text}
</div>
);
}
/** Centered modal dialog (desktop-first). */
export function Modal({
open,
onClose,
title,
children,
footer,
}: {
open: boolean;
onClose: () => void;
title: string;
children: ReactNode;
footer?: ReactNode;
}) {
if (!open) return null;
return (
<div className="backdrop" onClick={(e) => e.target === e.currentTarget && onClose()}>
<div className="modal" role="dialog" aria-modal="true" aria-label={title}>
<div className="modal-head">
<h3>{title}</h3>
<button className="icon-btn" onClick={onClose} aria-label="Close">
✕
</button>
</div>
<div className="modal-body">{children}</div>
{footer && <div className="modal-foot">{footer}</div>}
</div>
</div>
);
}
/** Render a string (e.g. a QR token) as a scannable QR code. */
export function QrImage({ value, size = 180 }: { value: string; size?: number }) {
return (
<div className="qr-frame">
<QRCodeSVG value={value} size={size} level="M" marginSize={0} />
</div>
);
}
/** Small colored badge for a role. */
export function RoleBadge({ role }: { role: string }) {
return <span className={`pill pill-${role}`}>{role}</span>;
}