Add client & assignment detail UI; update dev env

Introduce client and assignment detail pages and client-side components for the Task dashboard. Adds interactive ClientDetailComponent, AssignmentDetailComponent, page entries (server + dummy variants), project-assignment form, various UI components (AssignmentTable, ClientGrid, ManageEmployee, FormUpdateStatus, ConfirmDelete, LazyImage helper), types and a dummy data hook. Update app/(dashboard)/task/page.tsx to use the new components. Update .env.development to point to dev API endpoints, bump NEXT_PUBLIC_APP_VERSION to v1.2.0 and add NEXT_PUBLIC_S3_IMAGE_URL.
This commit is contained in:
Ichsan Kurniawan
2026-04-16 22:38:26 +07:00
parent fb2d746fc0
commit 78f48d783f
25 changed files with 4586 additions and 88 deletions
+63
View File
@@ -0,0 +1,63 @@
import { useState } from "react";
import { toast } from "sonner";
import {
AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle
} from "@/components/ui/alert-dialog"
import { Button } from "@/components/ui/button";
import { Loader2 } from "lucide-react";
import { serverApiCall } from "@/lib/server-api";
interface Props {
endpoint?: string
onSuccess?: () => void;
onCancel?: () => void;
title?: string
description?: string,
method?: any
}
export function ConfirmDelete({ endpoint, title, description, onSuccess, onCancel, method }: Props) {
const [isLoading, setIsLoading] = useState(false);
const handleDelete = async () => {
setIsLoading(true)
const toastId = toast.loading('Deleting data...');
try {
const res = await serverApiCall(method || 'DELETE', endpoint!)
if (res.success) {
toast.success("Data deleted successfully ☺️", { id: toastId });
onSuccess!()
} else {
toast.error("Oops sorry, error has occurred 😢", {
description: `(${res.code}) ${res.message || "An unexpected error occurred while saving data. Please try again later."}`,
id: toastId
})
}
} catch (error: any) {
toast.error(error.message, { id: toastId })
} finally {
setIsLoading(false)
}
}
return (
<AlertDialog open={true}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{title || 'Are you absolutely sure?'}</AlertDialogTitle>
<AlertDialogDescription>
{description || "This action cannot be undone. This will permanently delete this data and remove our servers."}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel onClick={onCancel}>Cancel</AlertDialogCancel>
<Button onClick={handleDelete} disabled={isLoading} variant='destructive'>
{isLoading && <Loader2 className="animate-spin" />}
{isLoading ? "Deleting..." : "Continue"}
</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)
}