Skip to content

Commit

Permalink
front: clean simulation map style (scenario results)
Browse files Browse the repository at this point in the history
Signed-off-by: Clara Ni <clara.ni@outlook.fr>
  • Loading branch information
clarani committed Oct 24, 2024
1 parent 138a081 commit 0824a99
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState, useRef, useMemo } from 'react';
import { useEffect, useState, useMemo } from 'react';

import { ChevronLeft, ChevronRight } from '@osrd-project/ui-icons';
import cx from 'classnames';
Expand All @@ -22,7 +22,6 @@ import { useFormattedOperationalPoints } from 'modules/trainschedule/useFormatte
import { updateViewport, type Viewport } from 'reducers/map';
import { useAppDispatch } from 'store';

const MAP_MIN_HEIGHT = 450;
const SPEED_SPACE_CHART_HEIGHT = 521.5;
const HANDLE_TAB_RESIZE_HEIGHT = 20;

Expand Down Expand Up @@ -53,13 +52,11 @@ const SimulationResults = ({
const { t } = useTranslation('simulation');
const dispatch = useAppDispatch();

const timeTableRef = useRef<HTMLDivElement | null>(null);
const [extViewport, setExtViewport] = useState<Viewport | undefined>(undefined);
const [extViewport, setExtViewport] = useState<Viewport>();
const [showWarpedMap, setShowWarpedMap] = useState(false);

const [speedSpaceChartContainerHeight, setSpeedSpaceChartContainerHeight] =
useState(SPEED_SPACE_CHART_HEIGHT);
const [heightOfSimulationMap] = useState(MAP_MIN_HEIGHT);

const {
operationalPoints,
Expand Down Expand Up @@ -191,6 +188,23 @@ const SimulationResults = ({
</div>
)}

{/* SIMULATION : MAP */}
<div className="simulation-map">
<SimulationResultsMap
setExtViewport={setExtViewport}
geometry={pathProperties?.geometry}
trainSimulation={
selectedTrainSchedule && trainSimulation
? {
...trainSimulation,
trainId: selectedTrainSchedule.id,
startTime: selectedTrainSchedule.start_time,
}
: undefined
}
/>
</div>

{/* TIME STOPS TABLE */}
{selectedTrainSchedule &&
trainSimulation.status === 'success' &&
Expand All @@ -209,27 +223,6 @@ const SimulationResults = ({
</div>
)}

{/* SIMULATION : MAP */}
<div ref={timeTableRef}>
<div className="osrd-simulation-container mb-2">
<div className="osrd-simulation-map" style={{ height: `${heightOfSimulationMap}px` }}>
<SimulationResultsMap
setExtViewport={setExtViewport}
geometry={pathProperties?.geometry}
trainSimulation={
selectedTrainSchedule && trainSimulation
? {
...trainSimulation,
trainId: selectedTrainSchedule.id,
startTime: selectedTrainSchedule.start_time,
}
: undefined
}
/>
</div>
</div>
</div>

{/* TRAIN : DRIVER TRAIN SCHEDULE */}
{selectedTrainSchedule &&
trainSimulation &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const SimulationResultMap = ({ geometry, trainSimulation }: SimulationResultMapP
{...viewport}
cursor="pointer"
ref={mapRef}
style={{ width: '100%', height: '100%' }}
style={{ width: '100%', height: '100%', borderRadius: '10px' }}
mapStyle={mapBlankStyle}
onMove={(e) => updateViewportChange(e.viewState)}
attributionControl={false} // Defined below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,18 @@
border-radius: 4px;

&.speedspacechart-container {
background-color: rgb(247, 246, 238);
margin-bottom: 41px;
}
}

.simulation-map {
position: relative;
height: 720px;
margin: 0 30px 56px 38px;
border-radius: 10px;
box-shadow: 0 1px 0 rgba(255, 255, 255, 1) inset, 0 4px 7px -3px rgba(255, 171, 88, 0.17), 0 2px 4px rgba(0, 0, 0, 0.22);
}

/* MAP */
.train-speed-label {
text-shadow: 0 0 3px #fff;
Expand Down

0 comments on commit 0824a99

Please sign in to comment.