mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 23:16:29 +00:00
dcb74c0f2b
Introduce a reusable HoverCard component (components/ui/hover-card.tsx) and integrate it into the client grid to show a status summary with badges. Import the cn helper and BadgeStatus in ClientGrid, add a status pill trigger with animated indicator, and switch displayed client reference from end_user_name to client.name. In ManageTeam, include id in draftData, replace BadgeStatus rendering with a Badge variant and adjust the edit button colors to teal; the same teal edit-button color change was applied to UpdateTimelineStatus. Remove an unnecessary comment line in the task page. These changes improve status visibility and unify UI affordances.
45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
import { Suspense } from 'react';
|
|
import HomeTask from './component/HomeTask';
|
|
import ClientGrid from './component/ClientGrid';
|
|
import AssignmentTable from './component/AssignmentTable';
|
|
import fetchData, { getQueryStringFilteredAssignments } from '@/lib/fetchData';
|
|
import { getFilteredAssignments, getFilteredClients } from './data';
|
|
|
|
type Props = {
|
|
searchParams: Promise<{ view?: string; q?: string, status?: string, sort?: string }>
|
|
};
|
|
|
|
export default async function ClientsPage({ searchParams }: Props) {
|
|
const searchParams_ = await searchParams;
|
|
|
|
const view = searchParams_.view === 'assignments' ? 'assignments' : 'clients';
|
|
const query = (searchParams_.q || '').toLowerCase();
|
|
const sort = (searchParams_.sort || '').toLowerCase();
|
|
const sortBy = sort || 'default';
|
|
|
|
const queryString = getQueryStringFilteredAssignments(searchParams_)
|
|
|
|
const getClient = fetchData('/client')
|
|
const getAssignment = fetchData(queryString ? `/project-assignment?${queryString}` : '/project-assignment')
|
|
|
|
const [allClients, allAssignments] = await Promise.all([getClient, getAssignment]);
|
|
|
|
const filteredClients = getFilteredClients(allClients, query, sortBy)
|
|
const filterAssignments = getFilteredAssignments(allAssignments, query, sortBy)
|
|
|
|
return (
|
|
<div className="flex-1 space-y-8 p-6 sm:p-8 pt-6">
|
|
|
|
<HomeTask currentView={view} />
|
|
|
|
{/* Render the correct view based on the URL */}
|
|
<Suspense fallback={<div className="animate-pulse h-96 bg-accent rounded-xl" />}>
|
|
{view === 'clients' ?
|
|
<ClientGrid clients={filteredClients} />
|
|
:
|
|
<AssignmentTable data={filterAssignments} />
|
|
}
|
|
</Suspense>
|
|
</div>
|
|
);
|
|
} |