/* eslint react/no-danger: "off" */
import { Fragment } from 'inferno';
import { useBackend } from '../backend';
import { Button, Section, Table, Flex } from '../components';
import { NtosWindow } from '../layouts';
export const NtosFileManager = (props, context) => {
const { act, data } = useBackend(context);
const { PC_device_theme, usbconnected, filename, filedata, error, files = [], usbfiles = [] } = data;
return (
{(filename && (
)) || (
act('PRG_copytousb', { uid: file })}
onDelete={(file) => act('PRG_deletefile', { uid: file })}
onOpen={(file) => act('PRG_openfile', { uid: file })}
onRename={(file, newName) =>
act('PRG_rename', {
uid: file,
new_name: newName,
})
}
onDuplicate={(file) => act('PRG_clone', { uid: file })}
/>
{(usbconnected && (
act('PRG_copyfromusb', { uid: file })}
onDelete={(file) => act('PRG_deletefile', { uid: file })}
onOpen={(file) => act('PRG_openfile', { uid: file })}
onRename={(file, newName) =>
act('PRG_rename', {
uid: file,
new_name: newName,
})
}
onDuplicate={(file) => act('PRG_clone', { uid: file })}
/>
)) ||
null}
act('PRG_newtextfile')}>
New Text File
)}
{error && (
act('PRG_clearerror')} />
)}
);
};
const FileTable = (props) => {
const { files = [], usbconnected, usbmode, onUpload, onDelete, onRename, onOpen } = props;
return (
File
Type
Size
{files.map((file) => (
{!file.undeletable ? (
onRename(file.uid, value)}
/>
onOpen(file.uid)} />
) : (
file.name
)}
{file.type}
{file.size}
{!file.undeletable && (
onDelete(file.uid)}
/>
{!!usbconnected &&
(usbmode ? (
onUpload(file.uid)} />
) : (
onUpload(file.uid)} />
))}
)}
))}
);
};