/** * Quality Controls - Adjust preview quality settings */ import { Eye, Gauge, Monitor, Settings, Zap } from "lucide-react" import { Badge } from "@/components/ui/badge" import { Card } from "@/components/ui/card" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { Slider } from "@/components/ui/slider" import { Switch } from "@/components/ui/switch" import type { GPUTier, PreviewQuality } from "../types" interface QualityControlsProps { quality: PreviewQuality gpuTier: GPUTier onChange: (quality: PreviewQuality) => void className?: string } export function QualityControls({ quality, gpuTier, onChange, className }: QualityControlsProps) { const updateQuality = (updates: Partial) => { onChange({ ...quality, ...updates }) } const getGPUTierInfo = () => { const info = { high: { color: "bg-green-500", description: "High-end GPU detected. All effects supported at full quality.", recommendations: "Use maximum settings for best quality", }, medium: { color: "bg-yellow-500", description: "Mid-range GPU detected. Most effects supported.", recommendations: "Moderate settings recommended for smooth performance", }, low: { color: "bg-red-500", description: "Entry-level GPU detected. Limited effect support.", recommendations: "Lower settings recommended for stable performance", }, } return info[gpuTier] } const getRecommendedSettings = () => { const recommendations = { high: { resolution: 1.0, effects: "all" as const, fps: 30, antialiasing: true, }, medium: { resolution: 0.75, effects: "all" as const, fps: 24, antialiasing: true, }, low: { resolution: 0.5, effects: "basic" as const, fps: 15, antialiasing: false, }, } return recommendations[gpuTier] } const applyRecommended = () => { const recommended = getRecommendedSettings() onChange(recommended) } const getPerformanceEstimate = () => { let score = 100 // Resolution impact score *= quality.resolution // Effects impact if (quality.effects === "all") score *= 0.7 else if (quality.effects === "basic") score *= 0.9 // FPS impact score *= Math.min(1, 24 / quality.fps) // Antialiasing impact if (quality.antialiasing) score *= 0.8 // GPU tier adjustment const gpuMultiplier = { high: 1.5, medium: 1.0, low: 0.6 } score *= gpuMultiplier[gpuTier] return Math.max(0, Math.min(100, score)) } const getPerformanceLabel = (score: number) => { if (score >= 80) return { label: "Excellent", color: "text-green-600" } if (score >= 60) return { label: "Good", color: "text-yellow-600" } if (score >= 40) return { label: "Fair", color: "text-orange-600" } return { label: "Poor", color: "text-red-600" } } const gpuInfo = getGPUTierInfo() const performanceScore = getPerformanceEstimate() const performanceLabel = getPerformanceLabel(performanceScore) return (
{/* GPU Information */}

GPU Information

{gpuTier.toUpperCase()} TIER

{gpuInfo.description}

{gpuInfo.recommendations}
{/* Performance Estimate */}

Performance Estimate

{performanceLabel.label}
Expected Performance {Math.round(performanceScore)}%
{/* Quality Settings */}

Quality Settings

{/* Resolution */}
{Math.round(quality.resolution * 100)}%
updateQuality({ resolution: value / 100 })} max={100} min={25} step={25} className="w-full" />
25% 50% 75% 100%
{/* Effects Quality */}

{quality.effects === "all" && "All effects enabled for maximum quality"} {quality.effects === "basic" && "Only color correction and transforms"} {quality.effects === "none" && "Effects disabled for maximum performance"}

{/* Frame Rate */}
{quality.fps} FPS
updateQuality({ fps: value })} max={60} min={10} step={5} className="w-full" />
10 FPS 30 FPS 60 FPS
{/* Antialiasing */}

Smooth edges but requires more GPU power

updateQuality({ antialiasing: checked })} />
) }