mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 11:06:29 +00:00
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:
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -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"
|
||||
)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user