Repository navigation
Open
Labels
feature: Design systemRelated to design patterns and componentsmilestone: missingrole: Front Endsize: 3ptCan be done in 13-18 hours
Description
Trillium Firstmate 🤖
Overview
The admin reports page uses a second date library, react-datepicker, with its own CSS. This optional follow-up replaces it with a shared day-level date picker built on the same popover pattern as the month/year picker, so the app has one date input style.
Dependencies
- UI kit: month/year picker (popover grid) to replace the MUI X DatePicker #2272
- Migrate the admin dashboard and reports to Tailwind #2284
Action Items
Run yarn commands from client/, and commit client/package.json and client/yarn.lock together.
- Read how the two pickers are used in
client/src/components/admin/reports/index.jsx(lines ~3, 171, 184): which dates they set, any limits, and the date format shown. - Create
client/src/components/ui/date-picker.tsx: an input-style button that opens a popover with a month calendar (previous/next month, day grid, today highlight, selected day). Reuse the popover and styling ofMonthYearPicker. Supportvalue,onChange,minDate,maxDate,disabled,error. Usedate-fnsfor date math and formatting. - Keyboard: arrow keys move by day and week, Page Up/Down by month, Home/End to start/end of week, Enter selects, Escape closes.
- Replace both
DatePickeruses in the reports page, keep the same data sent to the request, and deleteclient/src/common/datepicker/index.scss. - Remove
react-datepickerfromclient/package.json. - Colocated tests (open/close, select a day, min/max, keyboard) and a catalogue entry.
Acceptance Criteria
- The component lives in
client/src/components/ui/as a.tsxfile, with typed props that passyarn typecheck(strict mode). - Styling uses Tailwind classes only. Variants (if any) are declared with
cva, andclassNameis merged withcn()so callers can override. - The component does not import anything from
@mui/*or@emotion/*. - A test file next to the component (for example
button.test.tsx) covers: it renders, each variant/size, the disabled and error states where they apply, and keyboard use where it applies (Tab, Enter/Space, Escape, arrow keys).yarn testpasses. - The reports page behaves the same: same default dates, same requests, same format.
-
git grep react-datepickerfinds nothing inclient/. - Before/after screenshots of the reports page, with the picker open.
Resources/Instructions
- Current uses:
client/src/components/admin/reports/index.jsx, styles inclient/src/common/datepicker/index.scss. - Date handling in the app today mixes
momentanddate-fns; this ticket only usesdate-fnsfor new code.
Additional Notes
- Optional: the main goal (no MUI) does not need this. It is worth doing for one date style and about 96 kB less JavaScript (from an earlier measurement), but it can be skipped or postponed.
- Decision needed: build vs adopt. Proposed default: build on the existing popover pattern. A small calendar library such as
react-day-pickeris an acceptable alternative; if chosen, wrap it in the sameui/date-picker.tsxAPI.
Metadata
Metadata
Assignees
Labels
feature: Design systemRelated to design patterns and componentsmilestone: missingrole: Front Endsize: 3ptCan be done in 13-18 hours
Type
Projects
- StatusShow more project fieldsNew Issue Approval
Activity