diff --git a/apps/convivo/src/screens/Home.tsx b/apps/convivo/src/screens/Home.tsx index 665094e..33605d6 100644 --- a/apps/convivo/src/screens/Home.tsx +++ b/apps/convivo/src/screens/Home.tsx @@ -26,8 +26,11 @@ function SessionBlock({ session, checkedIn }: { session: Session; checkedIn?: bo ); } -/** The list of concurrent sessions shown when the user has no pick for the slot. */ -function ConcurrentList({ sessions }: { sessions: Session[] }) { +/** The list of concurrent sessions shown when the user has no pick for the slot. + * The "No pick yet" nudge only makes sense for someone who has never picked; + * once the user has any pick it would contradict the "My picks today" list + * below, so it is hidden (hasPicks). */ +function ConcurrentList({ sessions, hasPicks }: { sessions: Session[]; hasPicks: boolean }) { return (
{sessions.map((s) => ( @@ -36,9 +39,11 @@ function ConcurrentList({ sessions }: { sessions: Session[] }) {
{s.room} · {s.speakers}
))} -
- No pick yet — tap a session in the Agenda to choose. -
+ {!hasPicks && ( +
+ No pick yet — tap a session in the Agenda to choose. +
+ )} ); } @@ -179,7 +184,7 @@ export function Home({ go, onEventFeedback, openFeedback }: { go: (tab: string) {nowPick ? ( ) : current.sessions.length > 0 ? ( - + 0} /> ) : (
Nothing scheduled right now.
)} @@ -196,7 +201,7 @@ export function Home({ go, onEventFeedback, openFeedback }: { go: (tab: string) {nextPick ? ( ) : next.sessions.length > 0 ? ( - + 0} /> ) : (
Nothing scheduled next.
)} diff --git a/docs/backend/tests.md b/docs/backend/tests.md index 7027ae2..5fff87b 100644 --- a/docs/backend/tests.md +++ b/docs/backend/tests.md @@ -194,6 +194,10 @@ CONVIVO_BASE_URL=http://127.0.0.1:3000 npm test --prefix e2e -- convivo-admin-en 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. +- **Pick nudge suppression** — with a pick on the *other* slot, the Now card's + concurrent list must **not** show "No pick yet — tap a session in the Agenda + to choose."; with no picks at all the nudge is still shown. Asserted per card + (`.now-card`), since Now and Next each render their own copy. # Session Persistence Regression diff --git a/docs/frontend/screens.md b/docs/frontend/screens.md index ecac883..01399d5 100644 --- a/docs/frontend/screens.md +++ b/docs/frontend/screens.md @@ -114,8 +114,13 @@ The landing screen. Shows: running** — one clean sub-section per concurrent session (title + room + speaker), so a slot with 1, 2, or 3 sessions renders 1, 2, or 3 sub-sections. If the slot has no sessions at all, a "Nothing scheduled right now." line. + Under the concurrent list a "No pick yet — tap a session in the Agenda to + choose." nudge appears **only while the user has no picks at all**; once they + have any pick it is hidden, because it would contradict the "My picks today" + list below. - **Next card** — **always shown** for the next slot (same pick / concurrent-list - logic as the Now card, without the check-in pill). + logic as the Now card, without the check-in pill, and with the same nudge + rule). - **My picks today** — one row per pick the user has made **today** (in slot order), each showing the slot time + session title + room. Tapping a row opens the **same session detail sheet the Agenda shows** (description, diff --git a/e2e/tests/convivo-admin-entry.spec.ts b/e2e/tests/convivo-admin-entry.spec.ts index c303705..26f919b 100644 --- a/e2e/tests/convivo-admin-entry.spec.ts +++ b/e2e/tests/convivo-admin-entry.spec.ts @@ -134,6 +134,47 @@ test.describe('Home session picks', () => { await expect(page.locator('.sheet')).toHaveCount(0); await expect(page.getByTestId('home-pick')).toHaveCount(1); }); + + // The Now/Next card lists concurrent sessions when the user has no pick for + // that specific slot. Its "No pick yet" nudge must disappear once the user + // has any pick at all — otherwise it contradicts the "My picks today" list + // shown right below it (the reported bug). + const nowNextRows = [ + { 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: 'Now Talk', room: 'Room A', speakers: 'Ada Lovelace' }, + { 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: 'Next Talk', room: 'Room B', speakers: 'Grace Hopper' }, + ].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 })); + + test('hides the "No pick yet" nudge once the user has any pick', async ({ page }) => { + const { session } = await mockApi(page, { + registered: true, checkedIn: true, + picks: [{ slot_id: 2, session_id: 'session-2' }], + }); + await page.route('**/rest/v1/rpc/get_agenda', route => route.fulfill({ json: nowNextRows })); + 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/); + // The pick lives on the Next slot, so the Now card falls back to the + // concurrent-session list — and must not nag about having no pick. + await expect(page.getByTestId('home-pick')).toHaveCount(1); + await expect(page.locator('.now-card')).toContainText('Now Talk'); + await expect(page.getByText('No pick yet — tap a session in the Agenda to choose.')).toHaveCount(0); + }); + + test('still shows the "No pick yet" nudge when the user has no picks', async ({ page }) => { + const { session } = await mockApi(page, { registered: true, checkedIn: true }); + await page.route('**/rest/v1/rpc/get_agenda', route => route.fulfill({ json: nowNextRows })); + 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/); + await expect(page.getByTestId('home-pick')).toHaveCount(0); + await expect(page.locator('.now-card')).toContainText('Now Talk'); + // Both the Now and the Next card fall back to the concurrent list, so the + // nudge is asserted per card rather than page-wide. + await expect(page.locator('.now-card').getByText('No pick yet — tap a session in the Agenda to choose.')).toBeVisible(); + }); }); test.describe('Event demo clock', () => {