Skip to content

feat(display): add page indicator and timer bar - #1530

Merged
khaira777 merged 5 commits into
mainfrom
fm/flocafe-customer-display-page-indicator-and-timer
Nov 8, 2026
Merged

khaira777 merged 5 commits into
mainfrom
fm/flocafe-customer-display-page-indicator-and-timer

Conversation

@khaira777

@khaira777 khaira777 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Render a multi-page indicator (1 / N badge, +count overflow pill, and active/inactive page dots) and a 10-second linear progress timer bar in OrderBoardSection headers on /customer-display when a column spans multiple measured pages at desktop widths (>= 768px).
  • Track page rotation cycles on OrderBoardPage and 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.
  • Update frontend architecture docs and add unit and Playwright E2E coverage for the customer display page indicator, overflow count, priority page ordering, and timer bar behavior.

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.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Viewing /customer-display on a desktop/TV viewport shows the page fraction (1 / N), page dots, +count overflow pill, and 10-second timer bar on a multi-page column while omitting them on a single-page… ✅ pass live Customer display page 1 indicator (+24 overflow, 1 / 5, active dot 1, and 10s timer bar) vs single-page Ready column
Advancing the 10-second page rotation interval on /customer-display switches the multi-page column to page 2, updates the page indicator to 2 / N and the active page dot, and restarts the timer bar an… ✅ pass live Customer display after 10s rotation to page 2 (2 / 5, active dot 2, +24 overflow, and restarted 10s timer bar)
Receiving a newly ready order on a poll during a multi-page Ready cycle preserves the active ordinary page indicator and timer until the 10-second interval expires, then rotates to the priority page a… ✅ pass live Customer display Ready column rotated to newly arrived priority order page (10 / 10, active dot 10, +50 overflow, and emerald timer bar)
Viewing /customer-display on a narrow mobile viewport (< 768px) or hiding the browser tab suppresses the multi-page indicator/timer bar on mobile and unmounts/pauses the timer bar while hidden until v… ✅ pass live Customer display on narrow 390x844 mobile viewport in single scrollable flow without page indicator or timer bar

