mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 10:56:28 +00:00
ffcf3c6e58
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.
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
"use client";
|
|
|
|
import { Card } from '@/components/ui/card';
|
|
import { BookOpenCheck } from 'lucide-react';
|
|
import { useSearchParams } from 'next/navigation';
|
|
import { IProjectAssignment } from '../../type.assignment';
|
|
import AssignmentGrid from './AssignmentGrid';
|
|
import AssignmentList from './AssignmentList';
|
|
|
|
interface AssignmentTableProps {
|
|
data: IProjectAssignment[];
|
|
initialLayout?: 'grid' | 'list';
|
|
}
|
|
|
|
export default function AssignmentTable({
|
|
data,
|
|
initialLayout = 'grid',
|
|
}: AssignmentTableProps) {
|
|
const searchParams = useSearchParams();
|
|
const layout = searchParams?.get('layout') === 'list' ? 'list' : initialLayout;
|
|
|
|
if (data.length === 0) {
|
|
return (
|
|
<Card className="py-12 text-center border-2 border-dashed rounded-xl">
|
|
<BookOpenCheck className="w-12 h-12 mx-auto text-muted-foreground opacity-20" />
|
|
<div className="text-center">
|
|
<h3 className="text-xl font-semibold">No Project Assignment Found</h3>
|
|
<p className="text-muted-foreground max-w-sm mx-auto mt-2">
|
|
Try to change the filter or create one to get started.
|
|
</p>
|
|
</div>
|
|
</Card>
|
|
);
|
|
}
|
|
|
|
if (layout === 'list') {
|
|
return <AssignmentList assignments={data} />;
|
|
}
|
|
|
|
return <AssignmentGrid assignments={data} />;
|
|
} |