wacrm/src/lib/template-status.ts
Arnas Donauskas 43b842efb6
fix(theme): keep status-badge token contract green (CI test)
The sweep over-tokenized the neutral status badges in the three status
data modules to bg-muted/border-border, which broke
broadcast-status.test.ts ("each variant has the dark-theme class
triple") — it asserts every badge is bg-*/10 + text-* + border-*/20.

The badge system intentionally uses fixed palette colors at low opacity
(translucent fills are mode-tolerant). Restore the original slate fills
(so dark is identical and the triple contract holds) but keep
text-muted-foreground for the label, so neutral statuses stay legible in
light mode where a solid slate-400 would be too faint on white.

- broadcast-status: draft / recipient pending
- template-status: DRAFT / PENDING_DELETION
- trigger-meta: time_based / fallback

All 400 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 13:08:32 +03:00

54 lines
1.4 KiB
TypeScript

/**
* Shared display config for message_templates.status.
*
* The DB stores Meta's raw enum (DRAFT / APPROVED / PENDING / REJECTED /
* PAUSED / DISABLED / IN_APPEAL / PENDING_DELETION) — the UI maps it to
* a human label + dark-theme badge classes here so the template manager,
* inbox picker, and broadcast picker stay aligned.
*/
import type { MessageTemplateStatus } from '@/types';
export interface TemplateStatusDisplay {
label: string;
classes: string;
}
export const templateStatusConfig: Record<
MessageTemplateStatus,
TemplateStatusDisplay
> = {
DRAFT: {
label: 'Draft',
classes: 'bg-slate-600/20 text-muted-foreground border-slate-600/30',
},
PENDING: {
label: 'Pending',
classes: 'bg-yellow-600/20 text-yellow-400 border-yellow-600/30',
},
APPROVED: {
label: 'Approved',
classes: 'bg-primary/20 text-primary border-primary/30',
},
REJECTED: {
label: 'Rejected',
classes: 'bg-red-600/20 text-red-400 border-red-600/30',
},
PAUSED: {
label: 'Paused',
classes: 'bg-orange-600/20 text-orange-400 border-orange-600/30',
},
DISABLED: {
label: 'Disabled',
classes: 'bg-red-900/30 text-red-500 border-red-900/40',
},
IN_APPEAL: {
label: 'In Appeal',
classes: 'bg-blue-600/20 text-blue-400 border-blue-600/30',
},
PENDING_DELETION: {
label: 'Pending Deletion',
classes: 'bg-slate-700/30 text-muted-foreground border-slate-700/40',
},
};