'use client' import * as React from 'react' import type { UploadProgress } from '@admin/types' import { PlaceholderCard } from '@admin/components/custom/placeholder-card' import { Button } from '@admin/components/ui/button' import { Card, CardContent, CardFooter } from '@admin/components/ui/card' import { Progress } from '@admin/components/ui/progress' import { Skeleton } from '@admin/components/ui/skeleton' import { ImagePlay } from 'lucide-react' import Link from 'next/link' interface MediaEmptyStateProps { variant: 'no-results' | 'loading' | 'empty' onClearSearch?: () => void onAddFiles?: (files: File[]) => void uploadProgress?: UploadProgress[] } export function MediaEmptyState({ variant, onClearSearch, onAddFiles, uploadProgress }: MediaEmptyStateProps) { const fileInputRef = React.useRef(null) const uploadPercent = uploadProgress && uploadProgress.length > 0 ? Math.round( uploadProgress.reduce((sum, item) => sum + item.progress, 0) / uploadProgress.length ) : null if (variant === 'loading') { return (
{Array.from({ length: 12 }, (_, index) => ( ))}
) } if (variant === 'empty') { if (uploadPercent !== null) { return ( } title="Uploading…" action={} /> ) } return ( } title="No media" description="Your uploaded files will appear here." action={ {onAddFiles ? ( { const files = Array.from(event.target.files ?? []) event.target.value = '' if (files.length > 0) onAddFiles(files) }} /> ) : null} } /> ) } return ( } title="No media matches your search" description="Try adjusting your search or filters." action={ onClearSearch ? ( ) : undefined } /> ) }