refactor(badges): centralize status->BadgeVariant mapping per domain #264
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/MAPPS-268-centralize-status-badges"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Every page hand-rolled its own status_variant() / *_status_badge() copy (contract, asset, project, invoice, KB article, ticket) and the copies drifted: the portal invoice mapper knew
overdueand defaulted to Yellow while billing's defaulted to Gray and never handledoverdue; the contract mapper was duplicated verbatim across contracts.rs and contacts.rs. New server statuses fell back to silent Gray inconsistently per page.Introduce src/components/status_badge.rs as the single source per domain. Each helper returns (variant, humanized label) so both color and label live in one place; ticket_status_badge moves here unchanged (callers render the status verbatim). Pages now call the shared mappers and the duplicated humanize_*/status_variant/status_badge copies are deleted.
Add BadgeVariant::Orange so an overdue invoice reads distinctly from a written-off/void one (Red), satisfying the expand-coverage goal. Unknown statuses hit an explicit Gray fallback whose label is title-cased from the raw snake_case token rather than leaking
partially_refunded. Derive Debug on BadgeVariant for the new unit tests.#MAPPS-268
5baf6991f0a0b4a3a6ae