Staff exclusions + contact-password auth sync

- contacts.password now auto-syncs to auth.users.encrypted_password via
  trg_contact_password_sync, so setting a password on the contact row in the
  Supabase UI makes it work with signInWithPassword immediately (fixes staff
  like Bruno not being able to log in with a UI-set password). One-time
  reconciliation in the migration.
- Staff excluded from the leaderboard: _sync_leaderboard skips/removes staff
  rows, get_leaderboard() filters type='staff', seed no longer inserts staff.
  Affects the attendee Leaderboard and the admin Dashboard 'Top points'.
- Home/Agenda/Profile identical for all roles: Home quick-action always
  'Scan & connect' (no 'Check-in' relabel), footer role badge removed, tab
  label always 'Scan' (staff keep check-in via the Scan screen mode toggle).
- Profile: removed the duplicate Staff pill (type pill already shows Staff).
- Agenda session sheet: 'Download material' moved to the bottom of the button
  stack with spacing.
- Docs updated (schema, rpcs, seed, screens, architecture, next-steps).

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 18:27:01 +02:00
1 parent 0221b1a8c0
commit 5886de9d19
12 files changed
+203 -45

No files matched your search

+3 -1
View File
@@ -80,7 +80,9 @@ function Shell() {
);
}
const scanLabel = contact.is_admin ? 'Check-in' : 'Scan';
// The home page (incl. the tab bar) is identical for every role. Staff keep
// their check-in capability inside the Scan screen (Attendee/Staff toggle).
const scanLabel = 'Scan';
return (
<div className="app">
+6 -7
View File
@@ -199,13 +199,6 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
</div>
)}
{/* Material download (all attendees). */}
{selected.material_path && (
<a className="btn primary" href={sessionMaterialUrl(selected.material_path)} target="_blank" rel="noreferrer">
📎 Download material
</a>
)}
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
{selStatus === 'done' && selCheckedIn && (
<button className="btn primary" onClick={() => openFeedback(selected.id)}>
@@ -223,6 +216,12 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
>
{pickFor(selected.slot_id) === selected.id ? 'Remove my pick' : 'Pick this session'}
</button>
{/* Material download (all attendees) — pinned to the bottom. */}
{selected.material_path && (
<a className="btn primary" href={sessionMaterialUrl(selected.material_path)} target="_blank" rel="noreferrer">
📎 Download material
</a>
)}
</div>
</>
)}
+3 -9
View File
@@ -2,9 +2,9 @@ import { useEffect, useState } from 'react';
import { useAuth } from '../context/AuthContext';
import { useEvent } from '../lib/useEvent';
import { getMyCheckins, getMyPreferences } from '../lib/api';
import { capWords, fmtRange, greeting, slotStatus } from '../lib/time';
import { fmtRange, greeting, slotStatus } from '../lib/time';
import type { Preference } from '../lib/types';
import { Avatar, Empty, Spinner } from '../components/ui';
import { Empty, Spinner } from '../components/ui';
export function Home({ go }: { go: (tab: string) => void }) {
const { contact, registration } = useAuth();
@@ -53,7 +53,6 @@ export function Home({ go }: { go: (tab: string) => void }) {
}
const points = registration?.points ?? 0;
const isStaff = contact.is_admin;
const pickFor = (slotId: number) => prefs.find((p) => p.slot_id === slotId)?.session_id;
const current = slots.find(({ slot }) => slotStatus(slot, now) === 'now');
const next = slots.find(({ slot }) => slotStatus(slot, now) === 'next');
@@ -130,7 +129,7 @@ export function Home({ go }: { go: (tab: string) => void }) {
<div className="qa-grid">
<div className="qa" onClick={() => go('scan')}>
<span className="ico">📷</span>
<span className="lbl">{isStaff ? 'Check-in' : 'Scan & connect'}</span>
<span className="lbl">Scan & connect</span>
</div>
<div className="qa" onClick={() => go('agenda')}>
<span className="ico">📅</span>
@@ -146,11 +145,6 @@ export function Home({ go }: { go: (tab: string) => void }) {
</div>
</div>
<div style={{ height: 8 }} />
{registration && registration.type !== 'attendee' && (
<div className="muted small" style={{ textAlign: 'center', opacity: 0.5 }}>
<Avatar name={contact.full_name} id={contact.email} size={22} fs={9} /> {capWords(registration.type)}
</div>
)}
</section>
);
}
+1 -1
View File
@@ -76,7 +76,7 @@ export function Profile() {
<div className="muted small">{contact.email}</div>
<div className="row" style={{ justifyContent: 'center', marginTop: 10, gap: 8 }}>
{registration && <span className={`pill reg-${registration.type}`}>{capWords(registration.type)}</span>}
{contact.is_admin && <span className="pill admin">staff</span>}
{contact.is_admin && registration?.type !== 'staff' && <span className="pill admin">staff</span>}
<span className="pill amber">⚡ {points} pts</span>
</div>
</div>