/**
* Analysis Results Component
* Отображает результаты AI анализа
*/
import { cn } from "@/lib/utils"
import type { IntelligentContent } from "../../shared/types"
interface AnalysisResultsProps {
result: IntelligentContent
activeTab: "analysis" | "script" | "platforms"
className?: string
}
export function AnalysisResults({ result, activeTab, className }: AnalysisResultsProps) {
return (
{activeTab === "analysis" &&
}
{activeTab === "script" &&
}
{activeTab === "platforms" &&
}
)
}
function AnalysisTabContent({ result }: { result: IntelligentContent }) {
const { analysis, moments, classification } = result
return (
{/* Content Info */}
Content Analysis
Type:
{analysis.contentType}
Duration:
{formatDuration(analysis.technicalSpecs.duration)}
Resolution:
{analysis.technicalSpecs.resolution.width}x{analysis.technicalSpecs.resolution.height}
Quality:
{analysis.qualityMetrics.overall}/100
{/* Scenes */}
Scenes Detected
{analysis.scenes.slice(0, 5).map((scene, index) => (
Scene {index + 1}: {scene.type}
{formatDuration(scene.duration)}
))}
{analysis.scenes.length > 5 && (
+{analysis.scenes.length - 5} more scenes
)}
{/* Key Moments */}
{moments.length > 0 && (
Key Moments
{moments.slice(0, 3).map((moment) => (
⭐
{moment.type}
{moment.description}
{formatTimestamp(moment.timestamp)}
))}
)}
{/* Insights */}
{analysis.insights && (
AI Insights
{analysis.insights.summary}
{analysis.insights.suggestions.length > 0 && (
{analysis.insights.suggestions.slice(0, 3).map((suggestion, index) => (
💡
{suggestion.description}
))}
)}
)}
)
}
function ScriptTabContent({ result }: { result: IntelligentContent }) {
if (!result.script) {
return (
📝
No script generated yet
Run full pipeline with script generation enabled
)
}
const { script } = result
return (
{/* Script Info */}
{script.title}
Genre:
{script.genre.join(", ")}
Duration:
{formatDuration(script.duration)}
Structure:
{script.structure.type}
Scenes:
{script.scenes.length}
{/* Script Scenes */}
Script Scenes
{script.scenes.slice(0, 5).map((scene) => (
{scene.title}
{formatDuration(scene.duration)}
{scene.description}
))}
)
}
function PlatformsTabContent({ result }: { result: IntelligentContent }) {
if (!result.platformContent || result.platformContent.length === 0) {
return (
🌍
No platform adaptations yet
Run full pipeline with platform adaptation enabled
)
}
return (
{result.platformContent.map((content) => (
{getPlatformIcon(content.platform)}
{getPlatformName(content.platform)}
Resolution:
{content.adaptations.video.resolution.width}x{content.adaptations.video.resolution.height}
Aspect Ratio:
{content.adaptations.video.aspectRatio.ratio}
Duration:
{formatDuration(content.originalContent.duration)}
Language:
{content.metadata.language}
{content.adaptations.text.hashtags.length > 0 && (
Hashtags:
{content.adaptations.text.hashtags.map((tag, index) => (
{tag}
))}
)}
))}
)
}
// 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 formatTimestamp(seconds: number): string {
return formatDuration(seconds)
}
function getPlatformIcon(platform: string): string {
const icons: Record = {
youtube: "📺",
youtube_shorts: "📱",
tiktok: "🎵",
instagram_reels: "📷",
instagram_feed: "📸",
instagram_stories: "⭕",
facebook: "👥",
twitter: "🐦",
linkedin: "💼",
vimeo: "🎬",
twitch: "🎮",
snapchat: "👻",
}
return icons[platform] || "🌐"
}
function getPlatformName(platform: string): string {
const names: Record = {
youtube: "YouTube",
youtube_shorts: "YouTube Shorts",
tiktok: "TikTok",
instagram_reels: "Instagram Reels",
instagram_feed: "Instagram Feed",
instagram_stories: "Instagram Stories",
facebook: "Facebook",
twitter: "Twitter",
linkedin: "LinkedIn",
vimeo: "Vimeo",
twitch: "Twitch",
snapchat: "Snapchat",
}
return names[platform] || platform
}