diff --git a/src/app/components/DeviceDetailOverlay.tsx b/src/app/components/DeviceDetailOverlay.tsx index 02d0136..8d34417 100644 --- a/src/app/components/DeviceDetailOverlay.tsx +++ b/src/app/components/DeviceDetailOverlay.tsx @@ -4,6 +4,7 @@ import { motion, AnimatePresence } from 'motion/react'; import { toast } from 'sonner'; import { getFileContents, joinPath } from '../webdav'; import FileBrowser from './FileBrowser'; +import MediaSet from './MediaSet'; interface Device { id: string; @@ -340,26 +341,7 @@ export default function DeviceDetailOverlay({ {mediaSetFiles && (
- -
- {mediaSetFiles.map((file: string, index: number) => { - const fileName = file.split('/').pop() || file; - const title = fileName.replace(/\.[^.]+$/, ''); - return ( - - ); - })} -
+
)} diff --git a/src/app/components/MediaSet.tsx b/src/app/components/MediaSet.tsx new file mode 100644 index 0000000..1de5c45 --- /dev/null +++ b/src/app/components/MediaSet.tsx @@ -0,0 +1,33 @@ +interface MediaSetProps { + files: string[]; + activeUrl: string; + onSwitch: (file: string) => void; +} + +export default function MediaSet({ files, activeUrl, onSwitch }: MediaSetProps) { + return ( +
+
Media Set
+
+ {files.map((file, index) => { + const fileName = file.split('/').pop() || file; + const title = fileName.replace(/\.[^.]+$/, ''); + const active = activeUrl === file; + return ( + + ); + })} +
+
+ ); +} diff --git a/src/app/components/StatusPage.tsx b/src/app/components/StatusPage.tsx index 6d03db7..f9b833e 100644 --- a/src/app/components/StatusPage.tsx +++ b/src/app/components/StatusPage.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from 'react'; import { HardDrive, Activity, Wifi, Signal, Clock, RefreshCw, FolderOpen, Map, Loader2 } from 'lucide-react'; import DeviceDetailOverlay from './DeviceDetailOverlay'; +import MediaSet from './MediaSet'; import { ImageWithFallback } from './figma/ImageWithFallback'; import { Dialog, DialogContent, DialogTitle, DialogDescription } from './ui/dialog'; import DirectoryListing from './DirectoryListing'; @@ -34,6 +35,24 @@ export default function StatusPage({ config, setConfig }: StatusPageProps) { const activeDevice = findActiveDevice(); + const mediaSetFiles: string[] | null = (() => { + if (!activeDevice?.url) return null; + if (Array.isArray(activeDevice.mediaSet) && activeDevice.mediaSet.length > 0) + return activeDevice.mediaSet as string[]; + const match = (activeDevice.url as string).match(/^(.+?)(\d+)(\.[^.]+)$/); + if (!match) return null; + const [, prefix, , ext] = match; + return Array.from({ length: 10 }, (_, i) => `${prefix}${i + 1}${ext}`); + })(); + + const switchActiveMedia = (file: string) => { + const newConfig = JSON.parse(JSON.stringify(config)); + if (newConfig.iec?.devices?.drive?.[activeDevice!.number]) { + newConfig.iec.devices.drive[activeDevice!.number].url = file; + setConfig(newConfig); + } + }; + // Mock activity log - in a real app this would come from device monitoring const activityLog = [ { time: '14:32:15', event: 'File opened: game.d64', type: 'info' }, @@ -133,6 +152,12 @@ export default function StatusPage({ config, setConfig }: StatusPageProps) {
+ {mediaSetFiles && ( +
+ +
+ )} + {/* Directory and Disk Map buttons at bottom */} {/* New device info cards */} @@ -170,47 +195,6 @@ export default function StatusPage({ config, setConfig }: StatusPageProps) { )} - {/* Media switch buttons if media set is detected */} - {(() => { - // Media set detection logic (copied from DeviceDetailOverlay) - const url = activeDevice.url; - if (!url) return null; - const match = url.match(/^(.+?)(\d+)(\.[^.]+)$/); - if (!match) return null; - const [, prefix, num, ext] = match; - const currentNum = parseInt(num); - const mediaSet = []; - for (let i = 1; i <= 10; i++) { - mediaSet.push(`${prefix}${i}${ext}`); - } - return ( -
- {mediaSet.map((file, idx) => { - const fileName = file.split('/').pop() || file; - const title = fileName.replace(/\.[^.]+$/, ''); - return ( - - ); - })} -
- ); - })()}
-
+
{!activeDevice?.url && (
No file mounted on this device. @@ -293,24 +277,24 @@ export default function StatusPage({ config, setConfig }: StatusPageProps) { /> )}
-
+ )} {/* Disk Map Overlay */} {showDiskMap && ( -
-
setShowDiskMap(false)} /> -
+ <> +
setShowDiskMap(false)} /> +
e.stopPropagation()}>

Disk Map

-
+
Disk map visualization goes here.
-
+ )} {/* Reset Activity Modal */} !open && setShowResetModal(null)}>