Improve task views mobile responsiveness

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.
This commit is contained in:
Ichsan Kurniawan
2026-10-06 11:24:30 +07:00
parent d0db9ee429
commit 93a9b489d0
11 changed files with 449 additions and 180 deletions
@@ -65,14 +65,14 @@ export default function AssignmentGrid({
className="h-full"
key={index}
>
<Card900 className="h-full group hover:border-his/50 transition-all duration-300 hover:shadow-xl hover:-translate-y-1 flex flex-col justify-between p-5 border-border/80 rounded-2xl bg-card gap-4">
<Card900 className="h-full group hover:border-his/50 transition-all duration-300 hover:shadow-xl hover:-translate-y-1 flex flex-col justify-between p-4 sm:p-5 border-border/80 rounded-2xl bg-card gap-4 min-w-0">
{/* Top Section: 3D Emblem, Badges, and Action Menu */}
<div className="flex items-start justify-between gap-3">
<div className="flex items-center gap-3.5 min-w-0">
<div className="flex items-start justify-between gap-2.5 min-w-0">
<div className="flex items-center gap-3 min-w-0 flex-1">
{/* 3D App Icon / Emblem */}
<Link
href={assignmentDetailUrl}
className="relative w-14 h-14 sm:w-16 sm:h-16 shrink-0 rounded-2xl overflow-hidden bg-muted/20 dark:bg-zinc-800/40 border border-border/60 flex items-center justify-center p-1 shadow-2xs group-hover:scale-105 group-hover:border-his/40 transition-all duration-300"
className="relative w-12 h-12 sm:w-16 sm:h-16 shrink-0 rounded-2xl overflow-hidden bg-muted/20 dark:bg-zinc-800/40 border border-border/60 flex items-center justify-center p-1 shadow-2xs group-hover:scale-105 group-hover:border-his/40 transition-all duration-300"
>
<LazyImage
src={illustrationSrc}
@@ -83,11 +83,11 @@ export default function AssignmentGrid({
</Link>
{/* Identity & Badges */}
<div className="min-w-0 space-y-1.5">
<div className="flex items-center gap-2 flex-wrap">
<div className="min-w-0 space-y-1.5 flex-1">
<div className="flex items-center gap-1.5 flex-wrap">
<Badge
variant="outline"
className={`text-[10px] font-semibold tracking-wide px-2 py-0.5 gap-1 ${isProject
className={`text-[10px] font-semibold tracking-wide px-2 py-0.5 gap-1 shrink-0 ${isProject
? 'bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/30'
: 'bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/30'
}`}
@@ -99,11 +99,11 @@ export default function AssignmentGrid({
{assignmentStatus && <BadgeStatus status={assignmentStatus} />}
</div>
{assignmentCode &&
<span className="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">
{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>
}
)}
</div>
</div>
@@ -161,12 +161,12 @@ export default function AssignmentGrid({
</div>
{/* Center: Title, Project, Description, Tags */}
<div className="space-y-2.5 flex-1">
<div className="space-y-2.5 flex-1 min-w-0">
{/* Title */}
<div>
<Link
href={assignmentDetailUrl}
className="font-bold text-base sm:text-lg leading-snug text-foreground hover:text-his transition-colors block line-clamp-2 tracking-tight"
className="font-bold text-base sm:text-lg leading-snug text-foreground hover:text-his transition-colors block line-clamp-2 tracking-tight wrap-break-word"
>
{assignmentName}
</Link>
@@ -174,54 +174,54 @@ export default function AssignmentGrid({
{/* Project Reference */}
{assignment.project?.name && (
<div className="flex items-center gap-1.5 text-xs text-muted-foreground pt-0.5">
<div className="flex items-center gap-1.5 text-xs text-muted-foreground pt-0.5 min-w-0">
<FolderGit2 className="w-3.5 h-3.5 text-his shrink-0" />
<span className="text-[11px] text-muted-foreground">Project:</span>
<span className="text-[11px] text-muted-foreground shrink-0">Project:</span>
{projectDetailUrl ? (
<Link
href={projectDetailUrl}
className="font-medium text-foreground hover:text-his truncate hover:underline flex items-center gap-1"
className="font-medium text-foreground hover:text-his truncate hover:underline flex items-center gap-1 min-w-0"
>
<span className="truncate">{assignment.project.name}</span>
<ExternalLink className="w-3 h-3 shrink-0 opacity-60" />
</Link>
) : (
<span className="font-medium text-foreground truncate">{assignment.project.name}</span>
<span className="font-medium text-foreground truncate min-w-0">{assignment.project.name}</span>
)}
</div>
)}
{/* Description */}
{assignmentDesc && (
<p className="text-xs text-muted-foreground line-clamp-2 leading-relaxed pt-0.5">
<p className="text-xs text-muted-foreground line-clamp-2 leading-relaxed pt-0.5 wrap-break-word">
{assignmentDesc}
</p>
)}
{/* Client & End User Badges */}
<div className="flex flex-wrap items-center gap-2 pt-1 text-xs">
<div className="flex flex-wrap items-center gap-1.5 pt-1 text-xs">
{assignment.client?.name && !clientId && (
<Link
href={`/task/client-detail/${assignment.client.id}`}
className="flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-muted/60 hover:bg-muted border border-border/50 text-foreground transition-colors text-[11px]"
className="flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-muted/60 hover:bg-muted border border-border/50 text-foreground transition-colors text-[11px] max-w-full min-w-0"
>
{assignment.client.photo ?
<LazyImage
src={assignment.client.photo}
alt={assignment.client.name}
className="w-3 h-3 rounded-xs bg-transparent"
className="w-3 h-3 rounded-xs bg-transparent shrink-0"
imgClassName="object-cover"
/>
:
<BuildingComplex className="w-3 h-3 text-muted-foreground" />
<BuildingComplex className="w-3 h-3 text-muted-foreground shrink-0" />
}
<span className="text-muted-foreground">Client:</span>
<span className="font-medium truncate max-w-50">{assignment.client.name}</span>
<span className="text-muted-foreground shrink-0">Client:</span>
<span className="font-medium truncate max-w-32.5 sm:max-w-45">{assignment.client.name}</span>
</Link>
)}
{assignment.end_user?.name && (
<div className="flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-muted/40 border border-border/40 text-foreground text-[11px]">
<div className="flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-muted/40 border border-border/40 text-foreground text-[11px] max-w-full min-w-0">
<div className="w-3.5 h-3.5 rounded-xs overflow-hidden shrink-0 bg-secondary">
{assignment.end_user?.photo ? (
<LazyImage
@@ -234,18 +234,18 @@ export default function AssignmentGrid({
<Building className="w-3 h-3 text-muted-foreground" />
)}
</div>
<span className="text-muted-foreground">End User:</span>
<span className="font-medium truncate max-w-50">{assignment.end_user.name}</span>
<span className="text-muted-foreground shrink-0">End User:</span>
<span className="font-medium truncate max-w-32.5 sm:max-w-45">{assignment.end_user.name}</span>
</div>
)}
</div>
</div>
{/* Footer: Timeline & Team Members */}
<div className="pt-3.5 border-t border-border/60 flex items-center justify-between gap-3 text-xs">
<div className="flex items-center gap-1.5 text-muted-foreground">
<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]">
<span className="font-medium text-[11px] truncate">
{formatAssignmentDate(assignmentStartDate)} - {formatAssignmentDate(assignmentEndDate)}
</span>
</div>
@@ -74,13 +74,13 @@ export default function AssignmentList({
className="w-full"
key={index}
>
<Card900 className="group overflow-hidden hover:shadow-md transition-all duration-300 border-border/80 hover:border-his/40 rounded-2xl py-1 bg-card">
<CardContent className="p-4 sm:p-5 flex flex-col md:flex-row items-start md:items-center justify-between gap-4">
<Card900 className="group overflow-hidden hover:shadow-md transition-all duration-300 border-border/80 hover:border-his/40 rounded-2xl py-1 bg-card min-w-0">
<CardContent className="p-3.5 sm:p-5 flex flex-col md:flex-row items-start md:items-center justify-between gap-4 min-w-0">
{/* Left: Thumbnail & Visual Indicator */}
<div className="flex items-start gap-4 min-w-0 flex-1">
<div className="flex items-start gap-3 sm:gap-4 min-w-0 flex-1 w-full">
<Link
href={assignmentDetailUrl}
className="relative w-16 h-16 sm:w-20 sm:h-20 shrink-0 rounded-2xl overflow-hidden bg-muted/20 dark:bg-zinc-800/40 border border-border/60 flex items-center justify-center p-1 shadow-2xs group-hover:border-his/40 group-hover:scale-105 transition-all duration-300"
className="relative w-12 h-12 sm:w-16 sm:h-16 md:w-20 md:h-20 shrink-0 rounded-2xl overflow-hidden bg-muted/20 dark:bg-zinc-800/40 border border-border/60 flex items-center justify-center p-1 shadow-2xs group-hover:border-his/40 group-hover:scale-105 transition-all duration-300"
>
<LazyImage
src={illustrationSrc}
@@ -93,10 +93,10 @@ export default function AssignmentList({
{/* Center Details */}
<div className="min-w-0 flex-1 space-y-1.5">
{/* Line 1: Type Badge, Status, Code, and Project Reference */}
<div className="flex flex-wrap items-center gap-2">
<div className="flex flex-wrap items-center gap-1.5">
<Badge
variant="outline"
className={`text-[10px] font-semibold px-2 py-0.5 gap-1 ${isProject
className={`text-[10px] font-semibold px-2 py-0.5 gap-1 shrink-0 ${isProject
? 'bg-amber-500/15 text-amber-700 dark:text-amber-400 border-amber-500/30'
: 'bg-purple-500/15 text-purple-700 dark:text-purple-400 border-purple-500/30'
}`}
@@ -112,65 +112,63 @@ export default function AssignmentList({
# {assignmentCode}
</span>
) : null}
</div>
{/* Line 2: Assignment Title */}
<div>
<div className="min-w-0">
<Link
href={assignmentDetailUrl}
className="font-semibold text-base sm:text-lg leading-snug text-foreground hover:text-his transition-colors block tracking-tight line-clamp-1 py-0.5"
className="font-semibold text-base sm:text-lg leading-snug text-foreground hover:text-his transition-colors block tracking-tight line-clamp-2 sm:line-clamp-1 py-0.5 wrap-break-word"
>
{assignmentName}
</Link>
{assignment.project?.name && (
<div className="flex items-center gap-1 text-xs text-muted-foreground ml-auto sm:ml-0 mt-2">
<div className="flex items-center gap-1 text-xs text-muted-foreground mt-1 min-w-0">
<FolderGit2 className="w-3.5 h-3.5 text-his shrink-0" />
<span className="text-[11px] text-muted-foreground hidden sm:inline">Project:</span>
<span className="text-[11px] text-muted-foreground hidden sm:inline shrink-0">Project:</span>
{projectDetailUrl ? (
<Link
href={projectDetailUrl}
className="font-medium text-foreground hover:text-his truncate hover:underline inline-block"
className="font-medium text-foreground hover:text-his truncate hover:underline inline-block min-w-0"
>
{assignment.project.name}
</Link>
) : (
<span className="font-medium text-foreground truncate">{assignment.project.name}</span>
<span className="font-medium text-foreground truncate min-w-0">{assignment.project.name}</span>
)}
</div>
)}
</div>
{/* Line 3: Metadata, Client, End User, Timeline, Notes */}
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground pt-0.5">
<div className="flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-muted-foreground pt-0.5 min-w-0">
{assignment.client?.name && !clientId && (
<Link
href={`/task/client-detail/${assignment.client.id}`}
className="flex items-center gap-1 text-[11px] font-medium text-foreground hover:text-his transition-colors"
className="flex items-center gap-1 text-[11px] font-medium text-foreground hover:text-his transition-colors min-w-0"
>
<BuildingComplex className="w-3 h-3 text-muted-foreground" />
<span className="text-muted-foreground">Client:</span>
<span className="truncate max-w-50">{assignment.client.name}</span>
<BuildingComplex className="w-3 h-3 text-muted-foreground shrink-0" />
<span className="text-muted-foreground shrink-0">Client:</span>
<span className="truncate max-w-32.5 sm:max-w-50">{assignment.client.name}</span>
</Link>
)}
{assignment.end_user?.name && (
<div className="flex items-center gap-1 text-[11px] text-foreground">
<span className="text-muted-foreground">End User:</span>
<span className="font-medium truncate max-w-50">{assignment.end_user.name}</span>
<div className="flex items-center gap-1 text-[11px] text-foreground min-w-0">
<span className="text-muted-foreground shrink-0">End User:</span>
<span className="font-medium truncate max-w-32.5 sm:max-w-50">{assignment.end_user.name}</span>
</div>
)}
<div className="flex items-center gap-1 text-[11px] text-muted-foreground">
<Calendar className="w-3.5 h-3.5 text-muted-foreground/80" />
<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>
{assignment.note && (
<span className="text-[11px] italic text-muted-foreground/80 line-clamp-1 max-w-50">
<span className="text-[11px] italic text-muted-foreground/80 line-clamp-1 max-w-35 sm:max-w-xs wrap-break-word">
Note: {assignment.note}
</span>
)}