Skip to content

Commit 7e47e8f

Browse files
committed
Add explanatory title to DirectionLabel
The direction labels number is not self-explanatory for new users and other people that are not familiar with the software.
1 parent e7f0a18 commit 7e47e8f

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

ui/src/components/routes-and-lines/line-details/DirectionBadge.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@ const testIds = {
66
};
77

88
type Props = {
9+
titleName: string;
910
direction: RouteDirectionEnum;
1011
className?: string;
1112
};
1213

13-
export const DirectionBadge = ({ direction, className = '' }: Props) => {
14+
export const DirectionBadge = ({
15+
titleName,
16+
direction,
17+
className = '',
18+
}: Props) => {
1419
return (
1520
<span
21+
title={titleName}
1622
className={`relative flex h-9 w-9 items-center justify-center bg-brand text-2xl font-bold text-white ${className}`}
1723
>
1824
<span data-testid={testIds.value}>

ui/src/components/routes-and-lines/line-details/ExpandableRouteRow.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const ExpandableRouteRow = ({
6969
<DirectionBadge
7070
direction={route.direction as RouteDirectionEnum}
7171
className="mr-4"
72+
titleName={t(`directionEnum.${route.direction}`)}
7273
/>
7374
<span className="text-xl" data-testid={testIds.label}>
7475
<RouteLabel label={route.label} variant={route.variant} />

ui/src/components/timetables/import/BlockVehicleJourneysTable.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useTranslation } from 'react-i18next';
12
import { VehicleJourneyWithRouteInfoFragment } from '../../../generated/graphql';
23
import { useToggle } from '../../../hooks';
34
import { parseI18nField } from '../../../i18n/utils';
@@ -17,6 +18,7 @@ const VehicleJourneyRow = ({
1718
}: {
1819
vehicleJourney: VehicleJourneyWithRouteInfoFragment;
1920
}): JSX.Element => {
21+
const { t } = useTranslation();
2022
const route =
2123
vehicleJourney.journey_pattern_ref.journey_pattern_instance
2224
?.journey_pattern_route;
@@ -36,6 +38,7 @@ const VehicleJourneyRow = ({
3638
<DirectionBadge
3739
direction={route.direction}
3840
className="mr-2 h-5 w-5 text-base"
41+
titleName={t(`directionEnum.${route.direction}`)}
3942
/>
4043
{getRouteLabelVariantText(route)}
4144
</Row>

ui/src/components/timetables/vehicle-schedule-details/RouteTimetablesSection.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ export const RouteTimetablesSection = ({
7676
<div data-testid={testIds.timetableSection(route.label, route.direction)}>
7777
<Row>
7878
<div className="flex flex-1 items-center bg-background">
79-
<DirectionBadge direction={route.direction} className="my-5 ml-12" />
79+
<DirectionBadge
80+
direction={route.direction}
81+
className="my-5 ml-12"
82+
titleName={t(`directionEnum.${route.direction}`)}
83+
/>
8084
<h3 className="ml-3.5">
8185
<RouteLabel label={route.label} variant={route.variant} />
8286
</h3>

0 commit comments

Comments
 (0)