Skip to content

Commit

Permalink
front: add track column to timestops table
Browse files Browse the repository at this point in the history
Signed-off-by: Alice Khoudli <[email protected]>
  • Loading branch information
Synar committed Nov 7, 2024
1 parent 95c1305 commit 29742bf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions front/public/locales/en/timesStops.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"theoreticalMargin": "theoretical margin",
"theoreticalMarginPlaceholder": "% or min/100km",
"theoreticalMarginSeconds": "theoretical margin (s)",
"trackName": "track",
"waypoint": "Waypoint {{id}}"
}
1 change: 1 addition & 0 deletions front/public/locales/fr/timesStops.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"theoreticalMargin": "marge théorique",
"theoreticalMarginPlaceholder": "% ou min/100km",
"theoreticalMarginSeconds": "marge théorique (s)",
"trackName": "voie",
"waypoint": "Via {{id}}"
}
2 changes: 2 additions & 0 deletions front/src/modules/timesStops/hooks/useOutputTableData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function useOutputTableData(
: null;
const calculatedArrival = checkAndFormatCalculatedArrival(scheduleData, opPoint.time);
return {
trackName: opPoint.track_name,
...sugOpPoint,
...formattedScheduleData,
receptionSignal: schedule?.reception_signal,
Expand All @@ -124,6 +125,7 @@ function useOutputTableData(
}

return {
trackName: opPoint.track_name,
...sugOpPoint,
calculatedArrival: secToHoursString(opPoint.time, { withSeconds: true }),
};
Expand Down
11 changes: 11 additions & 0 deletions front/src/modules/timesStops/hooks/useTimeStopsColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ export const useTimeStopsColumns = <T extends TimeStopsRow>(
disabled: true,
...fixedWidth(45),
},
{
...keyColumn('trackName', createTextColumn()),
title: t('trackName'),
component: ({ rowData }) => (
<span title={rowData.trackName} className="ml-1 text-nowrap overflow-hidden">
{rowData.trackName}
</span>
),
disabled: true,
...fixedWidth(85),
},
{
...keyColumn('arrival', timeColumn(isOutputTable)),
title: t('arrivalTime'),
Expand Down
1 change: 1 addition & 0 deletions front/src/modules/timesStops/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type TimeStopsRow = {
opId: string;
name?: string;
ch?: string;
trackName?: string;
isWaypoint: boolean;

arrival?: TimeExtraDays; // value asked by user
Expand Down

0 comments on commit 29742bf

Please sign in to comment.