Skip to content

Commit

Permalink
front: remove some conditions in SimulationResults
Browse files Browse the repository at this point in the history
Signed-off-by: Clara Ni <[email protected]>
  • Loading branch information
clarani committed Nov 25, 2024
1 parent 04a742f commit a52b277
Showing 1 changed file with 29 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ const SimulationResults = ({
}
}, [extViewport]);

if (!trainSimulation) return null;

if (trainSimulation.status !== 'success') return null;

return (
<div className="simulation-results">
{/* SIMULATION : STICKY BAR */}
Expand All @@ -122,7 +118,7 @@ const SimulationResults = ({

{/* SIMULATION : SPACE TIME CHART */}
<div className="simulation-warped-map d-flex flex-row align-items-stretch mb-2">
{projectionData && projectionData.projectedTrains.length > 0 && pathProperties && (
{projectionData && projectionData.projectedTrains.length > 0 && (
<>
<button
type="button"
Expand Down Expand Up @@ -197,43 +193,39 @@ const SimulationResults = ({
/>
</div>

{/* TIME STOPS TABLE */}
{selectedTrainSchedule &&
trainSimulation.status === 'success' &&
pathProperties &&
operationalPoints &&
infraId && (
<div className="time-stop-outputs">
<p className="mt-2 mb-3 ml-3 font-weight-bold">{t('timetableOutput')}</p>
<TimesStopsOutput
simulatedTrain={trainSimulation}
pathProperties={pathProperties}
operationalPoints={operationalPoints}
selectedTrainSchedule={selectedTrainSchedule}
path={path}
dataIsLoading={formattedOpPointsLoading}
/>
</div>
)}

{/* SIMULATION EXPORT BUTTONS */}
{selectedTrainSchedule &&
trainSimulation &&
pathProperties &&
selectedTrainRollingStock &&
operationalPoints &&
path &&
infraId && (
<SimulationResultExport
path={path}
scenarioData={scenarioData}
train={selectedTrainSchedule}
simulatedTrain={trainSimulation}
pathElectrifications={pathProperties.electrifications}
operationalPoints={operationalPoints}
rollingStock={selectedTrainRollingStock}
mapCanvas={mapCanvas}
/>
<>
{/* TIME STOPS TABLE */}
<div className="time-stop-outputs">
<p className="mt-2 mb-3 ml-3 font-weight-bold">{t('timetableOutput')}</p>
<TimesStopsOutput
simulatedTrain={trainSimulation}
pathProperties={pathProperties}
operationalPoints={operationalPoints}
selectedTrainSchedule={selectedTrainSchedule}
path={path}
dataIsLoading={formattedOpPointsLoading}
/>
</div>

{/* SIMULATION EXPORT BUTTONS */}
{selectedTrainRollingStock && path && (
<SimulationResultExport
path={path}
scenarioData={scenarioData}
train={selectedTrainSchedule}
simulatedTrain={trainSimulation}
pathElectrifications={pathProperties.electrifications}
operationalPoints={operationalPoints}
rollingStock={selectedTrainRollingStock}
mapCanvas={mapCanvas}
/>
)}
</>
)}
</div>
);
Expand Down

0 comments on commit a52b277

Please sign in to comment.