-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
front: display simulation results in stdcm
wip front: stdcm: add creation date on simuation results
- Loading branch information
Showing
10 changed files
with
489 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
front/src/applications/stdcmV2/components/StdcmResults.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React, { useState } from 'react'; | ||
|
||
import { CheckCircle } from '@osrd-project/ui-icons'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import type { ManageTrainSchedulePathProperties } from 'applications/operationalStudies/types'; | ||
import type { StdcmV2SuccessResponse } from 'applications/stdcm/types'; | ||
import { generateCodeNumber } from 'applications/stdcm/utils'; | ||
import type { RollingStockWithLiveries } from 'common/api/osrdEditoastApi'; | ||
import { Map } from 'modules/trainschedule/components/ManageTrainSchedule'; | ||
import { formatDateToString } from 'utils/date'; | ||
|
||
import StdcmTableResults from './StdcmTableResults'; | ||
|
||
type StcdmResultsV2Props = { | ||
stdcmData: StdcmV2SuccessResponse; | ||
pathProperties?: ManageTrainSchedulePathProperties; | ||
rollingStockData: RollingStockWithLiveries; | ||
speedLimitByTag?: string; | ||
simulationCreationDate?: Date; | ||
}; | ||
|
||
const StcdmResults = ({ | ||
stdcmData, | ||
pathProperties, | ||
rollingStockData, | ||
speedLimitByTag, | ||
simulationCreationDate, | ||
}: StcdmResultsV2Props) => { | ||
const { t } = useTranslation('stdcm'); | ||
const date = | ||
simulationCreationDate && | ||
t('formattedCreationDate', formatDateToString(simulationCreationDate)); | ||
|
||
const [isSimulationSelected, setIsSimulationSelected] = useState(false); | ||
|
||
const [mapCanvas, setMapCanvas] = useState<string>(); | ||
|
||
const simulationReportSheetNumber = generateCodeNumber(); | ||
|
||
return ( | ||
<main className="stdcm-v2-results"> | ||
<div className="simuation-banner"> | ||
<div | ||
className="simulation-validated" | ||
style={{ color: isSimulationSelected ? '#0B723C' : '' }} | ||
> | ||
Simulation n°1 | ||
{isSimulationSelected && ( | ||
<div className="check-circle"> | ||
<CheckCircle variant="fill" /> | ||
</div> | ||
)} | ||
</div> | ||
<div className="creation-date">{date}</div> | ||
</div> | ||
<div className="simuation-results"> | ||
<StdcmTableResults | ||
stdcmData={stdcmData} | ||
pathProperties={pathProperties} | ||
rollingStockData={rollingStockData} | ||
speedLimitByTag={speedLimitByTag} | ||
creationDate={simulationCreationDate} | ||
simulationReportSheetNumber={simulationReportSheetNumber} | ||
setIsSimulationSelected={setIsSimulationSelected} | ||
mapCanvas={mapCanvas} | ||
isSimulationSelected={isSimulationSelected} | ||
/> | ||
<div className="osrd-config-item-container osrd-config-item-container-map map-results"> | ||
<Map hideAttribution setMapCanvas={setMapCanvas} pathProperties={pathProperties} /> | ||
</div> | ||
</div> | ||
</main> | ||
); | ||
}; | ||
|
||
export default StcdmResults; |
Oops, something went wrong.