mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 12:16:28 +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:
@@ -0,0 +1,41 @@
|
||||
"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} />;
|
||||
}
|
||||
Reference in New Issue
Block a user