Customer display page 1 indicator (+24 overflow, 1 / 5, active dot 1, and 10s timer bar) vs single-page Ready column
Customer display after 10s rotation to page 2 (2 / 5, active dot 2, +24 overflow, and restarted 10s timer bar)
Customer display Ready column rotated to newly arrived priority order page (10 / 10, active dot 10, +50 overflow, and emerald timer bar)
Customer display on narrow 390x844 mobile viewport in single scrollable flow without page indicator or timer bar

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} at frontend/src/app/customer-display/page.tsx:466,569) and the 10-second rotation window.setInterval (frontend/src/app/customer-display/page.tsx:451-458) get out of sync when a poll updates orders mid-interval:
  1. When an order on the currently visible page completes on a poll while other orders on that page remain (retainedIds.length &gt; 0 &amp;&amp; orderIdsFit(...) at frontend/src/app/customer-display/page.tsx:405-413), updateActivePage({ ...active, orderIds: retainedIds }) mutates activePage.orderIds in place to keep the current page on screen. Because activePageKey (frontend/src/app/customer-display/page.tsx:466) hashes activePage.orderIds, customer-display-page-timer-bar (frontend/src/app/customer-display/page.tsx:569) remounts and restarts its 10s animation from 0%, while the setInterval effect (frontend/src/app/customer-display/page.tsx:451-458) does not reset and rotates pages when the remainder of the original 10s expires.
  2. Conversely, when all orders on the active page are removed on a poll (retainedIds.length === 0 at frontend/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 switches activePage to a new page and restarts the timer bar animation, but window.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 retainedIds filtering) and key both the timer bar and the setInterval effect 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. When a newly ready order arrives while an ordinary page is displayed (for example, 6 ready orders across 2 pages [1..5] and [6] at 5 per page, currently showing page 1 [1..5], and order 7 arrives in newlyReadyOrderIds), priorityPages becomes [[7]] and ordinaryPages is [[1..5], [6]]. Prepending priorityPages to allPages (lines 223-232) while activePage stays on [1..5] until the 10s rotation causes the header indicator on the unchanged first page to jump immediately on poll arrival from 1 / 2 to 2 / 3 (and activates the second dot).
  2. As soon as the 10s rotation selects that priority page (selectNextPage at frontend/src/app/customer-display/page.tsx:291-294, or the layout effect at lines 421-424), priorityCallbackRef.current(orderIds) (markPriorityOrdersShown at lines 855-858) immediately removes those orderIds from newlyReadyOrderIds. On the resulting render while activePage = { orderIds: [&#39;7&#39;], group: &#39;priority&#39; } is displayed, &#39;7&#39; is no longer in priorityOrders (so priorityPages is empty and allPages reverts to combinedPages = [[1..5], [6, 7]]), exactMatch (lines 470-474) misses because no entry in allPages has group === &#39;priority&#39;, and byFirstOrder (lines 475-481) resolves &#39;7&#39; to combinedPages[1] (2 / 2), followed by 2 / 2 again 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 === &#39;priority&#39;, or derive allPages / activePageIndex so 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.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Viewing /customer-display on a desktop/TV viewport shows the page fraction (1 / N), page dots, +count overflow pill, and 10-second timer bar on a multi-page column while omitting them on a single-page… ✅ pass live Customer display page 1 indicator (+24 overflow, 1 / 5, active dot 1, and 10s timer bar) vs single-page Ready column
Advancing the 10-second page rotation interval on /customer-display switches the multi-page column to page 2, updates the page indicator to 2 / N and the active page dot, and restarts the timer bar an… ✅ pass live Customer display after 10s rotation to page 2 (2 / 5, active dot 2, +24 overflow, and restarted 10s timer bar)
Receiving a newly ready order on a poll during a multi-page Ready cycle preserves the active ordinary page indicator and timer until the 10-second interval expires, then rotates to the priority page a… ✅ pass live Customer display Ready column rotated to newly arrived priority order page (10 / 10, active dot 10, +50 overflow, and emerald timer bar)
Viewing /customer-display on a narrow mobile viewport (< 768px) or hiding the browser tab suppresses the multi-page indicator/timer bar on mobile and unmounts/pauses the timer bar while hidden until v… ✅ pass live Customer display on narrow 390x844 mobile viewport in single scrollable flow without page indicator or timer bar
  • npm run test:auth-ui-deterministic
  • cd 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=0
  • cd 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.

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
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@qodo-code-review

Copy link
Copy Markdown

ⓘ Your Qodo trial ends soon. Ask your workspace admin to set up billing to keep reviews running after the trial. Manage billing

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add page indicators and rotation timers to customer display

✨ Enhancement 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Show page position, dots, and hidden-order counts for multi-page desktop columns.
• Synchronize a ten-second progress bar with rotation, priority orders, and visibility changes.
• Document the behavior and test pagination, timer resets, and responsive layouts.
Diagram

graph TD
  Feed["Order feed"] --> Measure["Measured rows"] --> Multi{"Multiple pages?"} -->|Yes| Pages["Page partitions"] --> Indicator["Header indicator"] --> Timer["Progress bar"]
  Pages --> Rotate["10s rotation"] --> Pages
  Rotate -.-> Indicator
  Rotate -.-> Timer
  Multi -->|No| Plain["Plain header"]
Loading
High-Level Assessment

Keep pagination and rotation state in OrderBoardSection, with a CSS animation restarted by the page cycle. This uses the existing measured-page logic and avoids a separate JavaScript countdown that would need its own synchronization.

Files changed (5) +854 / -39

Enhancement (2) +245 / -37
page.tsxAdd synchronized pagination UI to order columns +222/-37

Add synchronized pagination UI to order columns

• Tracks page cycles and separates ordinary, displayed-priority, and pending-priority pages so indicators follow the displayed orders. Renders desktop-only page cues and a progress bar, resetting the timer on page switches without resetting it for in-place order pruning.

frontend/src/app/customer-display/page.tsx

globals.cssAnimate the display page timer +23/-0

Animate the display page timer

• Adds a linear progress animation for the timer bar, with an RTL-aware transform origin.

frontend/src/app/globals.css

Tests (2) +606 / -1
layout-integrity.spec.tsCover display indicators across rotation and layouts +56/-0

Cover display indicators across rotation and layouts

• Adds Playwright assertions for page position, overflow, dots, and timer visibility. Also checks priority-page transitions, hidden-tab behavior, and omission at narrow widths.

frontend/e2e/layout-integrity.spec.ts

auth-ui-deterministic.test.tsTest pagination and timer state deterministically +550/-1

Test pagination and timer state deterministically

• Makes the mock useCallback preserve callback identity when dependencies are unchanged. Adds simulated board renders covering single- and multi-page indicators, rotation, poll-time pruning, timer resets, and priority-page indexing.

tests/auth-ui-deterministic.test.ts

Documentation (1) +3 / -1
frontend.mdDocument customer display pagination cues +3/-1

Document customer display pagination cues

• Describes the page fraction, dots, overflow count, and ten-second progress bar shown when a desktop column spans multiple pages.

docs/architecture/frontend.md

@khaira777 khaira777 changed the title feat(frontend): add customer display page indicator and timer bar feat(display): add page indicator and timer bar Nov 8, 2026
@qodo-code-review

qodo-code-review Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Busy displays can hide order rows 🐞 Bug ≡ Correctness
Description
OrderBoardSection renders a wrapping dot for every page without limiting the dot container's
height. With enough active orders, those rows enlarge the non-shrinking header and reduce the
measured list height, which creates still more pages and can leave the order list clipped.
Code

frontend/src/app/customer-display/page.tsx[R619-620]

+              <div className="flex max-w-44 flex-wrap items-center justify-end gap-1.5">
+                {allPages.map((entry, index) => {
Relevance

●● Moderate

No close precedent on customer-display header layout or unbounded indicator height. Related
pagination/layout suggestions were mixed, so this stays uncertain.

PR-#1164
PR-#1270

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new dot container wraps and maps every entry in allPages without a row or height limit. The
section header cannot shrink, while pagination measures the list's remaining clientHeight; the
desktop board and list hide overflow, so a sufficiently tall indicator takes space from order rows
rather than making them scrollable.

frontend/src/app/customer-display/page.tsx[619-638]
frontend/src/app/customer-display/page.tsx[575-580]
frontend/src/app/customer-display/page.tsx[381-407]
frontend/src/app/customer-display/page.tsx[664-668]
frontend/src/app/customer-display/page.tsx[1081-1088]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Rendering every page dot in a wrapping, unbounded header can consume the height reserved for order rows. Because pagination measures the remaining list height, the smaller list can generate even more dots.
## Fix Focus Areas
- frontend/src/app/customer-display/page.tsx[591-640]
- frontend/src/app/customer-display/page.tsx[381-407]
## Recommended Fix
Keep the indicator at a bounded height by showing a limited window of dots around the active page, while retaining the full page fraction and overflow count. Verify pagination at desktop widths with a large number of active orders.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Linked PRs:
  🌐 PR #39
✅ Compliance rules (platform): 5 rules
✅ Cross-repo context — repo relationships
✅ REVIEW.md
Review mode: Auto: ⚖️ Balanced: Intricate paging/priority state logic in one frontend component; not clearly extended-dense.

Grey Divider

Tip of the day
💡 Did you know, you can pick a display mode instead of tweaking every Display option by hand

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@khaira777
khaira777 merged commit 9d33d6c into main Nov 8, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/flocafe-customer-display-page-indicator-and-timer branch November 8, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(customer-display): add rolling page indicator, overflow count, and switch timer bar

1 participant