mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 23:36:29 +00:00
Add HoverCard and UI/status tweaks
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.
This commit is contained in:
@@ -18,6 +18,11 @@ import { useState } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import FormClient from './FormClient';
|
||||
import { ConfirmDeleteWithInput } from '@/components/modal/ConfirmDeleteWithInput';
|
||||
import {
|
||||
HoverCard, HoverCardContent, HoverCardTrigger,
|
||||
} from "@/components/ui/hover-card"
|
||||
import { cn } from '@/lib/utils';
|
||||
import BadgeStatus from '@/components/ui/badge-status';
|
||||
|
||||
export default function ClientGrid({ clients }: { clients: IClient[] }) {
|
||||
const router = useRouter();
|
||||
@@ -70,10 +75,44 @@ export default function ClientGrid({ clients }: { clients: IClient[] }) {
|
||||
className="w-full h-full object-cover group-hover:scale-110 transition-transform duration-500"
|
||||
/>
|
||||
<div className="absolute inset-0 bg-linear-to-t from-black/80 via-black/40 to-transparent" />
|
||||
<div className="absolute top-3 right-3 z-20">
|
||||
<HoverCard openDelay={10} closeDelay={100}>
|
||||
<HoverCardTrigger>
|
||||
<div className="group/pill flex items-center gap-2 bg-black/40 hover:bg-black/60 backdrop-blur-md border border-white/20 rounded-full py-1 px-3 transition-all duration-300 cursor-help hover:scale-105 active:scale-95 shadow-xl">
|
||||
<div className="relative flex items-center justify-center">
|
||||
{client.status_name.toLowerCase() === 'active' &&
|
||||
<span className="absolute inset-0 rounded-full bg-green-400 animate-ping opacity-40 scale-150" />
|
||||
}
|
||||
<div className={cn(
|
||||
"w-2.5 h-2.5 rounded-full ring-2 ring-black/40 relative z-10",
|
||||
client.status_name.toLowerCase() === 'active' ? 'bg-green-400' : 'bg-orange-400'
|
||||
)} />
|
||||
</div>
|
||||
<span className="text-[10px] font-black text-white/90 uppercase tracking-widest whitespace-nowrap">
|
||||
{client.status_name}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</HoverCardTrigger>
|
||||
<HoverCardContent side="bottom" align='end' className="flex flex-col gap-0.5 text-sm">
|
||||
<div className="font-semibold">Status Summary</div>
|
||||
<div className="text-xs text-muted-foreground">This is status summary information from WO or IM related to this client.</div>
|
||||
<div className='flex flex-col mt-4 gap-2.5 text-xs'>
|
||||
{client.project_status_summary.map((item, key) =>
|
||||
<div className='flex justify-between items-center gap-2' key={key}>
|
||||
<BadgeStatus status={item.project_status} />
|
||||
<div className='font-bold'>{item.total}</div>
|
||||
</div>
|
||||
)}
|
||||
<div></div>
|
||||
</div>
|
||||
</HoverCardContent>
|
||||
</HoverCard>
|
||||
</div>
|
||||
<div className="absolute bottom-4 left-4 right-4 flex items-end justify-between">
|
||||
<div className="text-white">
|
||||
<h3 className="font-bold text-lg leading-tight">{client.name}</h3>
|
||||
<p className="text-xs opacity-80">{client.end_user_name}</p>
|
||||
{/* <p className="text-xs opacity-80">{client.end_user_name}</p> */}
|
||||
</div>
|
||||
<Link href={`/task/client-detail/${client.id}`}>
|
||||
<Button size="icon" variant="secondary" className="h-8 w-8 rounded-full opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
@@ -110,7 +149,7 @@ export default function ClientGrid({ clients }: { clients: IClient[] }) {
|
||||
<>
|
||||
A dedicated team of{" "}
|
||||
<span className="font-bold text-foreground">{userCount} experts</span> is handling{" "}
|
||||
<span className="font-bold text-foreground">{woCount} work order{woCount! > 1 ? 's' : ''}</span>{" "}to ensure successful delivery for <span className="italic">{client.end_user_name}</span>.
|
||||
<span className="font-bold text-foreground">{woCount} work order{woCount! > 1 ? 's' : ''}</span>{" "}to ensure successful delivery for <span className="italic">{client.name}</span>.
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user