Skip to content

Commit

Permalink
Replace old widget util by Widget component.
Browse files Browse the repository at this point in the history
  • Loading branch information
yadenmezi authored and yadenmezi committed Dec 10, 2023
1 parent 4f9fc67 commit 95c35cb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/pages/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import RouteSelector from './components/RouteSelector'
//API
// import { /*getGtfsRidesList,*/ getRidesAsync } from 'src/api/profileService'
import { getRoutesAsync } from '../api/gtfsService'
import Widget from 'src/shared/Widget'

// time inputs
// import { DateSelector } from './components/DateSelector'
Expand Down Expand Up @@ -92,7 +93,7 @@ const LineProfileComponent = ({ search }: { search: PageSearchState }) => {

return (
<Grid xs={12} lg={6}>
<div className="widget">
<Widget>
<h2 className="title">{t('profile_page')}</h2>
<label> מפעיל: {search.operatorId} </label>
<br></br>
Expand Down Expand Up @@ -143,7 +144,7 @@ const LineProfileComponent = ({ search }: { search: PageSearchState }) => {
<Label text="הערות ועדכונים על הקו:" />
<div></div>
</div>
</div>
</Widget>
</Grid>
)
}
Expand Down
5 changes: 3 additions & 2 deletions src/pages/dashboard/AllLineschart/AllLinesChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import OperatorHbarChart from './OperatorHbarChart/OperatorHbarChart'
import { GroupByRes, useGroupBy } from 'src/api/groupByService'
import { FC } from 'react'
import { Moment } from 'moment/moment'
import Widget from 'src/shared/Widget'

const convertToChartCompatibleStruct = (arr: GroupByRes[]) => {
return arr.map((item: GroupByRes) => ({
Expand All @@ -29,7 +30,7 @@ export const AllLinesChart: FC<AllChartComponentProps> = ({ startDate, endDate }
})

return (
<div className="widget">
<Widget>
<h2 className="title">
{TEXTS.dashboard_page_title}
<Tooltip
Expand All @@ -44,7 +45,7 @@ export const AllLinesChart: FC<AllChartComponentProps> = ({ startDate, endDate }
) : (
<OperatorHbarChart operators={convertToChartCompatibleStruct(groupByOperatorData)} />
)}
</div>
</Widget>
)
}

Expand Down
5 changes: 3 additions & 2 deletions src/pages/dashboard/ArrivalByTimeChart/DayTimeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Skeleton, Radio, RadioChangeEvent } from 'antd'
import ArrivalByTimeChart from './ArrivalByTimeChart'
import { GroupByRes, useGroupBy } from 'src/api/groupByService'
import { Moment } from 'moment/moment'
import Widget from 'src/shared/Widget'

const convertToGraphCompatibleStruct = (arr: GroupByRes[]) => {
return arr.map((item: GroupByRes) => ({
Expand Down Expand Up @@ -33,7 +34,7 @@ const DayTimeChart: FC<DayTimeChartProps> = ({ startDate, endDate, operatorId })
})

return (
<div className="widget">
<Widget>
<h2 className="title">
{groupByHour ? TEXTS.dashboard_page_graph_title_hour : TEXTS.dashboard_page_graph_title_day}
</h2>
Expand All @@ -52,7 +53,7 @@ const DayTimeChart: FC<DayTimeChartProps> = ({ startDate, endDate, operatorId })
operatorId={operatorId}
/>
)}
</div>
</Widget>
)
}

Expand Down
5 changes: 3 additions & 2 deletions src/pages/dashboard/WorstLinesChart/WorstLinesChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import LinesHbarChart from './LineHbarChart/LinesHbarChart'
import { TEXTS } from 'src/resources/texts'
import { FC } from 'react'
import { Moment } from 'moment/moment'
import Widget from 'src/shared/Widget'

interface WorstLinesChartProps {
startDate: Moment
Expand Down Expand Up @@ -35,7 +36,7 @@ export const WorstLinesChart: FC<WorstLinesChartProps> = ({ startDate, endDate,
}

return (
<div className="widget">
<Widget>
<h2 className="title">{TEXTS.worst_lines_page_title}</h2>
{lineDataLoading ? (
<Skeleton active />
Expand All @@ -45,7 +46,7 @@ export const WorstLinesChart: FC<WorstLinesChartProps> = ({ startDate, endDate,
operators_whitelist={['אלקטרה אפיקים', 'דן', 'מטרופולין', 'קווים', 'אגד']}
/>
)}
</div>
</Widget>
)
}

Expand Down
5 changes: 3 additions & 2 deletions src/pages/gapsPatterns/GapsPatternsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { DateSelector } from '../components/DateSelector'
import { INPUT_SIZE } from 'src/resources/sizes'
const { Title } = Typography
import { useTranslation } from 'react-i18next'
import Widget from 'src/shared/Widget'
// Define prop types for the component
interface BusLineStatisticsProps {
lineRef: number
Expand Down Expand Up @@ -71,7 +72,7 @@ function GapsByHour({ lineRef, operatorRef, fromDate, toDate }: BusLineStatistic

return (
lineRef > 0 && (
<div className="widget">
<Widget>
<Title level={3}>{t('dashboard_page_graph_title')}</Title>

{isLoading && lineRef ? (
Expand Down Expand Up @@ -137,7 +138,7 @@ function GapsByHour({ lineRef, operatorRef, fromDate, toDate }: BusLineStatistic
</ResponsiveContainer>
</>
)}
</div>
</Widget>
)
)
}
Expand Down

0 comments on commit 95c35cb

Please sign in to comment.