From d079eba557d834451cd59ffe9b3c70416e75dc76 Mon Sep 17 00:00:00 2001 From: David Corbitt Date: Fri, 18 Aug 2023 00:02:26 -0700 Subject: [PATCH] Allow user to delete scenario without variables --- .../OutputsTable/ScenarioEditor.tsx | 65 ++++++++++--------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/app/src/components/OutputsTable/ScenarioEditor.tsx b/app/src/components/OutputsTable/ScenarioEditor.tsx index 51770aa..7279ff1 100644 --- a/app/src/components/OutputsTable/ScenarioEditor.tsx +++ b/app/src/components/OutputsTable/ScenarioEditor.tsx @@ -111,11 +111,7 @@ export default function ScenarioEditor({ onDrop={onReorder} backgroundColor={isDragTarget ? "gray.100" : "transparent"} > - {variableLabels.length === 0 ? ( - - {vars.data ? "No scenario variables configured" : "Loading..."} - - ) : ( + { Scenario @@ -150,31 +146,38 @@ export default function ScenarioEditor({ )} - {variableLabels.map((key) => { - const value = values[key] ?? ""; - return ( - { - setValues((prev) => ({ ...prev, [key]: e.target.value })); - }} - onKeyDown={(e) => { - if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) { - e.preventDefault(); - e.currentTarget.blur(); - onSave(); - } - }} - onMouseEnter={() => setVariableInputHovered(true)} - onMouseLeave={() => setVariableInputHovered(false)} - /> - ); - })} + + {variableLabels.length === 0 ? ( + + {vars.data ? "No scenario variables configured" : "Loading..."} + + ) : ( + variableLabels.map((key) => { + const value = values[key] ?? ""; + return ( + { + setValues((prev) => ({ ...prev, [key]: e.target.value })); + }} + onKeyDown={(e) => { + if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) { + e.preventDefault(); + e.currentTarget.blur(); + onSave(); + } + }} + onMouseEnter={() => setVariableInputHovered(true)} + onMouseLeave={() => setVariableInputHovered(false)} + /> + ); + }) + )} {hasChanged && (