Add assignment tooltips and polish tooltip styles

This update adds richer hover tooltips for assignment codes and date ranges in both grid and list views, showing clearer labels like work order or memo codes and full start/end dates. It also standardizes tooltip visuals with a popover-style card, improved spacing, and better consistency across assignment cards.
This commit is contained in:
Ichsan Kurniawan
2026-10-13 14:47:34 +07:00
parent 0cf6a34522
commit 90a34330eb
3 changed files with 66 additions and 36 deletions
@@ -108,9 +108,17 @@ export default function AssignmentGrid({
{/* Row 2: Assignment Code & Converted Indicator */}
<div className="flex items-center gap-1.5 flex-wrap">
{assignmentCode && (
<span className="inline-block text-[11px] font-mono font-semibold px-2 py-0.5 rounded-md bg-muted/80 dark:bg-zinc-800 text-muted-foreground border border-border/60 shrink-0 truncate max-w-full">
# {assignmentCode}
</span>
<Tooltip>
<TooltipTrigger asChild>
<span className="inline-block text-[11px] font-mono font-semibold px-2 py-0.5 rounded-md bg-muted/80 dark:bg-zinc-800 text-muted-foreground border border-border/60 shrink-0 truncate max-w-full cursor-help hover:text-foreground hover:border-border transition-colors">
# {assignmentCode}
</span>
</TooltipTrigger>
<TooltipContent className="text-xs">
<p className="font-semibold">{isProject ? 'Work Order Code' : 'Internal Memo Code'}</p>
<p className="text-[11px] font-mono text-muted-foreground">#{assignmentCode}</p>
</TooltipContent>
</Tooltip>
)}
<ConvertedAssignmentBadge assignment={assignment} clientId={effectiveClientId} />
@@ -279,12 +287,25 @@ export default function AssignmentGrid({
{/* Footer: Timeline & Team Members */}
<div className="pt-3.5 border-t border-border/60 flex flex-wrap sm:flex-nowrap items-center justify-between gap-2.5 text-xs">
<div className="flex items-center gap-1.5 text-muted-foreground min-w-0 flex-1">
<Calendar className="w-3.5 h-3.5 shrink-0 text-muted-foreground/80" />
<span className="font-medium text-[11px] truncate">
{formatAssignmentDate(assignmentStartDate)} - {formatAssignmentDate(assignmentEndDate)}
</span>
</div>
<Tooltip>
<TooltipTrigger asChild>
<div className="flex items-center gap-1.5 text-muted-foreground min-w-0 flex-1 cursor-help hover:text-foreground transition-colors">
<Calendar className="w-3.5 h-3.5 shrink-0 text-muted-foreground/80" />
<span className="font-medium text-[11px] truncate">
{formatAssignmentDate(assignmentStartDate)} – {formatAssignmentDate(assignmentEndDate)}
</span>
</div>
</TooltipTrigger>
<TooltipContent className="text-xs space-y-0.5">
<p className="font-semibold">Assignment Timeline</p>
<p className="text-[11px] text-muted-foreground mt-1">
Start: <span className="text-foreground font-medium">{formatAssignmentDate(assignmentStartDate)}</span>
</p>
<p className="text-[11px] text-muted-foreground">
End: <span className="text-foreground font-medium">{formatAssignmentDate(assignmentEndDate)}</span>
</p>
</TooltipContent>
</Tooltip>
{/* Assigned Team */}
<div className="flex -space-x-2 overflow-hidden items-center shrink-0">
@@ -301,8 +322,8 @@ export default function AssignmentGrid({
</div>
</TooltipTrigger>
<TooltipContent>
<p className="text-xs font-bold">{item?.user?.fullname || item?.user?.name}</p>
<p className="text-[10px] opacity-80">{item?.user?.position?.name || 'Team Member'}</p>
<p className="text-xs font-semibold text-popover-foreground">{item?.user?.fullname || item?.user?.name}</p>
<p className="text-[10px] text-muted-foreground">{item?.user?.position?.name || 'Team Member'}</p>
</TooltipContent>
</Tooltip>
</div>
@@ -114,9 +114,17 @@ export default function AssignmentList({
{assignmentStatus && <BadgeStatus status={assignmentStatus} />}
{assignmentCode ? (
<span className="text-[11px] font-mono font-medium px-2 py-0.5 rounded-md bg-muted/80 dark:bg-zinc-800 text-muted-foreground border border-border/60 shrink-0">
# {assignmentCode}
</span>
<Tooltip>
<TooltipTrigger asChild>
<span className="text-[11px] font-mono font-medium px-2 py-0.5 rounded-md bg-muted/80 dark:bg-zinc-800 text-muted-foreground border border-border/60 shrink-0 cursor-help hover:text-foreground hover:border-border transition-colors">
# {assignmentCode}
</span>
</TooltipTrigger>
<TooltipContent className="text-xs">
<p className="font-semibold">{isProject ? 'Work Order Code' : 'Internal Memo Code'}</p>
<p className="text-[11px] font-mono text-muted-foreground">#{assignmentCode}</p>
</TooltipContent>
</Tooltip>
) : null}
</div>
@@ -166,12 +174,25 @@ export default function AssignmentList({
</div>
)}
<div className="flex items-center gap-1 text-[11px] text-muted-foreground shrink-0">
<Calendar className="w-3.5 h-3.5 text-muted-foreground/80 shrink-0" />
<span>
{formatAssignmentDate(assignmentStartDate)} - {formatAssignmentDate(assignmentEndDate)}
</span>
</div>
<Tooltip>
<TooltipTrigger asChild>
<div className="flex items-center gap-1 text-[11px] text-muted-foreground shrink-0 cursor-help hover:text-foreground transition-colors">
<Calendar className="w-3.5 h-3.5 text-muted-foreground/80 shrink-0" />
<span>
{formatAssignmentDate(assignmentStartDate)} – {formatAssignmentDate(assignmentEndDate)}
</span>
</div>
</TooltipTrigger>
<TooltipContent className="text-xs space-y-0.5">
<p className="font-semibold">Assignment Timeline</p>
<p className="text-[11px] text-muted-foreground mt-1">
Start: <span className="text-foreground font-medium">{formatAssignmentDate(assignmentStartDate)}</span>
</p>
<p className="text-[11px] text-muted-foreground">
End: <span className="text-foreground font-medium">{formatAssignmentDate(assignmentEndDate)}</span>
</p>
</TooltipContent>
</Tooltip>
{assignment.note && (
<span className="text-[11px] italic text-muted-foreground/80 line-clamp-1 max-w-35 sm:max-w-xs wrap-break-word">
@@ -199,8 +220,8 @@ export default function AssignmentList({
</div>
</TooltipTrigger>
<TooltipContent>
<p className="text-xs font-bold">{item?.user?.fullname || item?.user?.name}</p>
<p className="text-[10px] opacity-80">{item?.user?.position?.name || 'Team Member'}</p>
<p className="text-xs font-semibold text-popover-foreground">{item?.user?.fullname || item?.user?.name}</p>
<p className="text-[10px] text-muted-foreground">{item?.user?.position?.name || 'Team Member'}</p>
</TooltipContent>
</Tooltip>
</div>
@@ -217,17 +238,6 @@ export default function AssignmentList({
{/* Action Buttons */}
<div className="flex items-center gap-1.5">
{/* <Link href={assignmentDetailUrl}>
<Button
variant="outline"
size="sm"
className="text-xs h-8 px-3 gap-1 hover:text-his hover:border-his/40"
>
<span>Details</span>
<ArrowRight className="w-3 h-3" />
</Button>
</Link> */}
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
+2 -3
View File
@@ -32,7 +32,7 @@ function TooltipTrigger({
function TooltipContent({
className,
sideOffset = 0,
sideOffset = 4,
children,
...props
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
@@ -42,13 +42,12 @@ function TooltipContent({
data-slot="tooltip-content"
sideOffset={sideOffset}
className={cn(
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
"z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
className
)}
{...props}
>
{children}
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
</TooltipPrimitive.Content>
</TooltipPrimitive.Portal>
)