Skip to content

Commit

Permalink
Use short circuit trick to realize optional ui elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Elscrux committed Jan 23, 2024
1 parent 48bbcba commit e85c8a1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/components/solvers/SolverPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,11 @@ export const SolverPicker = (props: SolverPickerProps) => {
return (
<Container>
{loadingSolvers ? <Text>Loading solvers...</Text> : <SolverSelection />}

{selectedSolver?.authenticationOptions !== undefined &&
selectedSolver?.authenticationOptions !== null
? Authentication(selectedSolver.authenticationOptions)
: null}
selectedSolver?.authenticationOptions !== null &&
Authentication(selectedSolver.authenticationOptions)}

{solverChoice.requestedSolverId == undefined ? (
{solverChoice.requestedSolverId == undefined && (
<SettingsView
problemType={props.problemType}
settingChanged={(settings) => {
Expand All @@ -160,9 +158,9 @@ export const SolverPicker = (props: SolverPickerProps) => {
props.setSolverChoice(newSolverChoice);
}}
/>
) : null}
)}

{subRoutines == undefined || subRoutines.length == 0 ? null : (
{subRoutines != undefined && subRoutines.length != 0 && (
<Box borderWidth="1px" borderRadius="lg" overflow="hidden" p={2}>
{subRoutines.map((def) => (
<SolverPicker
Expand Down

0 comments on commit e85c8a1

Please sign in to comment.