Skip to content

Commit 5338a5a

Browse files
committed
front: move getArrivalTime outside SimulationReportSheet
Signed-off-by: Clara Ni <clara.ni@outlook.fr>
1 parent c6b41da commit 5338a5a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

front/src/applications/stdcm/components/StdcmResults/SimulationReportSheet.tsx

+12-12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ const getStopType = (step: StdcmPathStep, t: TFunction) => {
2525
return capitalizeFirstLetter(t(`stdcm:trainPath.stopType.${step.stopType}`));
2626
};
2727

28+
const getArrivalTime = (step: StdcmPathStep, t: TFunction) => {
29+
if (!step.isVia) {
30+
if (step.arrival && step.arrivalType === 'preciseTime') {
31+
return dateToHHMMSS(step.arrival, { withoutSeconds: true });
32+
}
33+
return t('asap');
34+
}
35+
return '';
36+
};
37+
2838
const SimulationReportSheet = ({
2939
stdcmLinkedPaths,
3040
stdcmData,
@@ -75,16 +85,6 @@ const SimulationReportSheet = ({
7585
[mapImageUrl]
7686
);
7787

78-
const getArrivalTime = (step: StdcmPathStep) => {
79-
if (!step.isVia) {
80-
if (step.arrival && step.arrivalType === 'preciseTime') {
81-
return dateToHHMMSS(step.arrival, { withoutSeconds: true });
82-
}
83-
return t('asap');
84-
}
85-
return '';
86-
};
87-
8888
return (
8989
<Document>
9090
<Page wrap={false} style={styles.main.page} size={[1344]}>
@@ -216,12 +216,12 @@ const SimulationReportSheet = ({
216216
</View>
217217
<View style={styles.convoyAndRoute.stopTableEndWidth}>
218218
<TD style={styles.convoyAndRoute.stopTableItalicColumn}>
219-
{getArrivalTime(step)}
219+
{getArrivalTime(step, t)}
220220
</TD>
221221
</View>
222222
<View style={styles.convoyAndRoute.stopTableStartWidth}>
223223
<TD style={styles.convoyAndRoute.stopTableStartColumn}>
224-
{getArrivalTime(step)}
224+
{getArrivalTime(step, t)}
225225
</TD>
226226
</View>
227227
<View style={styles.convoyAndRoute.stopTableStopTypeWidth}>

0 commit comments

Comments
 (0)