Refactor task views with layout toggles

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.
This commit is contained in:
Ichsan Kurniawan
2026-10-01 18:32:56 +07:00
parent f9829de388
commit ffcf3c6e58
21 changed files with 1442 additions and 784 deletions
+37 -9
View File
@@ -1,9 +1,37 @@
import { Badge, STATUS_BADGE_MAP } from "@/components/ui/badge"
export default function BadgeStatus({ status, className }: { status: string, className?: string }) { // e.g. status = "UAT"
return (
<Badge variant={STATUS_BADGE_MAP[status ? status?.toLowerCase() : ''] || "default"} className={className}>
{status}
</Badge>
)
}
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>
);
}
+12 -1
View File
@@ -3,7 +3,17 @@
import { cn } from "@/lib/utils";
import { useState, useRef, useEffect } from "react";
export function LazyImage({ src, alt, className }: { src: string; alt: string; className?: string }) {
export function LazyImage({
src,
alt,
className,
imgClassName,
}: {
src: string;
alt: string;
className?: string;
imgClassName?: string;
}) {
const [isLoaded, setIsLoaded] = useState(false);
const imgRef = useRef<HTMLImageElement>(null);
@@ -25,6 +35,7 @@ export function LazyImage({ src, alt, className }: { src: string; alt: string; c
onLoad={() => setIsLoaded(true)}
className={cn(
"w-full h-full object-cover transition-all duration-700 ease-in-out",
imgClassName,
isLoaded ? "blur-0 scale-100 opacity-100" : "blur-xl scale-110 opacity-0"
)}
/>