"use client" import { cn } from "@/lib/utils" interface GpuSwitchModeIndicatorProps { mode: "lxc" | "vm" | "unknown" isEditing?: boolean pendingMode?: "lxc" | "vm" | null onToggle?: (e: React.MouseEvent) => void className?: string compact?: boolean } export function GpuSwitchModeIndicator({ mode, isEditing = false, pendingMode = null, onToggle, className, compact = false, }: GpuSwitchModeIndicatorProps) { const displayMode = pendingMode ?? mode const isLxcActive = displayMode === "lxc" const isVmActive = displayMode === "vm" const hasChanged = pendingMode !== null && pendingMode !== mode const handleClick = (e: React.MouseEvent) => { e.stopPropagation() // Prevent card click propagation if (isEditing && onToggle) { onToggle(e) } } // Compact version for GPU card if (compact) { return (
{/* GPU Chip Icon - LARGER and always colored */} {/* Chip body */} {/* Chip pins top */} {/* Chip pins bottom */} {/* GPU text */} GPU {/* Connection line from GPU to switch */} {/* Switch node - central junction */} {/* Animated dot inside switch */} {/* LXC branch line */} {/* VM branch line */} {/* LXC Icon - Container box */} {/* Container layers */} {/* Dots */} {/* VM Icon - Monitor */} {/* Screen shine */} {/* Stand */} {/* LXC Label */} LXC {/* VM Label */} VM {/* Status description */}
{isLxcActive ? "Ready for LXC containers" : isVmActive ? "Ready for VM passthrough" : "Mode unknown"} {isLxcActive ? "Native driver active" : isVmActive ? "VFIO-PCI driver active" : "No driver detected"} {hasChanged && ( Change pending... )}
) } // Full version (not used in current implementation but kept for flexibility) return (
{/* GPU Chip Icon - LARGE and colored */} {/* Chip pins top */} {/* Chip pins bottom */} GPU {/* Main connection line */} {/* Switch node */} {/* LXC branch */} {/* VM branch */} {/* LXC Container icon */} LXC {/* VM Monitor icon */} VM {/* Status */}
{isLxcActive ? "LXC Mode" : isVmActive ? "VM Mode" : "Unknown"} {isLxcActive ? "Native Driver" : isVmActive ? "VFIO Passthrough" : ""} {isEditing && ( Click to toggle )} {hasChanged && ( Change pending )}
) }