251211:1622 Frontend: refactor Dashboard (not finish)
Some checks failed
Spec Validation / validate-markdown (push) Has been cancelled
Spec Validation / validate-diagrams (push) Has been cancelled
Spec Validation / check-todos (push) Has been cancelled

This commit is contained in:
admin
2025-12-11 16:22:50 +07:00
parent 3fa28bd14f
commit 2473c4c474
32 changed files with 1115 additions and 260 deletions

View File

@@ -0,0 +1,44 @@
"use client";
import { CorrespondenceForm } from "@/components/correspondences/form";
import { useCorrespondence } from "@/hooks/use-correspondence";
import { Loader2 } from "lucide-react";
import { useParams } from "next/navigation";
export default function EditCorrespondencePage() {
const params = useParams();
const id = Number(params?.id);
const { data: correspondence, isLoading, isError } = useCorrespondence(id);
if (isLoading) {
return (
<div className="flex bg-muted/20 min-h-screen justify-center items-center">
<Loader2 className="h-8 w-8 animate-spin" />
</div>
);
}
if (isError || !correspondence) {
return (
<div className="flex flex-col items-center justify-center min-h-screen">
<h1 className="text-xl font-bold text-red-500">Failed to load correspondence</h1>
</div>
);
}
return (
<div className="max-w-4xl mx-auto py-6">
<div className="mb-8">
<h1 className="text-3xl font-bold">Edit Correspondence</h1>
<p className="text-muted-foreground mt-1">
{correspondence.correspondenceNumber}
</p>
</div>
<div className="bg-card border rounded-lg p-6 shadow-sm">
<CorrespondenceForm initialData={correspondence} id={id} />
</div>
</div>
);
}