Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/map/use-map-legs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export const useMapLegs = (
t(ComponentText.Map.map.startPoint),
background.accent[0],
);
const endTextPoint = createStartEndTextPoint(endMapLeg.points[0]);
const endTextPoint = createStartEndTextPoint(
endMapLeg.points[endMapLeg.points.length - 1],
);
const endTextLayer = createStartEndTextLayer(
endTextSourceId,
t(ComponentText.Map.map.endPoint),
Expand Down
3 changes: 2 additions & 1 deletion src/page-modules/assistant/details/trip-section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export default function TripSection({
leg.serviceJourney?.id &&
leg.serviceDate &&
leg.fromPlace.quay?.id
? `/departures/details/${leg.serviceJourney.id}?date=${leg.serviceDate}&fromQuayId=${leg.fromPlace.quay.id}`
? `/departures/details/${leg.serviceJourney.id}?date=${leg.serviceDate}&fromQuayId=${leg.fromPlace.quay.id}` +
(leg.toPlace.quay?.id ? `&toQuayId=${leg.toPlace.quay.id}` : '')
: undefined;

return (
Expand Down
3 changes: 3 additions & 0 deletions src/page-modules/departures/details/estimated-call-rows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ export type EstimatedCallRowsProps = {
mode: TransportModeType;
subMode?: TransportSubmode;
alreadyShownSituationNumbers: string[];
toQuayId?: string;
};

export function EstimatedCallRows({
calls,
mode,
subMode,
alreadyShownSituationNumbers,
toQuayId,
}: EstimatedCallRowsProps) {
const { t } = useTranslation();
const [collapsed, setCollapsed] = useState(true);
Expand Down Expand Up @@ -89,6 +91,7 @@ export function EstimatedCallRows({
situations={getSituationsToShowForCall(
call,
alreadyShownSituationNumbers,
toQuayId,
)}
/>
</motion.div>
Expand Down
5 changes: 4 additions & 1 deletion src/page-modules/departures/details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ import { useGoBack } from '@atb/utils/use-go-back';

export type DeparturesDetailsProps = {
fromQuayId?: string;
toQuayId?: string;
serviceJourney: ServiceJourneyType;
};

export function DeparturesDetails({
fromQuayId,
toQuayId,
serviceJourney,
}: DeparturesDetailsProps) {
const { t } = useTranslation();
Expand Down Expand Up @@ -64,7 +66,7 @@ export function DeparturesDetails({
const estimatedCallsWithMetadata = addMetadataToEstimatedCalls(
serviceJourney.estimatedCalls,
fromQuayId,
undefined,
toQuayId,
);

const notices = getNoticesForServiceJourney(serviceJourney, fromQuayId);
Expand Down Expand Up @@ -143,6 +145,7 @@ export function DeparturesDetails({
mode={serviceJourney.transportMode ?? 'unknown'}
subMode={serviceJourney.transportSubmode}
alreadyShownSituationNumbers={alreadyShownSituationNumbers}
toQuayId={toQuayId}
/>
</div>
</section>
Expand Down
8 changes: 8 additions & 0 deletions src/page-modules/departures/server/journey-planner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export type ServiceJourneyInput = {
id: string;
date: Date;
fromQuayId: string;
toQuayId?: string;
};

export type JourneyPlannerApi = {
Expand Down Expand Up @@ -251,13 +252,20 @@ export function createJourneyApi(
(call) => call.quay.id === input.fromQuayId,
)?.quay?.stopPlace;

const toStopPlace = input.toQuayId
? serviceJourney?.estimatedCalls?.find(
(call) => call.quay.id === input.toQuayId,
)?.quay?.stopPlace
: undefined;

return {
...serviceJourney,
mapLegs: mapToMapLegs(
serviceJourney?.pointsOnLink,
transportMode,
transportSubmode,
fromStopPlace,
toStopPlace,
),
};
},
Expand Down
8 changes: 7 additions & 1 deletion src/pages/departures/details/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,21 @@ export const getServerSideProps = withAccessLogging(
const id = params.id.toString();
const date = new Date(query.date.toString());
const fromQuayId = query.fromQuayId.toString();
const toQuayId = query.toQuayId?.toString();

const serviceJourney = await client.serviceJourney({
id,
date,
fromQuayId,
toQuayId,
});

return {
props: { fromQuayId, serviceJourney: serviceJourney },
props: {
fromQuayId,
serviceJourney: serviceJourney,
...(toQuayId ? { toQuayId } : {}),
},
};
},
),
Expand Down
Loading