From d3a7348f5883eef08e544f32165417c3fa3703c4 Mon Sep 17 00:00:00 2001 From: yadenmezi Date: Thu, 7 Dec 2023 18:21:23 +0200 Subject: [PATCH 1/3] New Widget Component --- src/shared/Widget.tsx | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/shared/Widget.tsx diff --git a/src/shared/Widget.tsx b/src/shared/Widget.tsx new file mode 100644 index 00000000..5ce1393c --- /dev/null +++ b/src/shared/Widget.tsx @@ -0,0 +1,5 @@ +const Widget = (props: { children: React.ReactNode }) => { + return
{props.children}
+} + +export default Widget From 4f9fc673ec86c3f01d4068b68c0a7dc974fd5f93 Mon Sep 17 00:00:00 2001 From: yadenmezi Date: Sun, 10 Dec 2023 19:18:53 +0200 Subject: [PATCH 2/3] Update storybook: Replace widget with component --- src/pages/components/Widget.stories.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/components/Widget.stories.tsx b/src/pages/components/Widget.stories.tsx index 75652428..064e47a0 100644 --- a/src/pages/components/Widget.stories.tsx +++ b/src/pages/components/Widget.stories.tsx @@ -1,15 +1,16 @@ import type { Meta, StoryObj } from '@storybook/react' import { BusToolTip } from './MapLayers/BusToolTip' import '../../shared/shared.css' +import Widget from 'src/shared/Widget' const meta = { title: 'Components/Widget', component: () => (
-
+ שלום חברים!
ככה נראה widget util -
+
), parameters: { From 95c35cb46c8b1674895333d3be9832a65f35f2ef Mon Sep 17 00:00:00 2001 From: yadenmezi Date: Sun, 10 Dec 2023 19:37:15 +0200 Subject: [PATCH 3/3] Replace old widget util by Widget component. --- src/pages/Profile.tsx | 5 +++-- src/pages/dashboard/AllLineschart/AllLinesChart.tsx | 5 +++-- src/pages/dashboard/ArrivalByTimeChart/DayTimeChart.tsx | 5 +++-- src/pages/dashboard/WorstLinesChart/WorstLinesChart.tsx | 5 +++-- src/pages/gapsPatterns/GapsPatternsPage.tsx | 5 +++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/pages/Profile.tsx b/src/pages/Profile.tsx index 6560f572..fe064698 100644 --- a/src/pages/Profile.tsx +++ b/src/pages/Profile.tsx @@ -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' @@ -92,7 +93,7 @@ const LineProfileComponent = ({ search }: { search: PageSearchState }) => { return ( -
+

{t('profile_page')}



@@ -143,7 +144,7 @@ const LineProfileComponent = ({ search }: { search: PageSearchState }) => {
- +
) } diff --git a/src/pages/dashboard/AllLineschart/AllLinesChart.tsx b/src/pages/dashboard/AllLineschart/AllLinesChart.tsx index 801d19fa..c669894d 100644 --- a/src/pages/dashboard/AllLineschart/AllLinesChart.tsx +++ b/src/pages/dashboard/AllLineschart/AllLinesChart.tsx @@ -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) => ({ @@ -29,7 +30,7 @@ export const AllLinesChart: FC = ({ startDate, endDate } }) return ( -
+

{TEXTS.dashboard_page_title} = ({ startDate, endDate } ) : ( )} -

+ ) } diff --git a/src/pages/dashboard/ArrivalByTimeChart/DayTimeChart.tsx b/src/pages/dashboard/ArrivalByTimeChart/DayTimeChart.tsx index 976622f3..483b15ac 100644 --- a/src/pages/dashboard/ArrivalByTimeChart/DayTimeChart.tsx +++ b/src/pages/dashboard/ArrivalByTimeChart/DayTimeChart.tsx @@ -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) => ({ @@ -33,7 +34,7 @@ const DayTimeChart: FC = ({ startDate, endDate, operatorId }) }) return ( -
+

{groupByHour ? TEXTS.dashboard_page_graph_title_hour : TEXTS.dashboard_page_graph_title_day}

@@ -52,7 +53,7 @@ const DayTimeChart: FC = ({ startDate, endDate, operatorId }) operatorId={operatorId} /> )} -
+ ) } diff --git a/src/pages/dashboard/WorstLinesChart/WorstLinesChart.tsx b/src/pages/dashboard/WorstLinesChart/WorstLinesChart.tsx index 87059d69..55f8e529 100644 --- a/src/pages/dashboard/WorstLinesChart/WorstLinesChart.tsx +++ b/src/pages/dashboard/WorstLinesChart/WorstLinesChart.tsx @@ -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 @@ -35,7 +36,7 @@ export const WorstLinesChart: FC = ({ startDate, endDate, } return ( -
+

{TEXTS.worst_lines_page_title}

{lineDataLoading ? ( @@ -45,7 +46,7 @@ export const WorstLinesChart: FC = ({ startDate, endDate, operators_whitelist={['אלקטרה אפיקים', 'דן', 'מטרופולין', 'קווים', 'אגד']} /> )} -
+ ) } diff --git a/src/pages/gapsPatterns/GapsPatternsPage.tsx b/src/pages/gapsPatterns/GapsPatternsPage.tsx index 6ff0173c..27778c80 100644 --- a/src/pages/gapsPatterns/GapsPatternsPage.tsx +++ b/src/pages/gapsPatterns/GapsPatternsPage.tsx @@ -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 @@ -71,7 +72,7 @@ function GapsByHour({ lineRef, operatorRef, fromDate, toDate }: BusLineStatistic return ( lineRef > 0 && ( -
+ {t('dashboard_page_graph_title')} {isLoading && lineRef ? ( @@ -137,7 +138,7 @@ function GapsByHour({ lineRef, operatorRef, fromDate, toDate }: BusLineStatistic )} -
+ ) ) }