diff --git a/next-tavla/src/Admin/scenarios/SelectLines/index.tsx b/next-tavla/src/Admin/scenarios/SelectLines/index.tsx index d866f6b56..786956685 100644 --- a/next-tavla/src/Admin/scenarios/SelectLines/index.tsx +++ b/next-tavla/src/Admin/scenarios/SelectLines/index.tsx @@ -3,8 +3,25 @@ import { TQuayTile, TStopPlaceTile } from 'types/tile' import { uniqBy } from 'lodash' import classes from './styles.module.css' import { useSettingsDispatch } from 'Admin/utils/contexts' -import { Heading4, SubParagraph } from '@entur/typography' +import { Heading4, Heading5, SubParagraph } from '@entur/typography' import { TLinesFragment } from 'graphql/index' +import { TTransportMode } from 'types/graphql-schema' + +const transportModeNames: Record = { + air: 'Fly', + bus: 'Buss', + cableway: 'Kabelbane', + water: 'Ferje', + funicular: 'Taubane', + lift: 'Heis', + rail: 'Tog', + metro: 'T-bane', + tram: 'Trikk', + trolleybus: 'Trolley-buss', + monorail: 'Enskinnebane', + coach: 'Turbuss', + unknown: 'Ukjent', +} function SelectLines({ tile, @@ -28,6 +45,10 @@ function SelectLines({ }) } + const transportModes: TTransportMode[] = uniqBy(lines, 'transportMode').map( + (line) => line.transportMode ?? 'unknown', + ) + const uniqLines = uniqBy(lines, 'id').sort((a, b) => { if (!a || !a.publicCode || !b || !b.publicCode) return 1 return a.publicCode.localeCompare(b.publicCode, 'no-NB', { @@ -53,23 +74,31 @@ function SelectLines({ > Velg alle -
- {uniqLines.map((line) => ( -
- { - toggleLine(line.id) - }} - > - {line.publicCode} {line.name} - + {transportModes.map((mode) => ( +
+ {transportModeNames[mode]} +
+ {uniqLines + .filter((line) => line.transportMode === mode) + .map((line) => ( +
+ { + toggleLine(line.id) + }} + > + {line.publicCode} {line.name} + +
+ ))}
- ))} -
+
+ ))}
) }