diff --git a/AppImage/components/gpu-switch-mode-indicator.tsx b/AppImage/components/gpu-switch-mode-indicator.tsx index 6f7bb9b2..700f3139 100644 --- a/AppImage/components/gpu-switch-mode-indicator.tsx +++ b/AppImage/components/gpu-switch-mode-indicator.tsx @@ -8,7 +8,6 @@ interface GpuSwitchModeIndicatorProps { pendingMode?: "lxc" | "vm" | null onToggle?: (e: React.MouseEvent) => void className?: string - compact?: boolean } export function GpuSwitchModeIndicator({ @@ -17,483 +16,235 @@ export function GpuSwitchModeIndicator({ 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 + // Colors + const activeColor = isLxcActive ? "#3b82f6" : isVmActive ? "#a855f7" : "#6b7280" + const inactiveColor = "#374151" // gray-700 for dark theme + const lxcColor = isLxcActive ? "#3b82f6" : inactiveColor + const vmColor = isVmActive ? "#a855f7" : inactiveColor + const handleClick = (e: React.MouseEvent) => { - e.stopPropagation() // Prevent card click propagation + e.stopPropagation() 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 - Large with "GPU" text */} + + {/* Main chip body */} + + {/* Chip pins - top */} + + + + {/* Chip pins - bottom */} + + + + {/* GPU text */} + + GPU + + + + {/* Connection line from GPU to switch */} + + + {/* Central Switch Node - Large circle with inner dot */} + + + + {/* LXC Branch Line - going up-right */} + + + {/* VM Branch Line - going down-right */} + + + {/* LXC Container Icon - Server/Stack icon */} + + {/* Container box */} + + {/* Container layers/lines */} + + + {/* Status dots */} + + + + + + {/* LXC Label */} + - {/* GPU Chip Icon - LARGE and colored */} - - - {/* Chip pins top */} - - - - {/* Chip pins bottom */} - - - - - GPU - - + LXC + - {/* Main connection line */} - + {/* Monitor screen */} + - - {/* Switch node */} - - - + {/* Monitor stand */} + + {/* Monitor base */} + + - {/* 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 - + {/* VM Label */} + - Change pending - + style={{ fontFamily: 'system-ui, sans-serif' }} + > + VM + + + + {/* Status Text - Large like GPU name */} +
+ + > + {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... + + )}
) diff --git a/AppImage/components/hardware.tsx b/AppImage/components/hardware.tsx index 43ff1efb..a41258ff 100644 --- a/AppImage/components/hardware.tsx +++ b/AppImage/components/hardware.tsx @@ -19,7 +19,7 @@ import { import { fetchApi } from "@/lib/api-config" import { ScriptTerminalModal } from "./script-terminal-modal" import { GpuSwitchModeIndicator } from "./gpu-switch-mode-indicator" -import { Pencil, Check, X } from "lucide-react" +import { Settings2, CheckCircle2 } from "lucide-react" const parseLsblkSize = (sizeStr: string | undefined): number => { if (!sizeStr) return 0 @@ -884,42 +884,35 @@ export default function Hardware() { className="mt-3 pt-3 border-t border-border/30" onClick={(e) => e.stopPropagation()} > -
+
Switch Mode
{editingSwitchModeGpu === fullSlot ? ( -
- - -
+ Cancel + + + ) : ( - + )}
@@ -928,7 +921,6 @@ export default function Hardware() { isEditing={editingSwitchModeGpu === fullSlot} pendingMode={pendingSwitchModes[gpu.slot] || null} onToggle={(e) => handleSwitchModeToggle(gpu, e)} - compact />
)}