"use client"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { Loader2, RefreshCw, X, HardDrive, Plug, EjectIcon } from "@/components/icons/platform-icons"; import { useUsbDrives } from "@/modules/files/hooks/useUsbDrives"; import { useQueryClient } from "@tanstack/react-query"; import { queryKeys } from "@/lib/shared/query-keys"; type UsbStorageDialogProps = { isOpen: boolean; onClose: () => void; onNavigateToUsb: (path: string[]) => void; }; export function UsbStorageDialog({ isOpen, onClose, onNavigateToUsb }: UsbStorageDialogProps) { const queryClient = useQueryClient(); const { drives, mount, unmount, eject, isMounting, isUnmounting, isEjecting } = useUsbDrives(); const isBusy = isMounting || isUnmounting || isEjecting; function handleRefresh() { void queryClient.invalidateQueries({ queryKey: queryKeys.usbDrives }); } return ( !open && onClose()}> USB & Removable Storage Manage removable drives connected to your server. {/* Window chrome title bar */}
{/* Traffic lights */}
{/* Centered title */}
USB & Removable Storage
{/* Right actions */}
{/* Content */}
{drives.length === 0 ? (
No removable drives detected. Plug in a USB drive and click Rescan.
) : (

Detected drives

{drives.map((drive) => (
{drive.label} {drive.isMounted && ( Mounted )}
{drive.size} {drive.partitions[0]?.fstype && ( <> · {drive.partitions[0].fstype.toUpperCase()} )} {drive.isMounted && drive.mountpoint && ( <> · )}
{isBusy ? ( ) : drive.isMounted ? ( <> ) : ( )}
))}
)}
); }