mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 09:28:11 +00:00
error for non-loading images
This commit is contained in:
1 parent
0e2926b179
commit
11f8885bf6
3 files changed
+12
-5
No files matched your search
@@ -128,6 +128,11 @@ const CompletedCard = ({
|
||||
<img
|
||||
src={task.thumbnailUrl}
|
||||
alt={task.title}
|
||||
onError={(e) => {
|
||||
console.log("Failed to load thumbnail", e);
|
||||
// NB: Replace the broken thumbnail with a placeholder.
|
||||
e.currentTarget.src="/resources/placeholders/placeholder.png";
|
||||
}}
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
) : (
|
||||
@@ -147,7 +152,7 @@ const CompletedCard = ({
|
||||
)}
|
||||
{task.completedAt && (
|
||||
<div className="text-base-fg text-xs opacity-60">
|
||||
{task.completedAt}
|
||||
{task.completedAt.toISOString()}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -26,7 +26,7 @@ interface GalleryDraggableItemProps {
|
||||
activeFilter: string;
|
||||
selected: boolean;
|
||||
onClick: () => void;
|
||||
onImageError: () => void;
|
||||
onImageError: (e: React.SyntheticEvent<HTMLImageElement>) => void;
|
||||
disableTooltipAndBadge?: boolean;
|
||||
imageFit?: "cover" | "contain";
|
||||
onDeleted?: (id: string) => void;
|
||||
|
||||
@@ -637,9 +637,11 @@ export const GalleryModal = React.memo(
|
||||
activeFilter={activeFilter}
|
||||
selected={selectedItemIds.includes(item.id)}
|
||||
onClick={() => handleItemClick(item)}
|
||||
onImageError={() =>
|
||||
handleImageError(item.thumbnail!)
|
||||
}
|
||||
onImageError={(e) => {
|
||||
// NB: Replace the broken thumbnail with a placeholder.
|
||||
e.currentTarget.src = "/resources/placeholders/placeholder.png";
|
||||
handleImageError(item.thumbnail!);
|
||||
}}
|
||||
disableTooltipAndBadge={mode === "select"}
|
||||
imageFit={imageFit}
|
||||
onDeleted={handleItemDeleted}
|
||||
|
||||
Reference in new issue
Block a user