/** * VideoCard Component * * A reusable card component for displaying video information with thumbnail, metadata, and actions. */ import React from 'react'; import { type VideoCardProps } from '../types'; import { VideoThumbnail } from './VideoThumbnail'; import { formatFileSize, formatVideoDate, getRelativeTime, getFormatDisplayName, getStatusBadgeClass, getResolutionString, } from '../utils/videoUtils'; export const VideoCard: React.FC = ({ video, onClick, showMetadata = true, className = '', }) => { const handleClick = () => { if (onClick) { onClick(video); } }; const handleThumbnailClick = () => { handleClick(); }; const cardClasses = [ 'bg-white rounded-xl border border-gray-200 overflow-hidden transition-all hover:shadow-theme-md', onClick ? 'cursor-pointer hover:border-gray-300' : '', className, ].filter(Boolean).join(' '); return (
{/* Thumbnail */}
{/* Status Badge */}
{video.status}
{/* Format Badge */}
{getFormatDisplayName(video.format)}
{/* Streamable Indicator */} {video.is_streamable ? (
Streamable
) : (
Processing
)} {/* Conversion Needed Indicator */} {video.needs_conversion && (
Needs Conversion
)}
{/* Content */}
{/* Title */}

{video.filename}

{/* Camera Name */}
{video.camera_name}
{/* Basic Info */}
Size: {formatFileSize(video.file_size_bytes)}
Created: {getRelativeTime(video.created_at)}
{/* Metadata (if available and requested) */} {showMetadata && 'metadata' in video && video.metadata && (
Duration: {Math.round(video.metadata.duration_seconds)}s
Resolution: {getResolutionString(video.metadata.width, video.metadata.height)}
FPS: {video.metadata.fps}
Codec: {video.metadata.codec}
)} {/* Actions */}
{formatVideoDate(video.created_at)}
{onClick && ( )}
); };