import React from 'react'; import { GpuInfo } from '@/types'; import { ChevronRight, Thermometer, Zap, Clock, HardDrive, Fan, Cpu } from 'lucide-react'; interface GPUWidgetProps { gpu: GpuInfo; } export default function GPUWidget({ gpu }: GPUWidgetProps) { const formatMemory = (mb: number): string => { return mb >= 1024 ? `${(mb / 1024).toFixed(1)} GB` : `${mb} MB`; }; const getUtilizationColor = (value: number): string => { return value < 30 ? 'bg-emerald-500' : value < 70 ? 'bg-amber-500' : 'bg-rose-500'; }; const getTemperatureColor = (temp: number): string => { return temp < 50 ? 'text-emerald-500' : temp < 80 ? 'text-amber-500' : 'text-rose-500'; }; return (

{gpu.name}

#{gpu.index}
{/* Temperature, Fan, and Utilization Section */}

Temperature

{gpu.temperature}°C

Fan Speed

{gpu.fan.speed}%

GPU Load

{gpu.utilization.gpu}%

Memory

{((gpu.memory.used / gpu.memory.total) * 100).toFixed(1)}%

{formatMemory(gpu.memory.used)} / {formatMemory(gpu.memory.total)}

{/* Power and Clocks Section */}

Clock Speed

{gpu.clocks.graphics} MHz

Power Draw

{gpu.power.draw?.toFixed(1)}W / {gpu.power.limit?.toFixed(1) || ' ? '}W

); }