Skip to content

Commit 5815b29

Browse files
eran132claude
andcommitted
fix: resolve CI failures and remaining SonarCloud issues
- Reverted Menu.tsx <button> back to <a> to fix E2E test selector - Changed HeaderLinks from div[role=button] to actual <button> elements - Fixed duplicate setRouteKey declaration in useSingleLineData - Used ?? for ternary in ArrivalByTimeChart tooltip - Reverted Recharts Tooltip useCallback (type incompatibility) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent edcb175 commit 5815b29

4 files changed

Lines changed: 15 additions & 26 deletions

File tree

src/hooks/useSingleLineData.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const useSingleLineData = (
2121
) => {
2222
const { search, setSearch } = useContext(SearchContext)
2323
const [routes, setRoutes] = useState<BusRoute[] | undefined>(search.routes)
24-
const [routeKey, setRouteKeyState] = useState<string | undefined>(search.routeKey)
24+
const [routeKey, _setRouteKey] = useState<string | undefined>(search.routeKey)
2525
const [filteredPositions, setFilteredPositions] = useState<Point[]>([])
2626
const [plannedRouteStops, setPlannedRouteStops] = useState<BusStop[]>([])
2727
const [options, setOptions] = useState<{ value: string; label: string }[]>([])
@@ -37,7 +37,7 @@ export const useSingleLineData = (
3737

3838
const setRouteKey = useCallback(
3939
(routeKey?: string) => {
40-
setRouteKeyState(routeKey)
40+
_setRouteKey(routeKey)
4141
setSearch((prev) => ({ ...prev, routeKey }))
4242
},
4343
[setSearch],

src/layout/header/HeaderLinks/HeaderLinks.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,14 @@ const ExternalLink = ({ label, path, icon }: LinkType) => {
3535
window.open(path, '_blank')
3636
}
3737
return (
38-
<div
38+
<button
39+
type="button"
3940
className="header-link"
4041
aria-label={t(label)}
4142
title={t(label)}
42-
role="button"
43-
tabIndex={0}
44-
onClick={handleClick}
45-
onKeyDown={(e) => {
46-
if (e.key === 'Enter' || e.key === ' ') handleClick()
47-
}}>
43+
onClick={handleClick}>
4844
{icon}
49-
</div>
45+
</button>
5046
)
5147
}
5248

@@ -57,18 +53,14 @@ const InternalLink = ({ label, path, icon }: LinkType) => {
5753
navigate(path)
5854
}
5955
return (
60-
<div
56+
<button
57+
type="button"
6158
aria-label={t(label)}
6259
title={t(label)}
6360
className="header-link"
64-
role="button"
65-
tabIndex={0}
66-
onClick={handleClick}
67-
onKeyDown={(e) => {
68-
if (e.key === 'Enter' || e.key === ' ') handleClick()
69-
}}>
61+
onClick={handleClick}>
7062
{icon}
71-
</div>
63+
</button>
7264
)
7365
}
7466

src/layout/sidebar/menu/Menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ const MainMenu = ({ collapsed = false }: MainMenuProps) => {
6666
acc[itm.path] =
6767
itm.label === 'donate_title'
6868
? getItem(
69-
<button type="button" onClick={handleDonateClick}>
69+
<a href="#" onClick={handleDonateClick}>
7070
{t(itm.label)}
71-
</button>,
71+
</a>,
7272
itm.path,
7373
itm.icon,
7474
)

src/pages/dashboard/ArrivalByTimeChart/ArrivalByTimeChart.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,9 @@ const ArrivalByTimeTooltipContent = ({
114114
<InfoTable>
115115
<InfoItem
116116
label={t('sample_time')}
117-
value={dayjs(
118-
payload[0].payload.gtfsRouteHour
119-
? payload[0].payload.gtfsRouteHour
120-
: payload[0].payload.gtfsRouteDate,
121-
).format(payload[0].payload.gtfsRouteHour ? 'HH:mm-DD/MM/YY' : 'DD/MM/YY')}
117+
value={dayjs(payload[0].payload.gtfsRouteHour ?? payload[0].payload.gtfsRouteDate).format(
118+
payload[0].payload.gtfsRouteHour ? 'HH:mm-DD/MM/YY' : 'DD/MM/YY',
119+
)}
122120
/>
123121
<InfoItem label={t('rides_actual')} value={payload[0].payload.current} />
124122
<InfoItem label={t('rides_planned')} value={payload[0].payload.max} />
@@ -137,7 +135,6 @@ export default function ArrivalByTimeChart({
137135
const { t } = useTranslation()
138136
const filteredData = useMemo(() => filterDataByOperator(data, operatorId), [data, operatorId])
139137
const groupedData = useMemo(() => groupDataByHourOrDay(filteredData), [filteredData])
140-
141138
return (
142139
<div className="chart">
143140
{Object.values(groupedData).map((operatorData) => (

0 commit comments

Comments
 (0)