Commit 566f6ed
refactor(tasks): extract taskTypeLabel utility and deduplicate triage/dashboard mappings (#85)
* fix(dashboard): translate task.taskType in Triage Tasks panel
The dashboard's "Triage Tasks" panel was rendering raw enum values
(URGENT_REVIEW, CLARIFY_SYMPTOMS, ASK_FOR_POSTCODE, ASK_HORSE_COUNT,
MANUAL_CLASSIFICATION) where the triage page itself maps them through
i18n via taskTypeLabel + t().
Mirrors the pattern at app/[locale]/triage/page.tsx:184–193 and 321:
- Adds useTranslations('triage') as tTriage.
- Adds the same taskTypeLabel(taskType) mapping.
- Replaces {task.taskType} with {tTriage(taskTypeLabel(task.taskType))}.
All five enum values are already keyed in messages/{en,fr}.json under
the triage namespace (urgentReview, askPostcode, askHorseCount,
clarifySymptoms, manualClassification). Fallback returns the raw
value if the map ever drifts out of sync.
Closes Finding 7 of docs/UAT_v1_1_TRIAGE_round2.md.
https://claude.ai/code/session_01PF4MU4P4Ytt9UcuVsbAzT5
* refactor: extract taskTypeLabel into shared utility
Both dashboard and triage pages had an identical taskTypeLabel mapping
copy-pasted between them. Move it to lib/utils/task-type-label.ts so
future enum or translation key changes only need to be made in one
place.
* Update lib/utils/task-type-label.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix(task-type-label): return null for unknown types and add unit tests
Agent-Logs-Url: https://github.com/RJK134/EquiSmile/sessions/9ea8e98d-e479-4ece-9130-11de6f3585a3
Co-authored-by: RJK134 <167345619+RJK134@users.noreply.github.com>
* refactor(task-type-label): avoid double lookup in map callbacks
Agent-Logs-Url: https://github.com/RJK134/EquiSmile/sessions/9ea8e98d-e479-4ece-9130-11de6f3585a3
Co-authored-by: RJK134 <167345619+RJK134@users.noreply.github.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>1 parent 4e08c8e commit 566f6ed
1 file changed
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments