diff --git a/next_frontend/components/cases/CaseCard.tsx b/next_frontend/components/cases/CaseCard.tsx index 8e59c97a..20f214b0 100644 --- a/next_frontend/components/cases/CaseCard.tsx +++ b/next_frontend/components/cases/CaseCard.tsx @@ -12,11 +12,12 @@ import { // import { AssuranceCase } from '@/types' import Link from 'next/link' import moment from 'moment' -import { Eye, MessageCircleMore, PencilRuler, ScanEye, Trash2 } from 'lucide-react' +import { Eye, Loader2, MessageCircleMore, PencilRuler, ScanEye, Trash2 } from 'lucide-react' import { AlertModal } from '@/components/modals/alertModal' import { useParams, useRouter } from 'next/navigation' import { useLoginToken } from '@/hooks/useAuth' import Image from 'next/image' +import { Skeleton } from '../ui/skeleton' interface CaseCardProps { assuranceCase: any @@ -31,6 +32,7 @@ const CaseCard = ({ assuranceCase } : CaseCardProps) => { const [open, setOpen] = useState(false) const [loading, setLoading] = useState(false) const [imgSrc, setImgSrc] = useState(''); + const [imageLoading, setImageLoading] = useState(true); // const [imgSrc, setImgSrc] = useState(`https://teamedia.blob.core.windows.net/sample-container/chart-screenshot-case-${assuranceCase.id}.png`); // const [imageExists, setImageExists] = useState(true) // const [imageUrl, setImageUrl] = useState('') @@ -81,6 +83,8 @@ const CaseCard = ({ assuranceCase } : CaseCardProps) => { setImgSrc(result.image) } catch (error) { console.log('Failed to fetch image') + } finally { + setImageLoading(false) } } @@ -93,15 +97,20 @@ const CaseCard = ({ assuranceCase } : CaseCardProps) => { -
- {imgSrc && ( - {`Assurance + {imageLoading ? + ( + + ) : ( +
+ {imgSrc && ( + {`Assurance + )} +
)} -
{name} {description}