feat: update slot types and enhance TypeBadge display

This commit is contained in:
Lago committed 2026-08-24 20:55:29 +02:00
1 parent f7aea663d8
commit 2db22984fc
4 files changed
+16 -10

No files matched your search

+3 -1
View File
@@ -81,7 +81,9 @@ export function QrImage({ value, size = 180 }: { value: string; size?: number })
/** Small colored badge for a registration / sponsor type. */ /** Small colored badge for a registration / sponsor type. */
export function TypeBadge({ type }: { type: string }) { export function TypeBadge({ type }: { type: string }) {
return <span className={`pill ${type}`}>{type.replace(/_/g, ' ')}</span>; // "service_session" -> "Service Session" (capitalize each word).
const label = type.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
return <span className={`pill ${type}`}>{label}</span>;
} }
/** A small on/off toggle switch. */ /** A small on/off toggle switch. */
+1 -1
View File
@@ -1,6 +1,6 @@
export type RegistrationType = 'attendee' | 'speaker' | 'staff' | 'sponsor'; export type RegistrationType = 'attendee' | 'speaker' | 'staff' | 'sponsor';
export type SlotType = 'session' | 'lunch_break' | 'coffee_break' | 'keynote' | 'close_up'; export type SlotType = 'session' | 'service_session';
/** The signed-in contact (own row, readable via RLS). */ /** The signed-in contact (own row, readable via RLS). */
export interface Contact { export interface Contact {
+10 -3
View File
@@ -11,7 +11,7 @@ import {
setPreference, setPreference,
uploadSessionMaterial, uploadSessionMaterial,
} from '../lib/api'; } from '../lib/api';
import { fmtRange, slotStatus } from '../lib/time'; import { capWords, fmtRange, slotStatus } from '../lib/time';
import type { Preference, Session } from '../lib/types'; import type { Preference, Session } from '../lib/types';
import { Sheet, Spinner } from '../components/ui'; import { Sheet, Spinner } from '../components/ui';
import { useToast } from '../context/ToastContext'; import { useToast } from '../context/ToastContext';
@@ -149,7 +149,7 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
<div className="slot-head"> <div className="slot-head">
<div className="grow"> <div className="grow">
<div className="name"> <div className="name">
{slot.name} <span className={`pill slot-type-${slot.type}`}>{slot.type.replace('_', ' ')}</span> {slot.name} <span className={`pill slot-type-${slot.type}`}>{capWords(slot.type)}</span>
</div> </div>
<div className="time">{fmtRange(slot)}</div> <div className="time">{fmtRange(slot)}</div>
</div> </div>
@@ -160,6 +160,7 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
{sessions.map((s) => { {sessions.map((s) => {
const picked = pickFor(slot.id) === s.id; const picked = pickFor(slot.id) === s.id;
const isMySession = mySpeakerSessions.includes(s.id); const isMySession = mySpeakerSessions.includes(s.id);
const isService = slot.type === 'service_session';
return ( return (
<button key={s.id} className={`sess ${picked ? 'picked' : ''}`} onClick={() => setSelected(s)}> <button key={s.id} className={`sess ${picked ? 'picked' : ''}`} onClick={() => setSelected(s)}>
<div className="grow"> <div className="grow">
@@ -172,7 +173,7 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
{s.material_path && <span style={{ marginLeft: 6 }}>📎</span>} {s.material_path && <span style={{ marginLeft: 6 }}>📎</span>}
</div> </div>
</div> </div>
<span className="check">✓</span> {!isService && <span className="check">✓</span>}
</button> </button>
); );
})} })}
@@ -224,12 +225,18 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
You weren’t checked in to this session. You weren’t checked in to this session.
</div> </div>
)} )}
{selSlot.type === 'service_session' ? (
<div className="muted small" style={{ textAlign: 'center' }}>
No pick needed for this slot.
</div>
) : (
<button <button
className={`btn ${pickFor(selected.slot_id) === selected.id ? 'danger' : 'primary'}`} className={`btn ${pickFor(selected.slot_id) === selected.id ? 'danger' : 'primary'}`}
onClick={() => togglePick(selected.slot_id, selected.id)} onClick={() => togglePick(selected.slot_id, selected.id)}
> >
{pickFor(selected.slot_id) === selected.id ? 'Remove my pick' : 'Pick this session'} {pickFor(selected.slot_id) === selected.id ? 'Remove my pick' : 'Pick this session'}
</button> </button>
)}
{/* Material download (all attendees) — pinned to the bottom. */} {/* Material download (all attendees) — pinned to the bottom. */}
{selected.material_path && ( {selected.material_path && (
<a className="btn primary" href={sessionMaterialUrl(selected.material_path)} target="_blank" rel="noreferrer"> <a className="btn primary" href={sessionMaterialUrl(selected.material_path)} target="_blank" rel="noreferrer">
+2 -5
View File
@@ -61,12 +61,9 @@ body {
.pill.reg-speaker { background: rgba(124,58,237,.12); border-color: rgba(124,58,237,.4); color: #6d28d9; } .pill.reg-speaker { background: rgba(124,58,237,.12); border-color: rgba(124,58,237,.4); color: #6d28d9; }
.pill.reg-staff { background: rgba(220,38,38,.12); border-color: rgba(220,38,38,.4); color: #b91c1c; } .pill.reg-staff { background: rgba(220,38,38,.12); border-color: rgba(220,38,38,.4); color: #b91c1c; }
.pill.reg-sponsor { background: rgba(234,88,12,.13); border-color: rgba(234,88,12,.4); color: #c2410c; } .pill.reg-sponsor { background: rgba(234,88,12,.13); border-color: rgba(234,88,12,.4); color: #c2410c; }
/* slot types */ /* slot types (slot_type enum: session | service_session) */
.pill.slot-type-session { background: rgba(14,165,233,.12); border-color: rgba(14,165,233,.4); color: #0369a1; } .pill.slot-type-session { background: rgba(14,165,233,.12); border-color: rgba(14,165,233,.4); color: #0369a1; }
.pill.slot-type-lunch_break { background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.4); color: #b45309; } .pill.slot-type-service_session { background: rgba(120,113,108,.14); border-color: rgba(120,113,108,.4); color: #57534e; }
.pill.slot-type-coffee_break { background: rgba(120,113,108,.14); border-color: rgba(120,113,108,.4); color: #57534e; }
.pill.slot-type-keynote { background: var(--accent-soft); border-color: rgba(213,0,0,.35); color: var(--accent); }
.pill.slot-type-close_up { background: rgba(5,150,105,.12); border-color: rgba(5,150,105,.35); color: var(--green); }
.pill.speaker-tag { background: rgba(124,58,237,.12); border-color: rgba(124,58,237,.4); color: #6d28d9; padding: 2px 8px; font-size: 11px; } .pill.speaker-tag { background: rgba(124,58,237,.12); border-color: rgba(124,58,237,.4); color: #6d28d9; padding: 2px 8px; font-size: 11px; }
/* pending-connection red dot on the Connect tab */ /* pending-connection red dot on the Connect tab */
.tab .ico { position: relative; display: inline-flex; } .tab .ico { position: relative; display: inline-flex; }