Service sessions + Home redesign + feedback loop
Service sessions (new slot semantics): - Sidecar maps isServiceSession OR isPlenumSession -> service_session (Excel path also matches 'plenum' in Session Format). - checkin_attendee rejects service sessions; Scan check-in dropdown excludes them. - New _assign_service_session_speakers helper links every registered staff member as a speaker of a service session; both sync RPCs call it (and the API sync now actually types slots from is_service_session). - No material requirement + no mic emoji for service sessions. Home redesign: - Now/Next cards show all concurrent sessions as sub-sections when there's no pick (1/2/3 sessions -> 1/2/3 sub-sections), with a "Nothing scheduled" fallback for empty slots. - My picks today lists every pick (slot order) + empty state. - Demo clock EVENT_DATE fixed to 2026-02-20 (matches seed) so a slot is live at 10:20. Feedback loop: - Attendee pending-feedback pill on Home (checked into an over session, not its speaker, no feedback yet); clears on submit. - Speaker sees rating + AI summary for their own session in the Agenda sheet only after it's over. Migration 20260833000000_service_sessions_feedback.sql. Docs updated. 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:
1 parent
fad978e9f4
commit
bd67debeef
15 files changed
+878
-105
No files matched your search
@@ -65,6 +65,7 @@ export function groupAgenda(rows: AgendaRow[]): { slot: Slot; sessions: Session[
|
||||
id: r.session_id,
|
||||
event_id: '',
|
||||
slot_id: r.slot_id,
|
||||
slot_type: r.slot_type,
|
||||
title: r.title,
|
||||
description: r.description,
|
||||
room: r.room,
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import type { Slot } from './types';
|
||||
|
||||
/** The event day (from the seed). All slot times are on this date. */
|
||||
export const EVENT_DATE = '2026-10-23';
|
||||
export const EVENT_DATE = '2026-02-20';
|
||||
|
||||
/** Simulated "now" used for the demo (matches the mockup: 10:20 on event day). */
|
||||
/** Simulated "now" used for the demo (10:20 on event day → Slot 2 is live,
|
||||
* Slot 3 is next). Matches the mockup's "Good morning" greeting. */
|
||||
export const DEFAULT_NOW = new Date(`${EVENT_DATE}T10:20:00`);
|
||||
|
||||
export type SlotStatus = 'done' | 'now' | 'next';
|
||||
|
||||
@@ -55,6 +55,8 @@ export interface Session {
|
||||
id: string;
|
||||
event_id: string;
|
||||
slot_id: number;
|
||||
/** The slot's type ('session' | 'service_session') — carried for convenience. */
|
||||
slot_type: SlotType;
|
||||
title: string;
|
||||
description: string | null;
|
||||
room: string | null;
|
||||
|
||||
@@ -97,7 +97,10 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
const selStatus = selSlot ? slotStatus(selSlot, now) : 'next';
|
||||
const selCheckedIn = selected ? checkins.includes(selected.id) : false;
|
||||
const selISpeaker = selected ? mySpeakerSessions.includes(selected.id) : false;
|
||||
const selNeedsMaterial = selISpeaker && !selected?.material_path;
|
||||
const selIsService = selSlot?.type === 'service_session';
|
||||
// Service sessions have no material requirement (and no mic), so the
|
||||
// pending-material notice never applies to them.
|
||||
const selNeedsMaterial = selISpeaker && !selected?.material_path && !selIsService;
|
||||
|
||||
async function handleUpload(e: React.ChangeEvent<HTMLInputElement>) {
|
||||
const file = e.target.files?.[0];
|
||||
@@ -166,7 +169,9 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
<div className="grow">
|
||||
<div className="title">
|
||||
{s.title}
|
||||
{isMySession && <span className="pill speaker-tag" style={{ marginLeft: 6 }}>🎤 you</span>}
|
||||
{isMySession && !isService && (
|
||||
<span className="pill speaker-tag" style={{ marginLeft: 6 }}>🎤 you</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="meta">
|
||||
{s.room} · {s.speakers}
|
||||
@@ -198,7 +203,7 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
{selected.description}
|
||||
</div>
|
||||
<div className="row" style={{ gap: 8, marginBottom: 14, flexWrap: 'wrap' }}>
|
||||
<span className="pill">🎤 {selected.speakers}</span>
|
||||
<span className="pill">{selIsService ? '' : '🎤 '}{selected.speakers}</span>
|
||||
{selected.capacity && <span className="pill">👥 {selected.capacity}</span>}
|
||||
{selCheckedIn && <span className="pill green">✓ Checked in</span>}
|
||||
</div>
|
||||
@@ -214,6 +219,31 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Speaker feedback: visible only after the session is over. */}
|
||||
{selISpeaker && selStatus === 'done' && (
|
||||
<div className="feedback-review">
|
||||
<div className="fr-title">⭐ Your session feedback</div>
|
||||
{selected.average_feedback != null ? (
|
||||
<div className="fr-rating">
|
||||
<span className="fr-stars">
|
||||
{[1, 2, 3, 4, 5].map((n) => (
|
||||
<span key={n} className={n <= Math.round(selected.average_feedback!) ? 'on' : ''}>★</span>
|
||||
))}
|
||||
</span>
|
||||
<span className="fr-num">{selected.average_feedback.toFixed(1)}</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="muted small">No feedback yet.</div>
|
||||
)}
|
||||
{selected.ai_generated_feedback && (
|
||||
<div className="fr-summary">
|
||||
<div className="muted small" style={{ fontWeight: 700, marginBottom: 4 }}>AI summary</div>
|
||||
<div style={{ lineHeight: 1.5 }}>{selected.ai_generated_feedback}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
{selStatus === 'done' && selCheckedIn && (
|
||||
<button className="btn primary" onClick={() => openFeedback(selected.id)}>
|
||||
|
||||
@@ -1,17 +1,54 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { useEvent } from '../lib/useEvent';
|
||||
import { getMyCheckins, getMyPreferences, getMySpeakerSessions } from '../lib/api';
|
||||
import { getMyCheckins, getMyFeedback, getMyPreferences, getMySpeakerSessions } from '../lib/api';
|
||||
import { fmtRange, greeting, slotStatus } from '../lib/time';
|
||||
import type { Preference, Session } from '../lib/types';
|
||||
import { Empty, Sheet, Spinner } from '../components/ui';
|
||||
import type { Feedback, Preference, Session } from '../lib/types';
|
||||
import { Sheet, Spinner } from '../components/ui';
|
||||
|
||||
/** A single session block inside the Now/Next card (title + room + speaker). */
|
||||
function SessionBlock({ session, checkedIn }: { session: Session; checkedIn?: boolean }) {
|
||||
return (
|
||||
<>
|
||||
<div className="h2" style={{ marginTop: 10 }}>{session.title}</div>
|
||||
<div className="muted small" style={{ marginTop: 3 }}>
|
||||
{session.room} · {session.speakers}
|
||||
</div>
|
||||
{checkedIn !== undefined && (
|
||||
checkedIn ? (
|
||||
<span className="pill green" style={{ marginTop: 10 }}>✓ Checked in</span>
|
||||
) : (
|
||||
<span className="pill amber" style={{ marginTop: 10 }}>Show your QR to staff to check in</span>
|
||||
)
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** The list of concurrent sessions shown when the user has no pick for the slot. */
|
||||
function ConcurrentList({ sessions }: { sessions: Session[] }) {
|
||||
return (
|
||||
<div className="now-list">
|
||||
{sessions.map((s) => (
|
||||
<div key={s.id} className="now-item">
|
||||
<div className="t">{s.title}</div>
|
||||
<div className="muted small">{s.room} · {s.speakers}</div>
|
||||
</div>
|
||||
))}
|
||||
<div className="muted small" style={{ marginTop: 10 }}>
|
||||
No pick yet — tap a session in the Agenda to choose.
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Home({ go }: { go: (tab: string) => void }) {
|
||||
const { contact, registration } = useAuth();
|
||||
const { event, slots, sessionById, now, loading } = useEvent();
|
||||
const { event, slots, sessionById, slotById, now, loading } = useEvent();
|
||||
const [prefs, setPrefs] = useState<Preference[]>([]);
|
||||
const [checkins, setCheckins] = useState<string[]>([]);
|
||||
const [mySpeakerSessions, setMySpeakerSessions] = useState<string[]>([]);
|
||||
const [myFeedback, setMyFeedback] = useState<Feedback[]>([]);
|
||||
const [materialSheetOpen, setMaterialSheetOpen] = useState(false);
|
||||
|
||||
const email = contact?.email ?? '';
|
||||
@@ -20,15 +57,17 @@ export function Home({ go }: { go: (tab: string) => void }) {
|
||||
let active = true;
|
||||
(async () => {
|
||||
try {
|
||||
const [p, c, sp] = await Promise.all([
|
||||
const [p, c, sp, fb] = await Promise.all([
|
||||
getMyPreferences(),
|
||||
getMyCheckins(email),
|
||||
getMySpeakerSessions(email),
|
||||
getMyFeedback(email),
|
||||
]);
|
||||
if (!active) return;
|
||||
setPrefs(p);
|
||||
setCheckins(c);
|
||||
setMySpeakerSessions(sp);
|
||||
setMyFeedback(fb);
|
||||
} catch {
|
||||
/* non-fatal */
|
||||
}
|
||||
@@ -53,7 +92,10 @@ export function Home({ go }: { go: (tab: string) => void }) {
|
||||
<section className="screen">
|
||||
<div className="h1">APPE</div>
|
||||
<div className="card" style={{ marginTop: 16 }}>
|
||||
<Empty icon="📅" text="No active event right now. Check back soon!" />
|
||||
<div className="empty">
|
||||
<div className="big">📅</div>
|
||||
No active event right now. Check back soon!
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
@@ -64,13 +106,32 @@ export function Home({ go }: { go: (tab: string) => void }) {
|
||||
const current = slots.find(({ slot }) => slotStatus(slot, now) === 'now');
|
||||
const next = slots.find(({ slot }) => slotStatus(slot, now) === 'next');
|
||||
|
||||
const nowSession = current ? sessionById.get(pickFor(current.slot.id) ?? '') : undefined;
|
||||
const nextSession = next ? sessionById.get(pickFor(next.slot.id) ?? '') : undefined;
|
||||
const nowPick = current ? sessionById.get(pickFor(current.slot.id) ?? '') : undefined;
|
||||
const nextPick = next ? sessionById.get(pickFor(next.slot.id) ?? '') : undefined;
|
||||
|
||||
// Sessions the signed-in contact speaks in that still have no material uploaded.
|
||||
// Service sessions have no material requirement, so they're excluded.
|
||||
const pendingMaterial = mySpeakerSessions
|
||||
.map((id) => sessionById.get(id))
|
||||
.filter((s): s is Session => !!s && !s.material_path);
|
||||
.filter((s): s is Session => !!s && !s.material_path && s.slot_type !== 'service_session');
|
||||
|
||||
// Pending feedback: sessions the contact is checked into that are over, where
|
||||
// they are NOT the speaker, and they haven't submitted feedback yet.
|
||||
const feedbackPending = checkins
|
||||
.map((id) => sessionById.get(id))
|
||||
.filter((s): s is Session => !!s)
|
||||
.filter((s) => {
|
||||
const sl = slotById.get(s.slot_id);
|
||||
return !!sl && slotStatus(sl, now) === 'done';
|
||||
})
|
||||
.filter((s) => !mySpeakerSessions.includes(s.id))
|
||||
.filter((s) => !myFeedback.some((f) => f.session_id === s.id));
|
||||
|
||||
// All of the contact's picks for today, in slot order.
|
||||
const picks = prefs
|
||||
.map((p) => ({ slot: slotById.get(p.slot_id), session: sessionById.get(p.session_id) }))
|
||||
.filter((r): r is { slot: NonNullable<ReturnType<typeof slotById.get>>; session: Session } => !!r.slot && !!r.session)
|
||||
.sort((a, b) => a.slot.id - b.slot.id);
|
||||
|
||||
const firstName = contact.full_name.split(' ')[0];
|
||||
|
||||
@@ -91,74 +152,70 @@ export function Home({ go }: { go: (tab: string) => void }) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Pending feedback: nudge to rate a session they attended. */}
|
||||
{feedbackPending.length > 0 && (
|
||||
<button className="feedback-pill" onClick={() => go('agenda')}>
|
||||
⭐ {feedbackPending.length === 1 ? 'Rate your last session' : `Rate ${feedbackPending.length} sessions`}
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* Now: the current slot. With a pick, show it; without, show everything running. */}
|
||||
{current && (
|
||||
<div className="card now-card">
|
||||
<div className="row between">
|
||||
<span className="pill violet">● Now</span>
|
||||
<span className="muted small">{fmtRange(current.slot)}</span>
|
||||
</div>
|
||||
{nowSession ? (
|
||||
<>
|
||||
<div className="h2" style={{ marginTop: 10 }}>{nowSession.title}</div>
|
||||
<div className="muted small" style={{ marginTop: 3 }}>
|
||||
{nowSession.room} · {nowSession.speakers}
|
||||
</div>
|
||||
{checkins.includes(nowSession.id) ? (
|
||||
<span className="pill green" style={{ marginTop: 10 }}>✓ Checked in</span>
|
||||
) : (
|
||||
<span className="pill amber" style={{ marginTop: 10 }}>Show your QR to staff to check in</span>
|
||||
)}
|
||||
</>
|
||||
{nowPick ? (
|
||||
<SessionBlock session={nowPick} checkedIn={checkins.includes(nowPick.id)} />
|
||||
) : current.sessions.length > 0 ? (
|
||||
<ConcurrentList sessions={current.sessions} />
|
||||
) : (
|
||||
<div className="muted small" style={{ marginTop: 10 }}>
|
||||
No pick yet — tap a session in the Agenda to choose.
|
||||
</div>
|
||||
<div className="muted small" style={{ marginTop: 10 }}>Nothing scheduled right now.</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Next: the upcoming slot. */}
|
||||
{next && (
|
||||
<div className="card">
|
||||
<div className="row between">
|
||||
<span className="pill cyan">Next</span>
|
||||
<span className="muted small">{fmtRange(next.slot)}</span>
|
||||
</div>
|
||||
{nextSession ? (
|
||||
<>
|
||||
<div className="h2" style={{ marginTop: 10 }}>{nextSession.title}</div>
|
||||
<div className="muted small" style={{ marginTop: 3 }}>
|
||||
{nextSession.room} · {nextSession.speakers}
|
||||
</div>
|
||||
</>
|
||||
{nextPick ? (
|
||||
<SessionBlock session={nextPick} />
|
||||
) : next.sessions.length > 0 ? (
|
||||
<ConcurrentList sessions={next.sessions} />
|
||||
) : (
|
||||
<div className="muted small" style={{ marginTop: 10 }}>
|
||||
No pick yet — tap a session in the Agenda to choose.
|
||||
</div>
|
||||
<div className="muted small" style={{ marginTop: 10 }}>Nothing scheduled next.</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* My picks today */}
|
||||
<div>
|
||||
<div className="row between" style={{ marginBottom: 9 }}>
|
||||
<span className="h2">My picks today</span>
|
||||
<a className="muted small link" onClick={() => go('agenda')}>tap to change</a>
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
||||
{[
|
||||
{ label: 'Now', slot: current?.slot, session: nowSession },
|
||||
{ label: 'Next', slot: next?.slot, session: nextSession },
|
||||
]
|
||||
.filter((r) => r.slot)
|
||||
.map((r) => (
|
||||
<button key={r.label} className="pick-chip" onClick={() => go('agenda')}>
|
||||
<span className="t">{fmtRange(r.slot!)}</span>
|
||||
{picks.length > 0 ? (
|
||||
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
||||
{picks.map((r) => (
|
||||
<button key={r.session.id} className="pick-chip" onClick={() => go('agenda')}>
|
||||
<span className="t">{fmtRange(r.slot)}</span>
|
||||
<span className="grow" style={{ fontWeight: 600, textAlign: 'left' }}>
|
||||
{r.session ? r.session.title : 'No pick yet'}
|
||||
{r.session.title}
|
||||
</span>
|
||||
{r.session && <span className="muted small">{r.session.room}</span>}
|
||||
{r.session.room && <span className="muted small">{r.session.room}</span>}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="muted small" style={{ padding: '10px 2px' }}>
|
||||
No picks yet — tap a session in the Agenda to choose.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="qa-grid">
|
||||
|
||||
@@ -22,7 +22,8 @@ export function Scan() {
|
||||
|
||||
useEffect(() => {
|
||||
if (slots.length > 0 && !sessionId) {
|
||||
const first = slots[0].sessions[0];
|
||||
// Default to the first checkable (non-service) session.
|
||||
const first = slots.flatMap((s) => s.sessions).find((s) => s.slot_type !== 'service_session');
|
||||
if (first) setSessionId(first.id);
|
||||
}
|
||||
}, [slots, sessionId]);
|
||||
@@ -128,13 +129,15 @@ export function Scan() {
|
||||
<>
|
||||
<div className="muted small" style={{ marginBottom: 7 }}>Checking in to session</div>
|
||||
<select className="input" value={sessionId} onChange={(e) => setSessionId(e.target.value)}>
|
||||
{slots.map(({ slot, sessions }) => (
|
||||
<optgroup key={slot.id} label={`${slot.name} · ${slot.start_time.slice(0, 5)}`}>
|
||||
{sessions.map((s) => (
|
||||
<option key={s.id} value={s.id}>{s.title}</option>
|
||||
))}
|
||||
</optgroup>
|
||||
))}
|
||||
{slots
|
||||
.filter(({ slot }) => slot.type !== 'service_session')
|
||||
.map(({ slot, sessions }) => (
|
||||
<optgroup key={slot.id} label={`${slot.name} · ${slot.start_time.slice(0, 5)}`}>
|
||||
{sessions.map((s) => (
|
||||
<option key={s.id} value={s.id}>{s.title}</option>
|
||||
))}
|
||||
</optgroup>
|
||||
))}
|
||||
</select>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -77,6 +77,17 @@ body {
|
||||
border-radius: 12px; padding: 14px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px;
|
||||
}
|
||||
.material-notice .mn-title { font-weight: 800; font-size: 14px; }
|
||||
/* speaker's post-session feedback review (rating + AI summary) */
|
||||
.feedback-review {
|
||||
background: rgba(124,58,237,.07); border: 1px solid rgba(124,58,237,.35); border-left: 3px solid #7c3aed;
|
||||
border-radius: 12px; padding: 14px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px;
|
||||
}
|
||||
.feedback-review .fr-title { font-weight: 800; font-size: 14px; }
|
||||
.feedback-review .fr-rating { display: flex; align-items: center; gap: 10px; }
|
||||
.feedback-review .fr-stars { font-size: 18px; letter-spacing: 2px; color: #d6d3d1; }
|
||||
.feedback-review .fr-stars .on { color: #f59e0b; }
|
||||
.feedback-review .fr-num { font-weight: 800; font-size: 16px; }
|
||||
.feedback-review .fr-summary { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
|
||||
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 800; color: #fff; flex-shrink: 0; }
|
||||
.input {
|
||||
width: 100%; padding: 15px 16px; border-radius: 14px; border: 1px solid var(--line);
|
||||
@@ -168,6 +179,18 @@ textarea.input { resize: none; min-height: 96px; }
|
||||
color: #d50000; font-weight: 800; font-size: 14px; cursor: pointer; flex-shrink: 0; white-space: nowrap;
|
||||
}
|
||||
.now-card { background: linear-gradient(135deg, rgba(213,0,0,.1), rgba(32,178,170,.08)); border: 1px solid rgba(213,0,0,.35); }
|
||||
/* Concurrent-session list inside the Now/Next card (shown when there's no pick). */
|
||||
.now-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
|
||||
.now-item { padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
|
||||
.now-item .t { font-weight: 700; font-size: 14px; }
|
||||
/* Pending-feedback nudge (attendees who attended a session that's now over). */
|
||||
.feedback-pill {
|
||||
display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 12px;
|
||||
padding: 12px 14px; border-radius: 14px; cursor: pointer; font-family: inherit;
|
||||
background: rgba(124,58,237,.1); border: 1px solid rgba(124,58,237,.4);
|
||||
color: #6d28d9; font-weight: 800; font-size: 14px; text-align: left;
|
||||
}
|
||||
.feedback-pill:active { transform: scale(.99); }
|
||||
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
|
||||
.qa {
|
||||
display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 16px; cursor: pointer;
|
||||
|
||||
Reference in new issue
Block a user