import { AlertTriangle, Brain, Clock, Film, Sparkles, TrendingUp, Zap } from "lucide-react" import { FC, useState } from "react" import { Badge } from "@/components/ui/badge" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Progress } from "@/components/ui/progress" import { ScrollArea } from "@/components/ui/scroll-area" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { cn } from "@/lib/utils" import type { UnifiedContentAnalysis } from "../../shared/types" interface AnalysisViewerProps { analysis: UnifiedContentAnalysis | null className?: string onSceneSelect?: (sceneId: string) => void onMomentSelect?: (momentId: string) => void } export const AnalysisViewer: FC = ({ analysis, className, onSceneSelect, onMomentSelect }) => { const [activeTab, setActiveTab] = useState("overview") if (!analysis) { return (

Нет данных для отображения

Загрузите видео для анализа

) } return (
{/* Header with key metrics */} Результаты AI анализа
} label="Длительность" value={formatDuration(analysis.mediaFile.duration)} /> } label="Сцен" value={analysis.scenes.length.toString()} /> } label="Ключевых моментов" value={analysis.keyMoments.length.toString()} /> } label="Качество" value={`${analysis.qualityMetrics.overall}%`} color={getQualityColor(analysis.qualityMetrics.overall)} />
{/* Tabbed content */} Обзор Сцены Моменты Инсайты Технические данные
) } // Metric Card Component interface MetricCardProps { icon: React.ReactNode label: string value: string color?: string } const MetricCard: FC = ({ icon, label, value, color }) => (
{icon} {label}

{value}

) // Overview Tab const OverviewTab: FC<{ analysis: UnifiedContentAnalysis }> = ({ analysis }) => (
{/* Content Type & Genre */}

Классификация контента

{analysis.contentType.replace(/_/g, " ")} {analysis.genres.map((genre) => ( {genre} ))}
{/* Emotional Tone */}

Эмоциональный тон

{analysis.mood.primary} {Math.round(analysis.mood.intensity * 100)}%
{/* Target Audience */}

Целевая аудитория

Возраст: {analysis.targetAudience.ageRange.min}-{analysis.targetAudience.ageRange.max} лет

{analysis.targetAudience.interests.map((interest) => ( {interest} ))}
{/* Summary */}

Краткое описание

{analysis.insights.summary}

) // Scenes Tab interface ScenesTabProps { scenes: UnifiedContentAnalysis["scenes"] onSceneSelect?: (sceneId: string) => void } const ScenesTab: FC = ({ scenes, onSceneSelect }) => (
{scenes.map((scene) => ( onSceneSelect?.(scene.id)} >
{scene.type} {formatTime(scene.startTime)} - {formatTime(scene.endTime)}

Качество

Объектов

{scene.content.objects.length}

Длительность

{scene.duration.toFixed(1)}с

))}
) // Moments Tab interface MomentsTabProps { moments: UnifiedContentAnalysis["keyMoments"] onMomentSelect?: (momentId: string) => void } const MomentsTab: FC = ({ moments, onMomentSelect }) => (
{moments.map((moment) => ( onMomentSelect?.(moment.id)} >
{moment.type.replace(/_/g, " ")} {formatTime(moment.timestamp)}

{moment.description}

{moment.score}
))}
) // Insights Tab const InsightsTab: FC<{ insights: UnifiedContentAnalysis["insights"] }> = ({ insights }) => (
{/* Highlights */} {insights.highlights.length > 0 && (

Основные моменты

    {insights.highlights.map((highlight, index) => (
  • • {highlight}
  • ))}
)} {/* Suggestions */} {insights.suggestions.length > 0 && (

Рекомендации

{insights.suggestions.map((suggestion, index) => (
{suggestion.type} {suggestion.priority}

{suggestion.description}

))}
)} {/* Warnings */} {insights.warnings.length > 0 && (

Предупреждения

{insights.warnings.map((warning, index) => (
{warning.type} {warning.severity}

{warning.description}

))}
)}
) // Technical Tab interface TechnicalTabProps { specs: UnifiedContentAnalysis["technicalSpecs"] quality: UnifiedContentAnalysis["qualityMetrics"] } const TechnicalTab: FC = ({ specs, quality }) => (
{/* Technical Specifications */}

Технические характеристики

{/* Quality Metrics */}

Метрики качества

) // Helper Components const InfoRow: FC<{ label: string; value: string }> = ({ label, value }) => (
{label}: {value}
) const QualityMetric: FC<{ label: string; value: number; inverse?: boolean }> = ({ label, value, inverse }) => (
{label} {value}%
70 && "bg-green-100")} />
) // Utility functions function formatDuration(seconds: number): string { const hours = Math.floor(seconds / 3600) const minutes = Math.floor((seconds % 3600) / 60) const secs = Math.floor(seconds % 60) if (hours > 0) { return `${hours}:${minutes.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}` } return `${minutes}:${secs.toString().padStart(2, "0")}` } function formatTime(seconds: number): string { const minutes = Math.floor(seconds / 60) const secs = Math.floor(seconds % 60) return `${minutes}:${secs.toString().padStart(2, "0")}` } function formatBitrate(bitrate: number): string { if (bitrate >= 1000000) { return `${(bitrate / 1000000).toFixed(1)} Mbps` } return `${Math.round(bitrate / 1000)} kbps` } function getQualityColor(quality: number): string { if (quality >= 80) return "text-green-600" if (quality >= 60) return "text-yellow-600" return "text-red-600" }