import { useState } from 'react';
import { FolderOpen } from 'lucide-react';
import FileBrowser from './FileBrowser';
interface IECPageProps {
config: any;
setConfig: (config: any) => void;
}
export default function IECPage({ config, setConfig }: IECPageProps) {
const [showFileBrowser, setShowFileBrowser] = useState(false);
const updateSetting = (path: string[], value: any) => {
const newConfig = JSON.parse(JSON.stringify(config));
let current = newConfig;
for (let i = 0; i < path.length - 1; i++) {
current = current[path[i]];
}
current[path[path.length - 1]] = value;
setConfig(newConfig);
};
const iec = config.iec || {};
return (
IEC Settings
{showFileBrowser && (
{
updateSetting(['iec', 'boot_disk'], path);
setShowFileBrowser(false);
}}
onClose={() => setShowFileBrowser(false)}
/>
)}
Directory Settings
{Object.entries(iec.directory || {}).map(([key, value]) => (
{typeof value === 'number' ? (
) : (
updateSetting(['iec', 'directory', key], parseInt(e.target.value))}
className="w-24 px-3 py-1 border border-neutral-300 rounded-lg text-right"
/>
)}
))}
Hardware Fastloaders
Serial
{Object.entries(iec.fastloaders?.hardware?.serial || {}).map(([key, value]) => (
))}
Parallel
{Object.entries(iec.fastloaders?.hardware?.parallel || {}).map(([key, value]) => (
))}
Software Fastloaders
{Object.entries(iec.fastloaders?.software || {}).map(([key, value]) => (
))}
Chainloaders
{Object.entries(iec.chainloaders || {}).map(([key, value]) => (
))}
);
}