From d5fc4f818c06eb5ce2314d27ef0140525d10bdf6 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:12:53 -0800 Subject: [PATCH 1/3] Show visible error messages when a dropped file is unused These are cases of user error and should be made apparent to the user. --- .../handleDroppedFiles.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/auspice_client_customisation/handleDroppedFiles.js b/auspice_client_customisation/handleDroppedFiles.js index 1d67656..57caaa2 100644 --- a/auspice_client_customisation/handleDroppedFiles.js +++ b/auspice_client_customisation/handleDroppedFiles.js @@ -108,7 +108,16 @@ async function collectDatasets(dispatch, files) { /* loop through files and, if a sidecar, load it into the associated `Dataset` object */ for (const file of files) { const nameLower = file.name.toLowerCase(); - if (filesSeen.has(nameLower) || !nameLower.endsWith("json")) continue; + if (filesSeen.has(nameLower)) continue; + + if (!nameLower.endsWith("json")) { + dispatch(errorNotification({ + message: `Failed to load ${file.name}.`, + details: "Please refer to the homepage for supported files, and check that your file is named properly." + })); + continue; + } + for (const [sidecarSuffix, sidecarPropName] of Object.entries(sidecarMappings)) { if (nameLower.endsWith(`_${sidecarSuffix}.json`)) { // filename looks like a sidecar file? filesSeen.add(nameLower); @@ -125,7 +134,10 @@ async function collectDatasets(dispatch, files) { } logs.push(`Read ${file.name} as a sidecar file of ${datasets[mainNameLower].name}`); } else { - logs.push(`Sidecar file ${file.name} has no associated main dataset file and has been skipped.`); + dispatch(errorNotification({ + message: `Failed to load ${file.name}.`, + details: "Does the file prefix match a corresponding dataset?" + })); } } } From 47bfed9633c6d322898f8d60cb82c93a2870248d Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:17:43 -0800 Subject: [PATCH 2/3] Use bold instead of quotes to emphasize file suffixes Easier to read. --- auspice_client_customisation/splash.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auspice_client_customisation/splash.js b/auspice_client_customisation/splash.js index 32558e2..cdbb865 100644 --- a/auspice_client_customisation/splash.js +++ b/auspice_client_customisation/splash.js @@ -72,7 +72,7 @@ const SplashContent = (props) => {