// app/clients/components/dashboard-shell.tsx "use client" import { useState } from 'react'; import { useRouter, usePathname, useSearchParams } from 'next/navigation'; import { Plus, Search, LayoutGrid, List } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'; import FormClient from './FormClient'; interface ShellProps { currentView: 'grid' | 'table'; currentQuery: string; } export default function HomeTask({ currentView, currentQuery }: ShellProps) { const router = useRouter(); const pathname = usePathname(); const searchParams = useSearchParams(); const [showForm, setShowForm] = useState(false); // Update URL when Tabs change const handleTabChange = (view: string) => { const params = new URLSearchParams(searchParams!); params.set('view', view); router.push(`${pathname}?${params.toString()}`); }; // Update URL when typing (Debouncing recommended for production) const handleSearch = (term: string) => { const params = new URLSearchParams(searchParams!); if (term) { params.set('q', term); } else { params.delete('q'); } // Use replace so we don't clutter the browser history with every keystroke router.replace(`${pathname}?${params.toString()}`); }; return ( <>

My Task & Projects

Something that can be done at any time is often done at no time.

Clients Assignments
handleSearch(e.target.value)} />
{showForm && setShowForm(false)} onSuccess={() => { setShowForm(false); router.refresh() }} />} ); }