From dada6a542ff478e6a946f17f89c0f19d7663bdc5 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Thu, 29 Jan 2026 14:57:25 +0700 Subject: [PATCH] refactor(FE): Add badge color helpers for status and weight --- .../production/uniformity/uniformity-utils.ts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/components/pages/production/uniformity/uniformity-utils.ts b/src/components/pages/production/uniformity/uniformity-utils.ts index 340bb555..1b513de4 100644 --- a/src/components/pages/production/uniformity/uniformity-utils.ts +++ b/src/components/pages/production/uniformity/uniformity-utils.ts @@ -25,6 +25,20 @@ export const getWeightStatusText = (status: string): string => { return weightStatusTextMap[status] || status; }; +export const weightStatusBadgeColorMap: Record< + string, + 'success' | 'error' | 'neutral' | 'info' +> = { + ideal: 'success', + outside: 'error', +}; + +export const getWeightStatusBadgeColor = ( + status: string +): 'success' | 'error' | 'neutral' | 'info' => { + return weightStatusBadgeColorMap[status] || 'neutral'; +}; + export const statusColorMap: Record = { APPROVED: 'bg-[#00D39033]', Disetujui: 'bg-[#00D39033]', @@ -63,3 +77,29 @@ export const getStatusIndicatorColor = (status: string): string => { export const getStatusText = (status: string): string => { return statusTextMap[status] || status; }; + +export const statusBadgeColorMap: Record< + string, + 'success' | 'error' | 'neutral' | 'info' +> = { + APPROVED: 'success', + Disetujui: 'success', + approved: 'success', + disetujui: 'success', + REJECTED: 'error', + Ditolak: 'error', + rejected: 'error', + ditolak: 'error', + CREATED: 'neutral', + Pengajuan: 'neutral', + created: 'neutral', + pengajuan: 'neutral', + PENDING: 'neutral', + pending: 'neutral', +}; + +export const getStatusBadgeColor = ( + status: string +): 'success' | 'error' | 'neutral' | 'info' => { + return statusBadgeColorMap[status] || 'neutral'; +};