Refactor project and contract forms for improved UI and functionality

- Updated NewProjectPage to use PageContainer and PageHeader for better layout.
- Enhanced ProjectListPage to display project data in a responsive table format.
- Refactored ContractForm to use Card components and improved loading state handling.
- Refactored ProjectForm to use Card components, added loading state, and improved form structure and styling.
This commit is contained in:
Chop
2025-06-19 18:59:03 +02:00
parent 85f18825ad
commit 0acb203ef8
8 changed files with 1465 additions and 523 deletions

View File

@@ -1,4 +1,8 @@
import ProjectForm from "@/components/ProjectForm";
import PageContainer from "@/components/ui/PageContainer";
import PageHeader from "@/components/ui/PageHeader";
import Button from "@/components/ui/Button";
import Link from "next/link";
export default async function EditProjectPage({ params }) {
const { id } = await params;
@@ -7,10 +11,68 @@ export default async function EditProjectPage({ params }) {
});
const project = await res.json();
if (!project) {
return (
<PageContainer>
<div className="text-center py-12">
<p className="text-red-600 text-lg mb-4">Project not found.</p>
<Link href="/projects">
<Button variant="primary">Back to Projects</Button>
</Link>
</div>
</PageContainer>
);
}
return (
<div className="p-4 max-w-2xl mx-auto">
<h1 className="text-xl font-bold mb-4">Edit Project</h1>
<ProjectForm initialData={project} />
</div>
<PageContainer>
<PageHeader
title="Edit Project"
description={`Editing: ${project.project_name || "Untitled Project"}`}
action={
<div className="flex items-center gap-3">
<Link href={`/projects/${id}`}>
<Button variant="outline" size="sm">
<svg
className="w-4 h-4 mr-2"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M6 18L18 6M6 6l12 12"
/>
</svg>
Cancel
</Button>
</Link>
<Link href="/projects">
<Button variant="outline" size="sm">
<svg
className="w-4 h-4 mr-2"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M15 19l-7-7 7-7"
/>
</svg>
Back to Projects
</Button>
</Link>
</div>
}
/>
<div className="max-w-2xl">
<ProjectForm initialData={project} />
</div>
</PageContainer>
);
}