Skip to content

web: Dashboard Lay Rate range switcher (7/15/30 days and a custom range) that collapses long ranges to weeks #914

Closed

Description

@mforce

Amendment (2026-09-23, owner): this issue is split. #940 ships presets of
7 and 14 days with custom ranges capped at 14 and one bar per day; the 30-day
preset, longer custom ranges and the weekly collapse move to #941. See
the amendment comment.

Component plan: build this from the components named in docs/designs/822-mui-revamp.md. The rule is "reused, never rebuilt" — composing MUI primitives into a screen wrapper is expected; reimplementing behaviour a shared component already has is not. Say in the PR which row of that table covers this screen.

Slice of #674, Phase 3 follow-up to #906/#912. Owner request, 2026-09-19.

What

The Dashboard's Lay Rate card is fixed at the last 14 days. Add a range switcher:

  • Presets: Last 7 days, Last 15 days, Last 30 days.
  • A custom range as two plain date fields (the same fields Daily Entry uses), no new dependency. The MUI date range picker is a separate, paid package and is out of scope unless the owner decides otherwise.
  • The hen-day KPI compares the chosen window against the window of the same length before it, and its subtitle says so in all three locales ("last 7 days against the 7 before" becomes dynamic).
  • The choice is remembered per device (local storage) so the Dashboard does not reset on every visit.

Hard constraint: the strip must stay readable

The owner's concern is that a long range makes the graph too big to display. The day strip renders one slot per day; #912 settles 22px slots on phones for 14 days (owner decision, option C). So:

  • Beyond 14 days on a phone, and beyond what the card width can hold at 22px per day on desktop, bars collapse to one bar per week (7-day buckets, the last bucket may be short and is labelled as such). The tooltip and accessible name of a week bar carry the week's dates and totals.
  • A custom range longer than 90 days is rejected in the form with a message, not silently truncated.
  • No horizontal scroll inside the card; no change to the 44px width exception recorded on feat(dashboard): redesign the Operations Desk and show order grade names #912.

Already there

The production report endpoint takes optional from/to (see the Production handler in ReportEndpoints.cs), so the presets and the custom range need no backend change. The Dashboard already fetches two windows and joins them (Dashboard.tsx, the two getProductionReport calls); dayStrip in web/src/lib/dashboard.ts takes any number of days.

Must survive

Missing, partial and complete day states and their hatching; the one-tab-stop arrow-key strip (#654/#777/#780); the reserved readout row; farm-local dates; independent panel degradation; the Playwright dashboard specs; three locales.

Deliverables

  • Unit tests for the window arithmetic (preset to from/to, previous window, week bucketing including a short last bucket) with literal expected values.
  • Help page and glossary updated in the same PR.
  • Captures per AGENTS.md at 1280 and 390, light and dark, at 7, 30 and a custom 60-day range.

Sequenced after #912 merges.

Activity

  1. added this to the SPA revamp milestone on Sep 19, 2026
  2. added
    enhancementNew feature or request
    epic-674SPA revamp — field-first phone, ledger desktop (#674)
    on Sep 19, 2026
  3. mforce commented on Sep 23, 2026

    @mforce
    OwnerAuthor

    Amendment — what #940 ships, and what moved to #941

    Owner decision, 2026-09-23. This issue's scope is split; the body above stays
    as written for history.

    Shipping in #940 (this issue's close-out):

    • A Range control on the Lay rate card offering the last 7 or 14
      finished days, or a Custom range… of two plain date fields with
      Apply.
    • Custom ranges are capped at 14 days. A longer one is refused in the form
      with a translated message in en, es and tl, never silently shortened.
    • The card draws one bar per day at every setting, with the week hairline
      at each seven-day boundary.
    • The hen-day figure compares the chosen window against the window of the same
      length before it, both fetched in one request and split client-side.
    • The choice is remembered per device and per farm, and a remembered window
      this build can no longer draw falls back to the default.
    • Help, the in-app glossary and specs/product/GLOSSARY.md updated in all
      three locales.

    Moved to #941 (not built here):

    • The Last 30 days preset.
    • Custom ranges longer than 14 days, up to the 90-day cap this issue proposed.
    • The week bucketing this issue specified for long windows — one bar per
      7-day bucket with a possibly-short last bucket, and the readout wording that
      went with it. It was built, reviewed and then deleted rather than left
      unreachable behind a 14-day cap, so web: expand the Lay rate chart into a centred overview + scrollable daily view for ranges beyond 14 days #941 starts from a clean slate and can
      choose its own display.
    • The expanded, centred dark view that would carry a long range.

    Acceptance criteria this issue states that #940 deliberately does not meet:
    the Last 15 days and Last 30 days presets, the 90-day custom cap, and the
    weekly collapse. Those are #941's, not abandoned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestepic-674SPA revamp — field-first phone, ledger desktop (#674)phase:3-screensScreen conversions

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions