mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 17:56:28 +00:00
Add FilterModal and DatePickerMultiMode; UI fixes
Introduce a FilterModal component and a DatePickerMultiMode UI component; refactor FilterComponent to use the modal and expose new hide* props for finer control. Update HomeTask to use a Select for view switching and remove unused props. Improve client and assignment UIs: ClientGrid empty state, client card actions, AssignmentTable empty state, and various text/label adjustments. Fix PieChart null-safety with optional chaining and remove a stray console.log in ClientDetailComponent. Update assignment field mappings to prefer wo_* values where appropriate and pass hideCategory to project detail page. Also update .env.development API/IMG URLs.
This commit is contained in:
@@ -3,19 +3,20 @@
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useRouter, usePathname, useSearchParams } from 'next/navigation';
|
||||
import { Plus, Search, LayoutGrid, List } from 'lucide-react';
|
||||
import { Plus } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
// import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import FormClient from './FormClient';
|
||||
import FilterComponent from './FilterComponent';
|
||||
import {
|
||||
Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
|
||||
interface ShellProps {
|
||||
currentView: 'grid' | 'table';
|
||||
currentQuery: string;
|
||||
}
|
||||
|
||||
export default function HomeTask({ currentView, currentQuery }: ShellProps) {
|
||||
export default function HomeTask({ currentView }: ShellProps) {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const searchParams = useSearchParams();
|
||||
@@ -40,19 +41,31 @@ export default function HomeTask({ currentView, currentQuery }: ShellProps) {
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<Tabs value={currentView} onValueChange={handleTabChange} className="w-auto">
|
||||
{/* <Tabs value={currentView} onValueChange={handleTabChange} className="w-auto">
|
||||
<TabsList>
|
||||
<TabsTrigger value="grid" className="gap-2"><LayoutGrid className="w-4 h-4" /> Clients</TabsTrigger>
|
||||
<TabsTrigger value="table" className="gap-2"><List className="w-4 h-4" /> Assignments</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
</Tabs> */}
|
||||
<Select value={currentView} onValueChange={handleTabChange}>
|
||||
<SelectTrigger className="w-full md:w-max bg-white dark:bg-zinc-900">
|
||||
<SelectValue placeholder="Show by" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectLabel>Show by</SelectLabel>
|
||||
<SelectItem value="grid">Clients</SelectItem>
|
||||
<SelectItem value="table">Project Assignment</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button className="gap-2" onClick={() => setShowForm(true)}>
|
||||
<Plus className="w-4 h-4" /> Add Client
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<FilterComponent hideStatus={currentView === 'grid'} />
|
||||
<FilterComponent hideDateFilters={currentView === 'grid'} />
|
||||
|
||||
{showForm && <FormClient onCancel={() => setShowForm(false)} onSuccess={() => { setShowForm(false); router.refresh() }} />}
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user