More file modal fixes

This commit is contained in:
Will Scullin 2022-07-26 18:05:33 -07:00
parent ac336b3cce
commit a5256ae134
No known key found for this signature in database
GPG Key ID: 26DCD1042C6638CD
2 changed files with 6 additions and 7 deletions

View File

@ -115,7 +115,7 @@ export const Drives = ({ cpu, io, sectors, enhanced, ready }: DrivesProps) => {
setTotal(0);
}));
} else {
const url = isHttp ? hashPart : `/json/disks/${hashPart}.json`;
const url = isHttp ? hashPart : `json/disks/${hashPart}.json`;
loadJSON(disk2, drive, url).catch((e) => setError(e));
}
}
@ -132,7 +132,7 @@ export const Drives = ({ cpu, io, sectors, enhanced, ready }: DrivesProps) => {
const setSmartData = [setSmartData1, setSmartData2];
const callbacks: Callbacks = {
driveLight: (drive, on) => {
setData[drive - 1]?.(data => ({...data, on }));
setData[drive - 1]?.(data => ({ ...data, on }));
},
label: (drive, name, side) => {
setData[drive - 1]?.(data => ({
@ -148,7 +148,7 @@ export const Drives = ({ cpu, io, sectors, enhanced, ready }: DrivesProps) => {
const smartPortCallbacks: Callbacks = {
driveLight: (drive, on) => {
setSmartData[drive - 1]?.(data => ({...data, on }));
setSmartData[drive - 1]?.(data => ({ ...data, on }));
},
label: (drive, name, side) => {
setSmartData[drive - 1]?.(data => ({
@ -157,7 +157,7 @@ export const Drives = ({ cpu, io, sectors, enhanced, ready }: DrivesProps) => {
side,
}));
},
dirty: () => {/* Unused */}
dirty: () => {/* Unused */ }
};
if (cpu && io) {

View File

@ -51,8 +51,7 @@ export const FileModal = ({ disk2, number, onClose, isOpen }: FileModalProps) =>
useEffect(() => {
spawn(async () => {
try {
const indexRequest = fetch('json/disks/index.json');
const indexResponse = await indexRequest;
const indexResponse = await fetch('json/disks/index.json');
const index = await indexResponse.json() as IndexEntry[];
setIndex(index);
} catch (error) {
@ -125,7 +124,7 @@ export const FileModal = ({ disk2, number, onClose, isOpen }: FileModalProps) =>
);
const categoryNames = Object.keys(categories).sort();
const disks = category ? categories[category] : [];
const disks = category ? categories[category].sort() : [];
return (
<>