Repository navigation
feat(display): add page indicator and timer bar - #1530
Conversation
Render a multi-page indicator with page fraction, dots, and overflow count alongside a 10-second page-switch progress timer bar in the customer display board header when orders span multiple pages. Fixes #1527
…ify documentation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
ⓘ Your Qodo trial ends soon. Ask your workspace admin to set up billing to keep reviews running after the trial. Manage billing |
PR Summary by QodoAdd page indicators and rotation timers to customer display
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1. Busy displays can hide order rows
|
Fixes #1527
Intent
On
/customer-display/, since we have a rolling window of orders when there are more orders than fit on a single screen, add a clear visual indication that there are more orders (and which page is shown), plus a timer bar to indicate when the screen will switch to the next page of orders.What Changed
1 / Nbadge,+countoverflow pill, and active/inactive page dots) and a 10-second linear progress timer bar inOrderBoardSectionheaders on/customer-displaywhen a column spans multiple measured pages at desktop widths (>= 768px).OrderBoardPageand partition active and pending newly ready priority pages after ordinary pages so the indicator index, page dots, and timer bar remain synchronized across 10-second page switches, order pruning, and visibility changes.Risk Assessment
✅ Low: The multi-page indicator, overflow badge, and 10-second progress bar are cleanly scoped to multi-page customer display columns, with timer resets and priority page indices kept in sync across poll updates and rotations.
Testing
Installed workspace dependencies, fixed the mock React useCallback hook in tests/auth-ui-deterministic.test.ts so callback identity is preserved across renders when dependencies do not change, ran npm run test:auth-ui-deterministic, built the backend and static frontend, stood up an isolated e2e-server instance on ports 13001-13003, drove all 12 customer-display Playwright E2E tests in frontend/e2e/layout-integrity.spec.ts (including expanded assertions for priority interleaving indicators, hidden-tab timer unmounting/resumption, and narrow-viewport indicator omission), and captured four reviewer-visible screenshots in the evidence directory; all scenarios and tests passed.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed ✅
frontend/src/app/customer-display/page.tsx:466-customer-display-page-timer-bar(key={activePageKey}atfrontend/src/app/customer-display/page.tsx:466,569) and the 10-second rotationwindow.setInterval(frontend/src/app/customer-display/page.tsx:451-458) get out of sync when a poll updates orders mid-interval:retainedIds.length > 0 && orderIdsFit(...)atfrontend/src/app/customer-display/page.tsx:405-413),updateActivePage({ ...active, orderIds: retainedIds })mutatesactivePage.orderIdsin place to keep the current page on screen. BecauseactivePageKey(frontend/src/app/customer-display/page.tsx:466) hashesactivePage.orderIds,customer-display-page-timer-bar(frontend/src/app/customer-display/page.tsx:569) remounts and restarts its 10s animation from 0%, while thesetIntervaleffect (frontend/src/app/customer-display/page.tsx:451-458) does not reset and rotates pages when the remainder of the original 10s expires.retainedIds.length === 0atfrontend/src/app/customer-display/page.tsx:434) or a resize reflows the active page (frontend/src/app/customer-display/page.tsx:415-432), the layout effect immediately switchesactivePageto a new page and restarts the timer bar animation, butwindow.setInterval(frontend/src/app/customer-display/page.tsx:451-458) does not depend on page switches and fires on its old schedule, rotating away from the newly shown page before its 10s timer bar finishes.Track page-rotation transitions explicitly (advancing on actual page switches, not on in-place
retainedIdsfiltering) and key both the timer bar and thesetIntervaleffect off that transition token.frontend/src/app/customer-display/page.tsx:223- In the Ready column (isReady === true),allPages(frontend/src/app/customer-display/page.tsx:223-232),totalPages(line 465),activePageIndex(lines 467-483), and the page dots (lines 536-554) compute shifting/wrong page numbers when newly ready orders arrive on a poll:[1..5]and[6]at 5 per page, currently showing page 1[1..5], and order7arrives innewlyReadyOrderIds),priorityPagesbecomes[[7]]andordinaryPagesis[[1..5], [6]]. PrependingpriorityPagestoallPages(lines 223-232) whileactivePagestays on[1..5]until the 10s rotation causes the header indicator on the unchanged first page to jump immediately on poll arrival from1 / 2to2 / 3(and activates the second dot).selectNextPageatfrontend/src/app/customer-display/page.tsx:291-294, or the layout effect atlines 421-424),priorityCallbackRef.current(orderIds)(markPriorityOrdersShownatlines 855-858) immediately removes thoseorderIdsfromnewlyReadyOrderIds. On the resulting render whileactivePage = { orderIds: ['7'], group: 'priority' }is displayed,'7'is no longer inpriorityOrders(sopriorityPagesis empty andallPagesreverts tocombinedPages = [[1..5], [6, 7]]),exactMatch(lines 470-474) misses because no entry inallPageshasgroup === 'priority', andbyFirstOrder(lines 475-481) resolves'7'tocombinedPages[1](2 / 2), followed by2 / 2again on the next rotation when[6, 7]is shown.Keep the active priority page's orders in the priority partition for as long as
activePage.group === 'priority', or deriveallPages/activePageIndexso unshown pending priority orders do not shift the active ordinary page's index before rotation and the displayed priority page does not lose its priority partition the moment it becomes active.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
npm run test:auth-ui-deterministiccd frontend && E2E_BASE_URL=http://127.0.0.1:13001 E2E_KDS_BASE_URL=http://127.0.0.1:13002 E2E_SERVER_APP_BASE_URL=http://127.0.0.1:13003 CI=true npx playwright test e2e/layout-integrity.spec.ts -g "customer display wraps full receipt numbers and pages on TV" --project=chromium --retries=0cd frontend && E2E_BASE_URL=http://127.0.0.1:13001 E2E_KDS_BASE_URL=http://127.0.0.1:13002 E2E_SERVER_APP_BASE_URL=http://127.0.0.1:13003 CI=true npx playwright test e2e/layout-integrity.spec.ts -g "each column pages independently|polling keeps the ten-second page interval|rotation pauses while the page is hidden|a narrow viewport keeps all rows" --project=chromium --retries=0✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.