Files
hats-app/app/(dashboard)/task/component/HomeTask.tsx
T
Ichsan Kurniawan d3c4e21636 Simplify task dashboard to client view
This change removes the assignment-view toggle from the task dashboard and keeps the page focused on clients, while preserving layout selection behavior with an explicit grid/list state. It also updates the shared Manage Team and Timeline Status modals to use the Dialog component, fixes their close handling, and adds a # prefix to assignment codes for clearer labeling.
2026-10-07 18:25:46 +07:00

74 lines
3.2 KiB
TypeScript

"use client"
import { useState } from 'react';
import { useRouter } from 'next/navigation';
import { Plus } from 'lucide-react';
import { Button } from '@/components/ui/button';
import FormClient from './client/FormClient';
import FilterComponent from './FilterComponent';
// interface ShellProps {
// currentView: 'clients' | 'assignments';
// }
export default function HomeTask() {
const router = useRouter();
const [showForm, setShowForm] = useState(false);
// Update URL when Tabs change
// const handleTabChange = (view: string) => {
// const params = new URLSearchParams(searchParams!);
// params.set('view', view);
// params.delete('status');
// router.push(`${pathname}?${params.toString()}`);
// };
return (
<>
<div className="flex flex-col md:flex-row md:items-center justify-between gap-4">
<div>
<h1 className="text-lg sm:text-3xl font-medium tracking-tight capitalize">My Task & Projects</h1>
<p className="text-xs md:text-base text-muted-foreground w-full lg:w-1/2 xl:w-3/4 mt-2">
Something that can be done at any time is often done at no time.
</p>
</div>
<div className="flex flex-col sm:flex-row items-stretch sm:items-center gap-2.5 sm:gap-3 w-full md:w-auto">
{/* <Select value={currentView} onValueChange={handleTabChange}>
<SelectTrigger className="w-full sm:w-44 md:w-max bg-white dark:bg-zinc-900">
<SelectValue placeholder="Show by" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectLabel>Show by</SelectLabel>
<SelectItem value="clients">Clients</SelectItem>
<SelectItem value="assignments">Project Assignment</SelectItem>
</SelectGroup>
</SelectContent>
</Select> */}
<Button className="gap-2 w-full sm:w-auto shrink-0" onClick={() => setShowForm(true)}>
<Plus className="w-4 h-4" /> Add Client
</Button>
{/* {currentView === 'clients' ?
<Button className="gap-2 w-full sm:w-auto shrink-0" onClick={() => setShowForm(true)}>
<Plus className="w-4 h-4" /> Add Client
</Button>
:
<Link href='task/project-assignment' className="w-full sm:w-auto shrink-0">
<Button className="gap-2 w-full sm:w-auto">
<Plus className="w-4 h-4" /> Create Project Assignment
</Button>
</Link>
} */}
</div>
</div>
<FilterComponent
hideFilterModal
showLayoutToggle={true}
/>
{showForm && <FormClient isRedirectToDetail onCancel={() => setShowForm(false)} onSuccess={() => { setShowForm(false); router.refresh() }} />}
</>
);
}