fix(convivo): consistent service cards, in-place pick details, no duplicated slot time
- groupAgenda drops orphan service slots (no session row), so every Service Session card consistently shows header + session row; list, slot count and Home Now/Next agree - Extract the session detail bottom sheet into shared components/SessionDetail.tsx; Home's My-picks chips now open it in place instead of routing to the Agenda (App passes openFeedback so Give-feedback works there too) - Sheet subtitle shows the slot name only when it adds information: auto-named 'Slot 10:15-11:00' no longer repeats the time range, and service names equal to the session title are skipped - e2e: orphan-slot test + Home session picks test (exact subtitle assertion) in convivo-admin-entry.spec.ts, 41/41 green; speaker-portal 19/19; docs + release record 2026-10-16.md 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
8e38052f4c
commit
84d39224ba
10 files changed
+442
-177
No files matched your search
@@ -156,7 +156,7 @@ function Shell() {
|
||||
|
||||
return (
|
||||
<div className="app">
|
||||
{tab === 'home' && <Home go={go} onEventFeedback={() => setEventFeedbackOpen(true)} />}
|
||||
{tab === 'home' && <Home go={go} onEventFeedback={() => setEventFeedbackOpen(true)} openFeedback={(id) => setFeedbackSession(id)} />}
|
||||
{tab === 'agenda' && <Agenda openFeedback={(id) => setFeedbackSession(id)} />}
|
||||
{tab === 'scan' && <Scan />}
|
||||
{tab === 'connections' && <Connections initialTab={connectionsTab} />}
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
import { useRef } from 'react';
|
||||
import {
|
||||
clearPreference,
|
||||
removeSessionMaterial,
|
||||
sessionMaterialUrl,
|
||||
setPreference,
|
||||
uploadSessionMaterial,
|
||||
} from '../lib/api';
|
||||
import { fmtRange, slotStatus } from '../lib/time';
|
||||
import type { Session, Slot } from '../lib/types';
|
||||
import { useToast } from '../context/ToastContext';
|
||||
import { Sheet } from './ui';
|
||||
|
||||
/**
|
||||
* The session detail bottom sheet — the single source of truth for what a
|
||||
* session looks like when opened. Used by the Agenda list and by Home's
|
||||
* "My picks today" chips, so tapping a pick on Home shows exactly the same
|
||||
* detail as tapping it in the Agenda.
|
||||
*/
|
||||
export function SessionDetail({
|
||||
session,
|
||||
slot,
|
||||
now,
|
||||
checkedIn,
|
||||
isSpeaker,
|
||||
picked,
|
||||
onClose,
|
||||
onPickChanged,
|
||||
onGiveFeedback,
|
||||
onMaterialChanged,
|
||||
}: {
|
||||
session: Session | null;
|
||||
slot: Slot | undefined;
|
||||
now: Date;
|
||||
checkedIn: boolean;
|
||||
isSpeaker: boolean;
|
||||
picked: boolean;
|
||||
onClose: () => void;
|
||||
/** Persist a pick/un-pick; the parent refreshes its own preference list. */
|
||||
onPickChanged: () => Promise<void> | void;
|
||||
onGiveFeedback?: (sessionId: string) => void;
|
||||
/** Refresh the agenda after a material upload/remove. */
|
||||
onMaterialChanged?: () => void;
|
||||
}) {
|
||||
const { toast } = useToast();
|
||||
const fileRef = useRef<HTMLInputElement>(null);
|
||||
if (!session || !slot) return null;
|
||||
|
||||
const status = slotStatus(slot, now);
|
||||
const isService = slot.type === 'service_session';
|
||||
// Service sessions have no material requirement (and no mic), so the
|
||||
// pending-material notice never applies to them.
|
||||
const needsMaterial = isSpeaker && !session.material_path && !isService;
|
||||
|
||||
async function togglePick() {
|
||||
try {
|
||||
if (picked) {
|
||||
await clearPreference(slot!.id);
|
||||
toast('Pick removed');
|
||||
} else {
|
||||
await setPreference(session!.id);
|
||||
toast('Pick saved ✓', 'ok');
|
||||
}
|
||||
await onPickChanged();
|
||||
} catch (e) {
|
||||
toast(e instanceof Error ? e.message : 'Could not update pick', 'err');
|
||||
}
|
||||
}
|
||||
|
||||
async function handleUpload(e: React.ChangeEvent<HTMLInputElement>) {
|
||||
const file = e.target.files?.[0];
|
||||
if (!file || !session) return;
|
||||
try {
|
||||
await uploadSessionMaterial(session.id, file);
|
||||
toast('Material uploaded ✓', 'ok');
|
||||
onClose();
|
||||
onMaterialChanged?.();
|
||||
} catch (err) {
|
||||
toast(err instanceof Error ? err.message : 'Upload failed', 'err');
|
||||
} finally {
|
||||
if (fileRef.current) fileRef.current.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteMaterial() {
|
||||
if (!session) return;
|
||||
if (!confirm('Remove this material? You can upload a new one.')) return;
|
||||
try {
|
||||
await removeSessionMaterial(session.id);
|
||||
toast('Material removed', 'ok');
|
||||
onClose();
|
||||
onMaterialChanged?.();
|
||||
} catch (err) {
|
||||
toast(err instanceof Error ? err.message : 'Could not remove material', 'err');
|
||||
}
|
||||
}
|
||||
|
||||
const range = fmtRange(slot);
|
||||
// Talk slots are auto-named "Slot 10:15–11:00", which merely repeats the
|
||||
// time range shown next to it, and service slots are often named exactly
|
||||
// like their session (the title is already the heading). Show the slot name
|
||||
// only when it actually adds information.
|
||||
const showSlotName = slot.name !== `Slot ${range}` && slot.name !== session.title;
|
||||
|
||||
return (
|
||||
<Sheet open onClose={onClose}>
|
||||
<div className="row between">
|
||||
<div>
|
||||
<h3>{session.title}</h3>
|
||||
<div className="sub">
|
||||
{showSlotName && <>{slot.name} · </>}{range} · {session.room}
|
||||
</div>
|
||||
</div>
|
||||
<button className="btn ghost small" onClick={onClose}>✕</button>
|
||||
</div>
|
||||
<div className="muted small" id="sd-desc" style={{ margin: '12px 0', lineHeight: 1.55 }}>
|
||||
{session.description}
|
||||
</div>
|
||||
<div className="row" style={{ gap: 8, marginBottom: 14, flexWrap: 'wrap' }}>
|
||||
<span className="pill">{isService ? '' : '🎤 '}{session.speakers}</span>
|
||||
{session.level && <span className="pill violet">📶 {session.level}</span>}
|
||||
{session.area && <span className="pill cyan">🗂 {session.area}</span>}
|
||||
{session.capacity && <span className="pill">👥 {session.capacity}</span>}
|
||||
{checkedIn && <span className="pill green">✓ Checked in</span>}
|
||||
</div>
|
||||
|
||||
{/* Speaker material: non-dismissible notification until uploaded. */}
|
||||
{needsMaterial && (
|
||||
<div className="material-notice" data-testid="material-upload-notice">
|
||||
<div className="mn-title">📎 Upload your session material</div>
|
||||
<div className="muted small" style={{ marginBottom: 10 }}>
|
||||
Attendees can download your slides/notes from this session.
|
||||
</div>
|
||||
<input ref={fileRef} type="file" data-testid="material-upload" className="input" onChange={handleUpload} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Speaker feedback: visible only after the session is over. */}
|
||||
{isSpeaker && status === 'done' && (
|
||||
<div className="feedback-review">
|
||||
<div className="fr-title">⭐ Your session feedback</div>
|
||||
{session.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(session.average_feedback!) ? 'on' : ''}>★</span>
|
||||
))}
|
||||
</span>
|
||||
<span className="fr-num">{session.average_feedback.toFixed(1)}</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="muted small">No feedback yet.</div>
|
||||
)}
|
||||
{session.ai_generated_feedback && (
|
||||
<div className="fr-summary">
|
||||
<div className="muted small" style={{ fontWeight: 700, marginBottom: 4 }}>AI summary</div>
|
||||
<div style={{ lineHeight: 1.5 }}>{session.ai_generated_feedback}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
{status === 'done' && checkedIn && onGiveFeedback && (
|
||||
<button className="btn primary" data-testid="give-feedback" onClick={() => onGiveFeedback(session.id)}>
|
||||
Give feedback ⭐
|
||||
</button>
|
||||
)}
|
||||
{status === 'done' && !checkedIn && (
|
||||
<div className="muted small" style={{ textAlign: 'center' }}>
|
||||
You weren’t checked in to this session.
|
||||
</div>
|
||||
)}
|
||||
{isService ? (
|
||||
<div className="muted small" style={{ textAlign: 'center' }}>
|
||||
No pick needed for this slot.
|
||||
</div>
|
||||
) : (
|
||||
<button className={`btn ${picked ? 'danger' : 'primary'}`} onClick={togglePick}>
|
||||
{picked ? 'Remove my pick' : 'Pick this session'}
|
||||
</button>
|
||||
)}
|
||||
{/* Material download (all attendees) — pinned to the bottom. */}
|
||||
{session.material_path && (
|
||||
<a className="btn primary" href={sessionMaterialUrl(session.material_path)} target="_blank" rel="noreferrer">
|
||||
📎 Download material
|
||||
</a>
|
||||
)}
|
||||
{/* Speakers can remove their own material to re-upload. */}
|
||||
{isSpeaker && session.material_path && (
|
||||
<button className="btn danger" onClick={handleDeleteMaterial}>
|
||||
🗑 Remove material
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</Sheet>
|
||||
);
|
||||
}
|
||||
@@ -83,7 +83,15 @@ export function groupAgenda(rows: AgendaRow[]): { slot: Slot; sessions: Session[
|
||||
});
|
||||
}
|
||||
}
|
||||
return [...map.values()].sort((first, second) =>
|
||||
// A service slot is only meaningful with a session behind it (break / lunch /
|
||||
// closing …). An orphan service slot — left over from an earlier feed or a
|
||||
// manual edit with no session row — would render as a header-only card,
|
||||
// inconsistent with every other service card. Drop those (mirroring how the
|
||||
// agenda already hides empty talk slots) so the list, its slot count, and
|
||||
// Home's Now/Next all agree.
|
||||
return [...map.values()]
|
||||
.filter(({ slot, sessions }) => slot.type !== 'service_session' || sessions.length > 0)
|
||||
.sort((first, second) =>
|
||||
first.slot.slot_date.localeCompare(second.slot.slot_date)
|
||||
|| first.slot.start_time.localeCompare(second.slot.start_time)
|
||||
|| first.slot.end_time.localeCompare(second.slot.end_time)
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { useEvent } from '../lib/useEvent';
|
||||
import { mergeAgendaPlaceholders } from '../lib/agendaBlocks';
|
||||
import {
|
||||
clearPreference,
|
||||
getMyCheckins,
|
||||
getMyPreferences,
|
||||
getMySpeakerSessions,
|
||||
removeSessionMaterial,
|
||||
sessionMaterialUrl,
|
||||
setPreference,
|
||||
uploadSessionMaterial,
|
||||
} from '../lib/api';
|
||||
import { getMyCheckins, getMyPreferences, getMySpeakerSessions } from '../lib/api';
|
||||
import { capWords, fmtRange, slotStatus } from '../lib/time';
|
||||
import type { Preference, Session } from '../lib/types';
|
||||
import { Sheet, Spinner } from '../components/ui';
|
||||
import { useToast } from '../context/ToastContext';
|
||||
import { Spinner } from '../components/ui';
|
||||
import { SessionDetail } from '../components/SessionDetail';
|
||||
|
||||
export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) => void }) {
|
||||
const { contact } = useAuth();
|
||||
@@ -24,8 +15,6 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
const [checkins, setCheckins] = useState<string[]>([]);
|
||||
const [mySpeakerSessions, setMySpeakerSessions] = useState<string[]>([]);
|
||||
const [selected, setSelected] = useState<Session | null>(null);
|
||||
const fileRef = useRef<HTMLInputElement>(null);
|
||||
const { toast } = useToast();
|
||||
|
||||
// Agenda filters: level + area (free-text, dynamic — built from the distinct
|
||||
// values actually present in the agenda, so it works for numeric levels
|
||||
@@ -99,60 +88,7 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
|
||||
const pickFor = (slotId: number) => prefs.find((p) => p.slot_id === slotId)?.session_id;
|
||||
|
||||
async function togglePick(slotId: number, sessionId: string) {
|
||||
const current = pickFor(slotId);
|
||||
try {
|
||||
if (current === sessionId) {
|
||||
await clearPreference(slotId);
|
||||
toast('Pick removed');
|
||||
} else {
|
||||
await setPreference(sessionId);
|
||||
toast('Pick saved ✓', 'ok');
|
||||
}
|
||||
const p = await getMyPreferences();
|
||||
setPrefs(p);
|
||||
} catch (e) {
|
||||
toast(e instanceof Error ? e.message : 'Could not update pick', 'err');
|
||||
}
|
||||
}
|
||||
|
||||
const selSlot = selected ? slots.find((s) => s.slot.id === selected.slot_id)?.slot : undefined;
|
||||
const selStatus = selSlot ? slotStatus(selSlot, now) : 'next';
|
||||
const selCheckedIn = selected ? checkins.includes(selected.id) : false;
|
||||
const selISpeaker = selected ? mySpeakerSessions.includes(selected.id) : false;
|
||||
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];
|
||||
if (!file || !selected) return;
|
||||
try {
|
||||
await uploadSessionMaterial(selected.id, file);
|
||||
toast('Material uploaded ✓', 'ok');
|
||||
setSelected(null);
|
||||
// Refresh agenda so material_path updates.
|
||||
reload();
|
||||
} catch (err) {
|
||||
toast(err instanceof Error ? err.message : 'Upload failed', 'err');
|
||||
} finally {
|
||||
if (fileRef.current) fileRef.current.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteMaterial() {
|
||||
if (!selected) return;
|
||||
if (!confirm('Remove this material? You can upload a new one.')) return;
|
||||
try {
|
||||
await removeSessionMaterial(selected.id);
|
||||
toast('Material removed', 'ok');
|
||||
setSelected(null);
|
||||
reload();
|
||||
} catch (err) {
|
||||
toast(err instanceof Error ? err.message : 'Could not remove material', 'err');
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="screen">
|
||||
@@ -259,104 +195,18 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
})}
|
||||
</div>
|
||||
|
||||
<Sheet open={!!selected} onClose={() => setSelected(null)}>
|
||||
{selected && selSlot && (
|
||||
<>
|
||||
<div className="row between">
|
||||
<div>
|
||||
<h3>{selected.title}</h3>
|
||||
<div className="sub">
|
||||
{selSlot.name} · {fmtRange(selSlot)} · {selected.room}
|
||||
</div>
|
||||
</div>
|
||||
<button className="btn ghost small" onClick={() => setSelected(null)}>✕</button>
|
||||
</div>
|
||||
<div className="muted small" id="sd-desc" style={{ margin: '12px 0', lineHeight: 1.55 }}>
|
||||
{selected.description}
|
||||
</div>
|
||||
<div className="row" style={{ gap: 8, marginBottom: 14, flexWrap: 'wrap' }}>
|
||||
<span className="pill">{selIsService ? '' : '🎤 '}{selected.speakers}</span>
|
||||
{selected.level && <span className="pill violet">📶 {selected.level}</span>}
|
||||
{selected.area && <span className="pill cyan">🗂 {selected.area}</span>}
|
||||
{selected.capacity && <span className="pill">👥 {selected.capacity}</span>}
|
||||
{selCheckedIn && <span className="pill green">✓ Checked in</span>}
|
||||
</div>
|
||||
|
||||
{/* Speaker material: non-dismissible notification until uploaded. */}
|
||||
{selNeedsMaterial && (
|
||||
<div className="material-notice" data-testid="material-upload-notice">
|
||||
<div className="mn-title">📎 Upload your session material</div>
|
||||
<div className="muted small" style={{ marginBottom: 10 }}>
|
||||
Attendees can download your slides/notes from this session.
|
||||
</div>
|
||||
<input ref={fileRef} type="file" data-testid="material-upload" className="input" onChange={handleUpload} />
|
||||
</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" data-testid="give-feedback" onClick={() => openFeedback(selected.id)}>
|
||||
Give feedback ⭐
|
||||
</button>
|
||||
)}
|
||||
{selStatus === 'done' && !selCheckedIn && (
|
||||
<div className="muted small" style={{ textAlign: 'center' }}>
|
||||
You weren’t checked in to this session.
|
||||
</div>
|
||||
)}
|
||||
{selSlot.type === 'service_session' ? (
|
||||
<div className="muted small" style={{ textAlign: 'center' }}>
|
||||
No pick needed for this slot.
|
||||
</div>
|
||||
) : (
|
||||
<button
|
||||
className={`btn ${pickFor(selected.slot_id) === selected.id ? 'danger' : 'primary'}`}
|
||||
onClick={() => togglePick(selected.slot_id, selected.id)}
|
||||
>
|
||||
{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>
|
||||
)}
|
||||
{/* Speakers can remove their own material to re-upload. */}
|
||||
{selISpeaker && selected.material_path && (
|
||||
<button className="btn danger" onClick={handleDeleteMaterial}>
|
||||
🗑 Remove material
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Sheet>
|
||||
<SessionDetail
|
||||
session={selected}
|
||||
slot={selSlot}
|
||||
now={now}
|
||||
checkedIn={!!selected && checkins.includes(selected.id)}
|
||||
isSpeaker={!!selected && mySpeakerSessions.includes(selected.id)}
|
||||
picked={!!selected && pickFor(selected.slot_id) === selected.id}
|
||||
onClose={() => setSelected(null)}
|
||||
onPickChanged={async () => setPrefs(await getMyPreferences())}
|
||||
onGiveFeedback={openFeedback}
|
||||
onMaterialChanged={reload}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import { getMyCheckins, getMyFeedback, getMyPreferences, getMySpeakerSessions }
|
||||
import { fmtRange, greeting, slotStatus } from '../lib/time';
|
||||
import type { Feedback, Preference, Session } from '../lib/types';
|
||||
import { Sheet, Spinner } from '../components/ui';
|
||||
import { SessionDetail } from '../components/SessionDetail';
|
||||
|
||||
/** A single session block inside the Now/Next card (title + room + speaker). */
|
||||
function SessionBlock({ session, checkedIn }: { session: Session; checkedIn?: boolean }) {
|
||||
@@ -42,14 +43,18 @@ function ConcurrentList({ sessions }: { sessions: Session[] }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function Home({ go, onEventFeedback }: { go: (tab: string) => void; onEventFeedback?: () => void }) {
|
||||
export function Home({ go, onEventFeedback, openFeedback }: { go: (tab: string) => void; onEventFeedback?: () => void; openFeedback?: (sessionId: string) => void }) {
|
||||
const { contact, registration } = useAuth();
|
||||
const { event, slots, sessionById, slotById, now, clockMode, loading } = useEvent();
|
||||
const { event, slots, sessionById, slotById, now, clockMode, loading, reload } = 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);
|
||||
// The pick the user tapped in "My picks today" — opened in the same detail
|
||||
// sheet the Agenda uses, so a pick shows the full session info in place
|
||||
// instead of bouncing to the Agenda tab.
|
||||
const [selected, setSelected] = useState<Session | null>(null);
|
||||
|
||||
const email = contact?.email ?? '';
|
||||
|
||||
@@ -207,7 +212,12 @@ export function Home({ go, onEventFeedback }: { go: (tab: string) => void; onEve
|
||||
{picks.length > 0 ? (
|
||||
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
||||
{picks.map((r) => (
|
||||
<button key={r.session.id} className="pick-chip" onClick={() => go('agenda')}>
|
||||
<button
|
||||
key={r.session.id}
|
||||
className="pick-chip"
|
||||
data-testid="home-pick"
|
||||
onClick={() => setSelected(r.session)}
|
||||
>
|
||||
<span className="t">{fmtRange(r.slot)}</span>
|
||||
<span className="grow" style={{ fontWeight: 600, textAlign: 'left' }}>
|
||||
{r.session.title}
|
||||
@@ -283,6 +293,21 @@ export function Home({ go, onEventFeedback }: { go: (tab: string) => void; onEve
|
||||
Got it
|
||||
</button>
|
||||
</Sheet>
|
||||
|
||||
{/* Tapping one of "My picks today" opens the same session detail sheet the
|
||||
Agenda shows — no round trip to the Agenda tab. */}
|
||||
<SessionDetail
|
||||
session={selected}
|
||||
slot={selected ? slotById.get(selected.slot_id) : undefined}
|
||||
now={now}
|
||||
checkedIn={!!selected && checkins.includes(selected.id)}
|
||||
isSpeaker={!!selected && mySpeakerSessions.includes(selected.id)}
|
||||
picked={!!selected && pickFor(selected.slot_id) === selected.id}
|
||||
onClose={() => setSelected(null)}
|
||||
onPickChanged={async () => setPrefs(await getMyPreferences())}
|
||||
onGiveFeedback={openFeedback}
|
||||
onMaterialChanged={reload}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -175,6 +175,26 @@ retained no-pick/no-upload service behavior even for an assigned staff speaker.
|
||||
A separate case checks exact date/time matching and keeps unrelated services
|
||||
separate. See the [deployment record](../releases/2026-10-11.md).
|
||||
|
||||
# Agenda Consistency + Home Picks Regression
|
||||
|
||||
Two further API-mocked checks run in the same spec:
|
||||
|
||||
```sh
|
||||
CONVIVO_BASE_URL=http://127.0.0.1:3000 npm test --prefix e2e -- convivo-admin-entry.spec.ts --project=chromium --grep 'Service agenda|Home session picks'
|
||||
```
|
||||
|
||||
- **Orphan service slot** — a `get_agenda` row whose slot is a
|
||||
`service_session` with a null session (the LEFT JOIN shape a slot with no
|
||||
session row produces) must render **no card at all**, so every service card
|
||||
consistently shows a header plus its session row. The rule lives in
|
||||
`groupAgenda`, so the list, the displayed slot count and Home's Now/Next all
|
||||
agree.
|
||||
- **Home session picks** — tapping a "My picks today" chip opens the shared
|
||||
`SessionDetail` sheet **over Home** (title, description, time/room/speaker,
|
||||
level pill, and the "Remove my pick" control) and leaves the active tab on
|
||||
Home; closing the sheet returns to the pick list. This replaces the old
|
||||
behavior of routing to the Agenda tab.
|
||||
|
||||
# Session Persistence Regression
|
||||
|
||||
Run the rollback-only fixture after applying
|
||||
|
||||
@@ -186,8 +186,8 @@ The `Shell` is the navigation container. Render logic, in order:
|
||||
- **Leaderboard** is *not* a tab — it's reached from the Home points pill and the
|
||||
Home quick-actions. It renders as a tab in the shell but is opened via
|
||||
`go('leaderboard')`.
|
||||
- **Feedback** is a full-screen takeover (no tab bar), opened from the Agenda
|
||||
session sheet via `openFeedback(sessionId)`.
|
||||
- **Feedback** is a full-screen takeover (no tab bar), opened from the session
|
||||
detail sheet (Agenda list or Home picks) via `openFeedback(sessionId)`.
|
||||
|
||||
## Shared UI components (`components/ui.tsx`)
|
||||
|
||||
@@ -199,3 +199,17 @@ The `Shell` is the navigation container. Render logic, in order:
|
||||
| `Sheet` | Bottom-sheet modal (backdrop + grab handle) |
|
||||
| `QrImage` | Renders a string (e.g. a QR token) as a scannable QR (`qrcode.react`) |
|
||||
| `Scanner` | Camera QR scanner (`html5-qrcode`) with a **manual-entry fallback** and a `hasCamera` guard (headless/no-camera environments fall back to typing the code) |
|
||||
|
||||
## Session detail (`components/SessionDetail.tsx`)
|
||||
|
||||
`SessionDetail` is the **single session detail bottom sheet** shared by the
|
||||
Agenda list and Home's **My picks today** chips (so tapping a pick on Home
|
||||
opens the session in place instead of routing to the Agenda). It receives the
|
||||
`session` + its `slot` plus plain booleans (`checkedIn`, `isSpeaker`,
|
||||
`picked`) and callbacks (`onPickChanged`, `onGiveFeedback`,
|
||||
`onMaterialChanged`) — the owning screen keeps its own preference/check-in
|
||||
state and refreshes it through the callbacks. Renders: title + time/room
|
||||
subtitle (the slot name is prefixed only when it adds information, so an
|
||||
auto-named "Slot 10:15–11:00" never repeats the time range), description, speaker/level/area/capacity/checked-in pills, the speaker
|
||||
material upload notice, the speaker feedback review, the Give-feedback button,
|
||||
the pick / "No pick needed" control, and the material download/remove buttons.
|
||||
@@ -117,8 +117,14 @@ The landing screen. Shows:
|
||||
- **Next card** — **always shown** for the next slot (same pick / concurrent-list
|
||||
logic as the Now card, without the check-in pill).
|
||||
- **My picks today** — one row per pick the user has made **today** (in slot
|
||||
order), each showing the slot time + session title + room. "tap to change" is a
|
||||
**hyperlink** to the Agenda. With no picks, a "No picks yet" line.
|
||||
order), each showing the slot time + session title + room. Tapping a row
|
||||
opens the **same session detail sheet the Agenda shows** (description,
|
||||
speaker/level/area pills, pick/un-pick, material download, feedback entry)
|
||||
**in place over Home** — no round trip to the Agenda tab. "tap to change" is
|
||||
a **hyperlink** to the Agenda. With no picks, a "No picks yet" line.
|
||||
- The detail sheet is a shared component (`components/SessionDetail.tsx`) used
|
||||
by both Home's picks and the Agenda list, so a session looks and behaves
|
||||
identically wherever it is opened.
|
||||
- **Quick actions** — Scan & connect, Agenda, Connections, Leaderboard.
|
||||
- **No active event** — a graceful empty state ("No active event right now.
|
||||
Check back soon!").
|
||||
@@ -164,8 +170,18 @@ differently:
|
||||
- they have **no material requirement** (the pending-material notice never
|
||||
applies to them).
|
||||
|
||||
A **service slot with no session behind it** (an orphan left over from an
|
||||
earlier feed or a manual edit) is **hidden entirely** by `groupAgenda`, exactly
|
||||
like an empty talk slot. Without this it would render as a header-only card
|
||||
while every real service card shows a header **plus** its session row — the
|
||||
inconsistency the attendee reported. The rule lives in the grouping layer, so
|
||||
the agenda list, its slot count, and Home's Now/Next cards all agree.
|
||||
|
||||
- **Tap a session** → opens a bottom **sheet** with details (description,
|
||||
speakers, room, capacity, checked-in state) and actions:
|
||||
speakers, room, capacity, checked-in state) and actions. The subtitle shows
|
||||
**time · room**, prefixed with the **slot name only when it adds
|
||||
information** — auto-named talk slots ("Slot 10:15–11:00") and service slots
|
||||
named like their session are not repeated:
|
||||
- **Give feedback ⭐** — only when the session is *done* **and** the user is
|
||||
checked in. Opens the Feedback takeover (`openFeedback(sessionId)`).
|
||||
- **Speaker feedback review** — when the user is a **speaker** of the session
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
# Attendee Agenda Polish (2026-10-16)
|
||||
|
||||
Three presentation-only fixes to the attendee app (Convivo), all local-first
|
||||
and deployed together as an attendee-only rebuild (no migrations, no sidecar,
|
||||
no admin changes).
|
||||
|
||||
## 1. Service Session card consistency
|
||||
|
||||
**Symptom:** some Service Session agenda cards rendered a header plus a detail
|
||||
row, while one (11:15–12:00) rendered header-only.
|
||||
|
||||
**Root cause:** an orphan service slot — a `slots` row typed
|
||||
`service_session` with no `sessions` row behind it (a leftover from an earlier
|
||||
feed state or manual edit). `get_agenda` LEFT JOINs sessions onto slots, so
|
||||
the orphan arrives as a row with slot fields and a null session; the Agenda
|
||||
rendered the header with zero session rows. Nothing referenced the slot
|
||||
(0 preferences / check-ins / feedback).
|
||||
|
||||
**Fix:** `groupAgenda` (`apps/convivo/src/lib/api.ts`) drops service slots
|
||||
with no sessions, mirroring the existing rule that hides empty talk slots.
|
||||
Placed in the grouping layer so the agenda list, its displayed slot count, and
|
||||
Home's Now/Next cards all agree. Presentation-only — no data was deleted.
|
||||
|
||||
## 2. Home picks open the session detail in place
|
||||
|
||||
**Request:** tapping a pick under "My picks today" routed to the Agenda tab;
|
||||
it should open the session's details directly.
|
||||
|
||||
**Fix:** the Agenda's session bottom sheet was extracted verbatim into a
|
||||
shared component `apps/convivo/src/components/SessionDetail.tsx` (title,
|
||||
time/room subtitle, description, speaker/level/area/capacity/checked-in pills,
|
||||
pick / "Remove my pick", speaker material upload/download/remove, speaker
|
||||
feedback review, Give-feedback entry). Home's pick chips now open it over
|
||||
Home; the Agenda renders the same component (~100 lines of duplicated markup
|
||||
removed). `App.tsx` passes `openFeedback` into Home so feedback works from the
|
||||
Home sheet too. The "tap to change" link to the Agenda remains.
|
||||
|
||||
## 3. Session detail subtitle no longer repeats the time
|
||||
|
||||
**Symptom:** the sheet subtitle showed the time twice, e.g.
|
||||
"Slot 10:15–11:00 · 10:15–11:00 · Room A".
|
||||
|
||||
**Root cause:** talk slots are auto-named `Slot <start>–<end>`, and the
|
||||
subtitle rendered `{slot.name} · {range} · {room}`.
|
||||
|
||||
**Fix:** the slot name is shown only when it adds information — skipped when
|
||||
it equals the auto-generated `Slot <range>` or repeats the session title
|
||||
(common for services like "Lunch").
|
||||
|
||||
## Verification
|
||||
|
||||
- `convivo-admin-entry.spec.ts` (API-mocked): **41/41** green, including the
|
||||
new orphan-service-slot test and the new "Home session picks" test (sheet
|
||||
opens over Home, tab stays active, exact subtitle `10:15–11:00 · Room A`,
|
||||
close returns to the pick list).
|
||||
- `speaker-portal.spec.ts`: 19/19 green (regression).
|
||||
- Attendee production build clean.
|
||||
- Docs synced: `docs/frontend/screens.md`, `docs/frontend/app-structure.md`
|
||||
(new "Session detail" section), `docs/backend/tests.md` ("Agenda
|
||||
Consistency + Home Picks Regression").
|
||||
@@ -66,6 +66,74 @@ test.describe('Service agenda', () => {
|
||||
await expect(talkBlock.getByText('Different end room', { exact: false })).toHaveCount(0);
|
||||
await expect(talkBlock.getByText('Lunch room', { exact: false })).toHaveCount(0);
|
||||
});
|
||||
test('hides an orphan service slot that has no session behind it', async ({ page }) => {
|
||||
const { session } = await mockApi(page, { registered: true, checkedIn: true });
|
||||
// get_agenda LEFT JOINs sessions onto slots, so an orphan service slot
|
||||
// arrives as a row with the slot fields set but a null session. It must not
|
||||
// render a header-only card (the inconsistency), while real service slots
|
||||
// and talk slots stay.
|
||||
const rows = [
|
||||
{ slot_id: 1, slot_name: 'Arrival & Coffee', start_time: '08:30:00', end_time: '09:00:00', slot_type: 'service_session', session_id: 'session-1', title: 'Arrival & Coffee', room: 'Main', speakers: 'Staff' },
|
||||
{ slot_id: 2, slot_name: 'Slot 10:15–11:00', start_time: '10:15:00', end_time: '11:00:00', slot_type: 'session', session_id: 'session-2', title: 'A Talk', room: 'Main', speakers: 'Speaker' },
|
||||
{ slot_id: 67, slot_name: 'Service Session', start_time: '11:15:00', end_time: '12:00:00', slot_type: 'service_session', session_id: null, title: null, room: null, speakers: null },
|
||||
{ slot_id: 3, slot_name: 'Lunch', start_time: '12:00:00', end_time: '13:00:00', slot_type: 'service_session', session_id: 'session-3', title: 'Lunch', room: 'Main', speakers: 'Staff' },
|
||||
].map(row => ({ ...row, slot_date: '2026-02-20', description: '', material_path: null, capacity: null,
|
||||
average_feedback: null, ai_generated_feedback: null, level: null, area: null }));
|
||||
await page.route('**/rest/v1/rpc/get_agenda', route => route.fulfill({ json: rows }));
|
||||
await page.goto(`${appUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
|
||||
await page.getByTestId('tab-agenda').click();
|
||||
await expect(page.locator('.slot-card')).toHaveCount(3);
|
||||
await expect(page.getByText('3 slots', { exact: true })).toBeVisible();
|
||||
await expect(page.locator('.slot-card').filter({ hasText: '11:15' })).toHaveCount(0);
|
||||
await expect(page.locator('.sess .title')).toHaveText(['Arrival & Coffee', 'A Talk', 'Lunch']);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Home session picks', () => {
|
||||
test('tapping a pick opens its session detail in place instead of routing to the Agenda', async ({ page }) => {
|
||||
const { session } = await mockApi(page, {
|
||||
registered: true, checkedIn: true,
|
||||
picks: [{ slot_id: 1, session_id: 'session-1' }],
|
||||
});
|
||||
const rows = [
|
||||
{ slot_id: 1, slot_name: 'Slot 10:15–11:00', start_time: '10:15:00', end_time: '11:00:00', slot_type: 'session',
|
||||
session_id: 'session-1', title: 'My Picked Talk', room: 'Room A', speakers: 'Ada Lovelace',
|
||||
description: 'Deep dive into picks.', level: 'Beginner', area: 'Power Apps' },
|
||||
{ slot_id: 2, slot_name: 'Slot 11:15–12:00', start_time: '11:15:00', end_time: '12:00:00', slot_type: 'session',
|
||||
session_id: 'session-2', title: 'Other Talk', room: 'Room B', speakers: 'Grace Hopper',
|
||||
description: '', level: null, area: null },
|
||||
].map(row => ({ ...row, slot_date: '2026-02-20', material_path: null, capacity: null,
|
||||
average_feedback: null, ai_generated_feedback: null }));
|
||||
await page.route('**/rest/v1/rpc/get_agenda', route => route.fulfill({ json: rows }));
|
||||
await page.goto(`${appUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
|
||||
|
||||
await expect(page.getByTestId('tab-home')).toHaveClass(/active/);
|
||||
const chip = page.getByTestId('home-pick');
|
||||
await expect(chip).toHaveCount(1);
|
||||
await expect(chip).toContainText('My Picked Talk');
|
||||
|
||||
await chip.click();
|
||||
// The same detail sheet the Agenda shows, opened over Home.
|
||||
await expect(page.locator('.sheet h3')).toHaveText('My Picked Talk');
|
||||
await expect(page.locator('#sd-desc')).toHaveText('Deep dive into picks.');
|
||||
// The auto slot name ("Slot 10:15–11:00") only repeats the time range, so
|
||||
// the subtitle must not show it twice.
|
||||
await expect(page.locator('.sheet .sub')).toHaveText('10:15–11:00 · Room A');
|
||||
await expect(page.locator('.sheet')).toContainText('10:15–11:00');
|
||||
await expect(page.locator('.sheet')).toContainText('Room A');
|
||||
await expect(page.locator('.sheet')).toContainText('Ada Lovelace');
|
||||
await expect(page.locator('.sheet')).toContainText('📶 Beginner');
|
||||
// It is the user's pick, so the sheet offers to remove it.
|
||||
await expect(page.getByRole('button', { name: 'Remove my pick', exact: true })).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: 'Pick this session', exact: true })).toHaveCount(0);
|
||||
// Still on Home — no round trip to the Agenda tab.
|
||||
await expect(page.getByTestId('tab-home')).toHaveClass(/active/);
|
||||
await expect(page.getByTestId('tab-agenda')).not.toHaveClass(/active/);
|
||||
|
||||
await page.locator('.sheet').getByRole('button', { name: '✕', exact: true }).click();
|
||||
await expect(page.locator('.sheet')).toHaveCount(0);
|
||||
await expect(page.getByTestId('home-pick')).toHaveCount(1);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Event demo clock', () => {
|
||||
@@ -146,7 +214,7 @@ function mockSession(email: string) {
|
||||
return { user, access_token: `eyJhbGciOiJIUzI1NiJ9.${payload}.test-signature`, refresh_token: 'mock-refresh-token', token_type: 'bearer', expires_in: 3600 };
|
||||
}
|
||||
|
||||
async function mockApi(page: Page, options: { email?: string; admin?: boolean; registered?: boolean; checkedIn?: boolean; staff?: boolean; eventDate?: string; realtimeClock?: boolean } = {}) {
|
||||
async function mockApi(page: Page, options: { email?: string; admin?: boolean; registered?: boolean; checkedIn?: boolean; staff?: boolean; eventDate?: string; realtimeClock?: boolean; picks?: { slot_id: number; session_id: string }[] } = {}) {
|
||||
const email = options.email || '[email protected]';
|
||||
const session = mockSession(email);
|
||||
const calls = { users: 0, exchanges: 0, passwords: 0, logouts: 0, otp: 0, lanyards: 0, mutations: [] as string[] };
|
||||
@@ -177,6 +245,12 @@ async function mockApi(page: Page, options: { email?: string; admin?: boolean; r
|
||||
await route.fulfill({ json: options.admin !== false });
|
||||
}
|
||||
else if (pathname.endsWith('/rpc/is_admin')) await route.fulfill({ json: options.admin !== false });
|
||||
else if (pathname.endsWith('/preferences')) {
|
||||
await route.fulfill({ json: (options.picks ?? []).map((p, index) => ({
|
||||
id: `pref-${index}`, event_id: '33333333-3333-4333-8333-333333333333',
|
||||
contact_email: email, session_id: p.session_id, slot_id: p.slot_id,
|
||||
})) });
|
||||
}
|
||||
else if (pathname.endsWith('/contacts')) await route.fulfill({ json: { email, full_name: 'Test Member', is_admin: false, show_email: false, show_linkedin: false } });
|
||||
else if (pathname.endsWith('/registrations')) {
|
||||
expect(new URL(request.url()).searchParams.get('event_id')).toBe('eq.33333333-3333-4333-8333-333333333333');
|
||||
|
||||
Reference in new issue
Block a user