fix(home): hide the 'No pick yet' nudge once the user has any pick
The Now/Next cards fall back to a concurrent-session list when the user has no pick for that specific slot, and always appended a 'No pick yet — tap a session in the Agenda to choose.' hint. With picks on other slots this contradicted the 'My picks today' list right below (screenshot). ConcurrentList now takes hasPicks and renders the hint only while the user has no picks at all. e2e: two new 'Home session picks' cases (hint hidden with a pick on the other slot; still shown with none, asserted per card). 43/43 local. Docs: screens.md nudge rule, tests.md regression note. 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
25df5b3abc
commit
2aa2b894e4
4 files changed
+63
-8
No files matched your search
@@ -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 (
|
||||
<div className="now-list">
|
||||
{sessions.map((s) => (
|
||||
@@ -36,9 +39,11 @@ function ConcurrentList({ sessions }: { sessions: Session[] }) {
|
||||
<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>
|
||||
{!hasPicks && (
|
||||
<div className="muted small" style={{ marginTop: 10 }}>
|
||||
No pick yet — tap a session in the Agenda to choose.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -179,7 +184,7 @@ export function Home({ go, onEventFeedback, openFeedback }: { go: (tab: string)
|
||||
{nowPick ? (
|
||||
<SessionBlock session={nowPick} checkedIn={checkins.includes(nowPick.id)} />
|
||||
) : current.sessions.length > 0 ? (
|
||||
<ConcurrentList sessions={current.sessions} />
|
||||
<ConcurrentList sessions={current.sessions} hasPicks={picks.length > 0} />
|
||||
) : (
|
||||
<div className="muted small" style={{ marginTop: 10 }}>Nothing scheduled right now.</div>
|
||||
)}
|
||||
@@ -196,7 +201,7 @@ export function Home({ go, onEventFeedback, openFeedback }: { go: (tab: string)
|
||||
{nextPick ? (
|
||||
<SessionBlock session={nextPick} />
|
||||
) : next.sessions.length > 0 ? (
|
||||
<ConcurrentList sessions={next.sessions} />
|
||||
<ConcurrentList sessions={next.sessions} hasPicks={picks.length > 0} />
|
||||
) : (
|
||||
<div className="muted small" style={{ marginTop: 10 }}>Nothing scheduled next.</div>
|
||||
)}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
Reference in new issue
Block a user