diff --git a/next-tavla/src/Board/scenarios/Table/components/Line/index.tsx b/next-tavla/src/Board/scenarios/Table/components/Line/index.tsx index 6238ed6c5..9260af68a 100644 --- a/next-tavla/src/Board/scenarios/Table/components/Line/index.tsx +++ b/next-tavla/src/Board/scenarios/Table/components/Line/index.tsx @@ -3,6 +3,7 @@ import { DeparturesContext } from '../../contexts' import { TableColumn } from '../TableColumn' import { TableRow } from '../TableRow' import { TravelTag } from 'components/TravelTag' +import { getAirPublicCode } from 'utils/publicCode' function Line() { const departures = useNonNullContext(DeparturesContext) @@ -13,6 +14,7 @@ function Line() { departure.serviceJourney.transportSubmode ?? undefined, publicCode: departure.serviceJourney.line.publicCode ?? '', key: `${departure.serviceJourney.id}_${departure.aimedDepartureTime}`, + id: departure.serviceJourney.id ?? '', })) return ( @@ -23,7 +25,11 @@ function Line() { diff --git a/next-tavla/src/Shared/utils/publicCode.ts b/next-tavla/src/Shared/utils/publicCode.ts new file mode 100644 index 000000000..720e9f93d --- /dev/null +++ b/next-tavla/src/Shared/utils/publicCode.ts @@ -0,0 +1,5 @@ +export function getAirPublicCode(id: string) { + const regex = /AVI:ServiceJourney:([A-Z0-9]+)-\d{2}-\d+/ + const match = id.match(regex) + return match ? match[1] : undefined +}