feat: add ability to filter master data table by sex and date of birth#1275
Conversation
WalkthroughA new client-side filtering UI is added to the data hub. A Filters component provides dropdown controls for sex and date-of-birth filtering, while MasterDataTable columns are updated with filter functions and renderers to support these filters. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~23 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/web/src/routes/_app/datahub/index.tsx`:
- Around line 107-123: Replace the hardcoded "Min:" and "Max:" span labels with
calls to the app's translation function used in this file (e.g., t('...') or
i18n.t('...')) so they render localized strings; update both span elements near
the Date input (the spans just before the inputs that reference dobFilter and
dobColumn) to use translation keys like "datahub.dob.min" and "datahub.dob.max"
(or appropriate existing keys) and provide sensible fallback text if your
translation helper supports it.
🧹 Nitpick comments (1)
apps/web/src/routes/_app/datahub/index.tsx (1)
61-102: Optional: Extract repeated checkbox logic.The three sex filter checkbox handlers share identical logic. A helper function could reduce repetition.
Proposed refactor
const toggleSexFilter = (value: null | Sex) => (checked: boolean) => { sexColumn.setFilterValue((prevValue: SexFilter): SexFilter => { return checked ? [...prevValue, value] : prevValue.filter((item) => item !== value); }); };Then use
onCheckedChange={toggleSexFilter('MALE')}, etc.
| <span className="pb-1">Min:</span> | ||
| <input | ||
| className="text-muted-foreground pointer-events-auto rounded-sm border-b pb-0.5" | ||
| type="date" | ||
| value={dobFilter.min ? toBasicISOString(dobFilter.min) : ''} | ||
| onChange={(event) => { | ||
| dobColumn.setFilterValue((prevValue: DateFilter): DateFilter => { | ||
| return { | ||
| ...prevValue, | ||
| min: event.target.valueAsDate | ||
| }; | ||
| }); | ||
| }} | ||
| /> | ||
| </div> | ||
| <div className="rounded-xs relative flex items-center justify-between gap-1 px-2 pb-1 pt-1.5 text-sm transition-colors"> | ||
| <span className="pb-1">Max:</span> |
There was a problem hiding this comment.
Untranslated labels: "Min:" and "Max:"
These labels should use the translation function for consistency with the rest of the UI.
Proposed fix
- <span className="pb-1">Min:</span>
+ <span className="pb-1">{t({ en: 'Min:', fr: 'Min :' })}</span>- <span className="pb-1">Max:</span>
+ <span className="pb-1">{t({ en: 'Max:', fr: 'Max :' })}</span>🤖 Prompt for AI Agents
In `@apps/web/src/routes/_app/datahub/index.tsx` around lines 107 - 123, Replace
the hardcoded "Min:" and "Max:" span labels with calls to the app's translation
function used in this file (e.g., t('...') or i18n.t('...')) so they render
localized strings; update both span elements near the Date input (the spans just
before the inputs that reference dobFilter and dobColumn) to use translation
keys like "datahub.dob.min" and "datahub.dob.max" (or appropriate existing keys)
and provide sensible fallback text if your translation helper supports it.
Summary by CodeRabbit