From a5256ae134c741e2d7926b43a9a1cf5ad4fd92be Mon Sep 17 00:00:00 2001 From: Will Scullin Date: Tue, 26 Jul 2022 18:05:33 -0700 Subject: [PATCH] More file modal fixes --- js/components/Drives.tsx | 8 ++++---- js/components/FileModal.tsx | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/js/components/Drives.tsx b/js/components/Drives.tsx index 5817a3a..6297079 100644 --- a/js/components/Drives.tsx +++ b/js/components/Drives.tsx @@ -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) { diff --git a/js/components/FileModal.tsx b/js/components/FileModal.tsx index d2edcd0..3bb0b91 100644 --- a/js/components/FileModal.tsx +++ b/js/components/FileModal.tsx @@ -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 ( <>