fix(admin): enhance media manager with all file types and progress, fix videos sync and home display
Deploy Canina / deploy (push) Successful in 1m49s

This commit is contained in:
parsa aghaei committed 2026-08-17 15:18:34 +03:30
1 parent 2d83a00169
commit bea0488efb
6 files changed
+571 -356

No files matched your search

+14 -12
View File
@@ -81,18 +81,20 @@ export default function VetGallery({ testimonials = [] }: { testimonials?: Testi
}, []);
const activeTestimonials = testimonials.filter(t => t.isActive !== false);
const displayItems: DisplayVideoItem[] = activeTestimonials.length > 0
? activeTestimonials.map((t, idx) => ({
id: t.id || `t-${idx}`,
title: (t.authorName || t.vetName || '') + (t.roleTitle ? ` — ${t.roleTitle}` : (t.clinicName ? ` — ${t.clinicName}` : '')),
doctor: (t.authorName || t.vetName || '') + (t.roleTitle ? ` (${t.roleTitle})` : ''),
duration: "۰۲:۰۰",
thumbnail: t.avatarUrl || t.imageUrl || "https://images.unsplash.com/photo-1576091160550-217359f42f8c?auto=format&fit=crop&q=80&w=400",
videoUrl: "https://www.w3schools.com/html/mov_bbb.mp4",
description: t.content || t.quote || '',
quote: t.content || t.quote || ''
}))
: (apiVideos.length > 0 ? apiVideos : FALLBACK_VIDEOS);
const displayItems: DisplayVideoItem[] = apiVideos.length > 0
? apiVideos
: (activeTestimonials.length > 0
? activeTestimonials.map((t, idx) => ({
id: t.id || `t-${idx}`,
title: (t.authorName || t.vetName || '') + (t.roleTitle ? ` — ${t.roleTitle}` : (t.clinicName ? ` — ${t.clinicName}` : '')),
doctor: (t.authorName || t.vetName || '') + (t.roleTitle ? ` (${t.roleTitle})` : ''),
duration: "۰۲:۰۰",
thumbnail: t.avatarUrl || t.imageUrl || "https://images.unsplash.com/photo-1576091160550-217359f42f8c?auto=format&fit=crop&q=80&w=400",
videoUrl: "https://www.w3schools.com/html/mov_bbb.mp4",
description: t.content || t.quote || '',
quote: t.content || t.quote || ''
}))
: FALLBACK_VIDEOS);
return (
<section className="py-24 bg-white font-vazir" dir="rtl">
+11 -3
View File
@@ -58,15 +58,23 @@ const FALLBACK_VIDEOS: Video[] = [
export default function VideosPage() {
const router = useRouter();
const [videos, setVideos] = useState<Video[]>(FALLBACK_VIDEOS);
const [videos, setVideos] = useState<Video[]>([]);
const [isLoading, setIsLoading] = useState(true);
const [selectedVideo, setSelectedVideo] = useState<Video | null>(null);
const [search, setSearch] = useState("");
React.useEffect(() => {
setIsLoading(true);
videoService.getVideos({ limit: 100 }).then((data) => {
if (data && data.length > 0) {
setVideos(data);
} else {
setVideos(FALLBACK_VIDEOS);
}
}).catch(() => {
setVideos(FALLBACK_VIDEOS);
}).finally(() => {
setIsLoading(false);
});
}, []);
@@ -144,11 +152,11 @@ export default function VideosPage() {
<div className="flex items-center gap-4 text-xs font-bold text-white/40">
<div className="flex items-center gap-1">
<User className="w-3 h-3" />
{video.doctor}
{video.doctor || 'کادر علمی کنینا'}
</div>
<div className="flex items-center gap-1">
<Clock className="w-3 h-3" />
دسترسی دائمی
<span>{video.duration || 'آموزش ویدئویی'}</span>
</div>
</div>
</div>