fix: Replace broken media thumbnails with MediaThumbnail component

Old Cloudinary URLs no longer load (account full). The new MediaThumbnail
component handles broken URLs gracefully with a fallback icon, and uses
<video preload="metadata"> for local video files to show the first frame.

- New component: client/src/components/media-thumbnail.tsx
- Updated: new-reel.tsx, new-post.tsx, media-upload.tsx,
           edit-scheduled-post-dialog.tsx

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Sonnet 4.6 committed 2026-03-25 08:05:04 +01:00
1 parent 7733acbc22
commit 2744b538e3
5 files changed
+83 -66

No files matched your search

@@ -10,6 +10,7 @@ import { apiRequest, queryClient } from "@/lib/queryClient";
import type { SocialPage, Media, Post } from "@shared/schema";
import { format } from "date-fns";
import { Image as ImageIcon, CheckCircle } from "lucide-react";
import { MediaThumbnail } from "@/components/media-thumbnail";
interface EditScheduledPostDialogProps {
open: boolean;
@@ -165,9 +166,10 @@ export default function EditScheduledPostDialog({ open, onOpenChange, scheduledP
if (!media) return null;
return (
<div key={mediaId} className="relative group">
<img
<MediaThumbnail
src={media.instagramFeedUrl || media.originalUrl}
alt="Selected"
type={media.type === 'video' ? 'video' : 'image'}
className="w-full h-24 object-cover rounded-lg border-2 border-primary"
/>
<div className="absolute top-1 left-1 bg-primary text-primary-foreground rounded-full w-6 h-6 flex items-center justify-center text-xs font-bold">
@@ -198,9 +200,10 @@ export default function EditScheduledPostDialog({ open, onOpenChange, scheduledP
className="relative group"
data-testid={`button-select-media-${media.id}`}
>
<img
<MediaThumbnail
src={media.instagramFeedUrl || media.originalUrl}
alt={media.fileName}
type={media.type === 'video' ? 'video' : 'image'}
className={`w-full h-20 object-cover rounded-lg border-2 transition-all ${
isSelected ? 'border-primary' : 'border-border hover:border-primary/50'
}`}