/**
* Project analysis viewer component
* Displays results of content analysis including quality metrics and detected moments
*/
import { Eye, Film, MessageSquare, Music, Star, Zap } from "lucide-react"
import { Badge } from "@/components/ui/badge"
import { Card, CardContent, CardDescription, 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 { useContentAnalysis } from "../../hooks/use-content-analysis"
import { MomentCategory } from "../../types"
export function ProjectAnalyzer() {
const { contentStats, averageVideoQuality, averageAudioQuality, topMoments, momentCategoryCounts, fragments } =
useContentAnalysis()
const getCategoryIcon = (category: MomentCategory) => {
const icons = {
[MomentCategory.Highlight]: ,
[MomentCategory.Action]: ,
[MomentCategory.Drama]: ,
[MomentCategory.Comedy]: ,
[MomentCategory.Opening]: ,
[MomentCategory.Closing]: ,
[MomentCategory.BRoll]: ,
[MomentCategory.Transition]: ,
}
return icons[category] ||
}
const getCategoryColor = (category: MomentCategory) => {
const colors = {
[MomentCategory.Highlight]: "bg-yellow-500",
[MomentCategory.Action]: "bg-red-500",
[MomentCategory.Drama]: "bg-purple-500",
[MomentCategory.Comedy]: "bg-green-500",
[MomentCategory.Opening]: "bg-blue-500",
[MomentCategory.Closing]: "bg-indigo-500",
[MomentCategory.BRoll]: "bg-gray-500",
[MomentCategory.Transition]: "bg-cyan-500",
}
return colors[category] || "bg-gray-500"
}
return (
Content Analysis Results
{/* Video Quality */}
Video Quality
{averageVideoQuality.toFixed(0)}%
{/* Audio Quality */}
Audio Quality
{averageAudioQuality.toFixed(0)}%
{/* Action Level */}
Action Level
{contentStats.averageActionLevel.toFixed(0)}%
{/* Speech Presence */}
Speech Presence
{contentStats.speechPresence.toFixed(0)}%
Top Moments
Categories
All Fragments
{/* Top Moments */}
Top Moments
Highest scoring moments detected in your content
{topMoments.map((moment, index) => (
{Number(moment.timestamp || 0).toFixed(1)}s -{" "}
{(Number(moment.timestamp || 0) + Number(moment.duration || 0)).toFixed(1)}s
{moment.category}
{moment.totalScore.toFixed(0)}
{getCategoryIcon(moment.category)}
))}
{/* Categories */}
Moment Categories
Distribution of detected moment types
{Object.entries(momentCategoryCounts).map(([category, count]) => (
{getCategoryIcon(category as MomentCategory)}
{category.replace("-", " ")}
))}
{/* All Fragments */}
All Fragments
Complete list of detected video fragments
{fragments.map((fragment: any) => (
{fragment.videoId}
{fragment.startTime.toFixed(1)}s - {fragment.endTime.toFixed(1)}s
{fragment.description && ` • ${fragment.description}`}
{fragment.tags.slice(0, 3).map((tag: any) => (
{tag}
))}
{fragment.tags.length > 3 && (
+{fragment.tags.length - 3}
)}
{fragment.score.totalScore.toFixed(0)}
))}
)
}