From e85c8a12530f04045ff3b6820171f04773f22893 Mon Sep 17 00:00:00 2001 From: nickp Date: Tue, 23 Jan 2024 13:19:37 +0100 Subject: [PATCH] Use short circuit trick to realize optional ui elements --- src/components/solvers/SolverPicker.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/solvers/SolverPicker.tsx b/src/components/solvers/SolverPicker.tsx index 2db33b2..ed3a3fd 100644 --- a/src/components/solvers/SolverPicker.tsx +++ b/src/components/solvers/SolverPicker.tsx @@ -141,13 +141,11 @@ export const SolverPicker = (props: SolverPickerProps) => { return ( {loadingSolvers ? Loading solvers... : } - {selectedSolver?.authenticationOptions !== undefined && - selectedSolver?.authenticationOptions !== null - ? Authentication(selectedSolver.authenticationOptions) - : null} + selectedSolver?.authenticationOptions !== null && + Authentication(selectedSolver.authenticationOptions)} - {solverChoice.requestedSolverId == undefined ? ( + {solverChoice.requestedSolverId == undefined && ( { @@ -160,9 +158,9 @@ export const SolverPicker = (props: SolverPickerProps) => { props.setSolverChoice(newSolverChoice); }} /> - ) : null} + )} - {subRoutines == undefined || subRoutines.length == 0 ? null : ( + {subRoutines != undefined && subRoutines.length != 0 && ( {subRoutines.map((def) => (