mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 11:06:29 +00:00
ffcf3c6e58
This commit reorganizes client and project-assignment screens into dedicated grid/list components, adds a shared layout toggle via the URL query string, and updates task pages to render the selected view consistently. It also moves shared client form logic into a client folder, improves status badge formatting, extends LazyImage with custom image classes, and updates the illustration assets and Lucide dependency used in the task UI.
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { Badge, STATUS_BADGE_MAP } from "@/components/ui/badge"
|
|
import { cn } from "@/lib/utils"
|
|
|
|
export function formatStatusText(status?: string): string {
|
|
if (!status) return "";
|
|
const trimmed = status.trim();
|
|
if (!trimmed) return "";
|
|
|
|
// Tetap UPPERCASE jika seluruh teks status hanya 3 huruf (SIT, UAT, PTR, dll) atau akronim BAST
|
|
const upperAcronyms = new Set(["SIT", "UAT", "PTR", "BAST", "POC", "WIP", "WO", "IM"]);
|
|
if (trimmed.length === 3 || upperAcronyms.has(trimmed.toUpperCase())) {
|
|
return trimmed.toUpperCase();
|
|
}
|
|
|
|
// Capitalize setiap kata untuk teks status lainnya
|
|
return trimmed
|
|
.split(/\s+/)
|
|
.map(word => {
|
|
if (!word) return "";
|
|
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
})
|
|
.join(" ");
|
|
}
|
|
|
|
export default function BadgeStatus({ status, className }: { status: string, className?: string }) { // e.g. status = "UAT"
|
|
const formatted = formatStatusText(status);
|
|
const lookupKey = (status || "").toLowerCase().trim();
|
|
|
|
return (
|
|
<Badge
|
|
variant={STATUS_BADGE_MAP[lookupKey] || "default"}
|
|
className={cn("text-[10px] font-semibold tracking-wide px-2 py-0.5", className)}
|
|
>
|
|
{formatted}
|
|
</Badge>
|
|
);
|
|
}
|