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:
committed 2026-08-25 08:58:16 +02:00
1 parent fad978e9f4
commit bd67debeef
15 files changed
+878 -105

No files matched your search

+103 -46
View File
@@ -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">