mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Normalize status keys to uppercase in status utilities
This commit is contained in:
@@ -38,37 +38,26 @@ import { Color } from '@/types/theme';
|
||||
// ===== STATUS BADGE UTILITIES =====
|
||||
const statusTextMap: Record<string, string> = {
|
||||
APPROVED: 'Disetujui',
|
||||
Disetujui: 'Disetujui',
|
||||
REJECTED: 'Ditolak',
|
||||
Ditolak: 'Ditolak',
|
||||
CREATED: 'Pengajuan',
|
||||
Pengajuan: 'Pengajuan',
|
||||
UPDATED: 'Diperbarui',
|
||||
};
|
||||
|
||||
const getStatusText = (status: string): string => {
|
||||
return statusTextMap[status] || status;
|
||||
const normalizedStatus = status.toUpperCase();
|
||||
return statusTextMap[normalizedStatus] || status;
|
||||
};
|
||||
|
||||
const statusBadgeColorMap: Record<string, Color> = {
|
||||
APPROVED: 'success',
|
||||
Disetujui: 'success',
|
||||
approved: 'success',
|
||||
disetujui: 'success',
|
||||
REJECTED: 'error',
|
||||
Ditolak: 'error',
|
||||
rejected: 'error',
|
||||
ditolak: 'error',
|
||||
CREATED: 'neutral',
|
||||
Pengajuan: 'neutral',
|
||||
created: 'neutral',
|
||||
pengajuan: 'neutral',
|
||||
UPDATED: 'warning',
|
||||
updated: 'warning',
|
||||
};
|
||||
|
||||
const getStatusBadgeColor = (status: string): Color => {
|
||||
return statusBadgeColorMap[status] || 'neutral';
|
||||
const normalizedStatus = status.toUpperCase();
|
||||
return statusBadgeColorMap[normalizedStatus] || 'neutral';
|
||||
};
|
||||
|
||||
const RowOptionsMenu = ({
|
||||
|
||||
Reference in New Issue
Block a user