mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 19:56:28 +00:00
Improve image fallbacks and status display
This commit adds reusable client and end-user fallback assets and updates profile cards, lists, and assignment views to render graceful placeholders when images are missing or fail to load. It also hardens the shared LazyImage component with fallback handling and improves BadgeStatus so it accepts object-like status values and still renders clean labels. Minor UX fixes include dismissing upload toasts after completion and clarifying end-user form labels/copy.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { IProjectAssignment } from '../../type.assignment';
|
||||
import { CLIENT_FALLBACK_IMAGE, END_USER_FALLBACK_IMAGE } from '../../types';
|
||||
import { motion } from 'motion/react';
|
||||
import { Card900 } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -205,16 +206,13 @@ export default function AssignmentGrid({
|
||||
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] 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 shrink-0"
|
||||
imgClassName="object-cover"
|
||||
/>
|
||||
:
|
||||
<BuildingComplex className="w-3 h-3 text-muted-foreground shrink-0" />
|
||||
}
|
||||
<LazyImage
|
||||
src={assignment.client.photo || CLIENT_FALLBACK_IMAGE}
|
||||
fallbackSrc={CLIENT_FALLBACK_IMAGE}
|
||||
alt={assignment.client.name}
|
||||
className="w-3.5 h-3.5 rounded-xs bg-transparent shrink-0"
|
||||
imgClassName="object-contain"
|
||||
/>
|
||||
<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>
|
||||
@@ -222,17 +220,14 @@ export default function AssignmentGrid({
|
||||
|
||||
{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] 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
|
||||
src={assignment.end_user.photo ? assignment.end_user.photo : '/assets/ilustration.png'}
|
||||
alt={assignment.end_user.name}
|
||||
className="w-full h-full bg-transparent"
|
||||
imgClassName="object-contain"
|
||||
/>
|
||||
) : (
|
||||
<Building className="w-3 h-3 text-muted-foreground" />
|
||||
)}
|
||||
<div className="w-3.5 h-3.5 rounded-xs overflow-hidden shrink-0 bg-transparent">
|
||||
<LazyImage
|
||||
src={assignment.end_user?.photo || END_USER_FALLBACK_IMAGE}
|
||||
fallbackSrc={END_USER_FALLBACK_IMAGE}
|
||||
alt={assignment.end_user.name}
|
||||
className="w-full h-full bg-transparent"
|
||||
imgClassName="object-contain"
|
||||
/>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user