mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 10:56:28 +00:00
93a9b489d0
This commit updates the task dashboard and assignment views for smaller screens by tightening spacing, improving text wrapping, and making filter/search controls responsive. It also refreshes the assignment detail layout with clearer date spans, team summaries, and switchable grid/list member views, while polishing client and assignment cards for better readability on mobile.
77 lines
3.3 KiB
TypeScript
77 lines
3.3 KiB
TypeScript
"use client"
|
|
|
|
import { useState } from 'react';
|
|
import { useRouter, usePathname, useSearchParams } from 'next/navigation';
|
|
import { Plus } from 'lucide-react';
|
|
import { Button } from '@/components/ui/button';
|
|
import FormClient from './client/FormClient';
|
|
import FilterComponent from './FilterComponent';
|
|
import {
|
|
Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue,
|
|
} from '@/components/ui/select';
|
|
import Link from 'next/link';
|
|
|
|
interface ShellProps {
|
|
currentView: 'clients' | 'assignments';
|
|
}
|
|
|
|
export default function HomeTask({ currentView }: 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);
|
|
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>
|
|
{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={currentView === 'clients'}
|
|
showLayoutToggle={true}
|
|
/>
|
|
|
|
{showForm && <FormClient isRedirectToDetail onCancel={() => setShowForm(false)} onSuccess={() => { setShowForm(false); router.refresh() }} />}
|
|
</>
|
|
);
|
|
} |