Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: corrected sortBy toggle values #178

Merged
merged 1 commit into from
Nov 6, 2023
Merged
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
11 changes: 6 additions & 5 deletions src/pages/gapsPatterns/GapsPatternsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { useGapsList } from '../useGapsList'
import { DateSelector } from '../components/DateSelector'
import { INPUT_SIZE } from 'src/resources/sizes'
const { Title } = Typography
import { useTranslation } from 'react-i18next'
// Define prop types for the component
interface BusLineStatisticsProps {
lineRef: number
Expand Down Expand Up @@ -61,7 +62,7 @@ function GapsByHour({ lineRef, operatorRef, fromDate, toDate }: BusLineStatistic
const [sortingMode, setSortingMode] = useState<'hour' | 'severity'>('hour')
const hourlyData = useGapsList(fromDate, toDate, operatorRef, lineRef, sortingMode)
const isLoading = !hourlyData.length

const { t } = useTranslation()
const maxHourlyRides = Math.max(
...hourlyData.map((entry) => entry.planned_rides),
...hourlyData.map((entry) => entry.actual_rides),
Expand All @@ -70,7 +71,7 @@ function GapsByHour({ lineRef, operatorRef, fromDate, toDate }: BusLineStatistic
return (
lineRef > 0 && (
<div className="widget">
<Title level={3}>{TEXTS.dashboard_page_graph_title}</Title>
<Title level={3}>{t('dashboard_page_graph_title')}</Title>

{isLoading && lineRef ? (
<Skeleton active />
Expand All @@ -81,9 +82,9 @@ function GapsByHour({ lineRef, operatorRef, fromDate, toDate }: BusLineStatistic
onChange={(e: RadioChangeEvent) =>
setSortingMode(e.target.value as 'hour' | 'severity')
}
defaultValue="a">
<Radio.Button value="a">{TEXTS.order_by_hour}</Radio.Button>
<Radio.Button value="b">{TEXTS.order_by_severity} </Radio.Button>
value={sortingMode}>
<Radio.Button value="hour">{TEXTS.order_by_hour}</Radio.Button>
<Radio.Button value="severity">{TEXTS.order_by_severity} </Radio.Button>
</Radio.Group>

<ComposedChart
Expand Down
Loading