@@ -4,9 +4,10 @@ import {
44 hasStatisticsError ,
55} from "../../../../selectors/eventDetailsSelectors" ;
66import TimeSeriesStatistics from "../../../shared/TimeSeriesStatistics" ;
7- import { useAppDispatch , useAppSelector } from "../../../../store" ;
7+ import { useAppSelector } from "../../../../store" ;
88import { fetchEventStatisticsValueUpdate } from "../../../../slices/eventDetailsSlice" ;
99import { useTranslation } from "react-i18next" ;
10+ import { createChartOptions } from "../../../../utils/statisticsUtils" ;
1011
1112/**
1213 * This component manages the statistics tab of the event details modal
@@ -19,16 +20,10 @@ const EventDetailsStatisticsTab = ({
1920 header : string ,
2021} ) => {
2122 const { t } = useTranslation ( ) ;
22- const dispatch = useAppDispatch ( ) ;
2323
2424 const statistics = useAppSelector ( state => getStatistics ( state ) ) ;
2525 const hasError = useAppSelector ( state => hasStatisticsError ( state ) ) ;
2626
27- // TODO: Get rid of the wrappers when modernizing redux is done
28- const fetchEventStatisticsValueUpdateWrapper = ( eventId : any , providerId : any , from : any , to : any , dataResolution : any , timeMode : any ) => {
29- dispatch ( fetchEventStatisticsValueUpdate ( { eventId, providerId, from, to, dataResolution, timeMode} ) ) ;
30- }
31-
3227 /* generates file name for download-link for a statistic */
3328 const statisticsCsvFileName = ( statsTitle : string ) => {
3429 const sanitizedStatsTitle = statsTitle
@@ -68,13 +63,13 @@ const EventDetailsStatisticsTab = ({
6863 timeMode = { stat . timeMode }
6964 dataResolution = { stat . dataResolution }
7065 statDescription = { stat . description }
71- onChange = { fetchEventStatisticsValueUpdateWrapper }
66+ onChange = { fetchEventStatisticsValueUpdate }
7267 exportUrl = { stat . csvUrl }
7368 exportFileName = { statisticsCsvFileName }
7469 totalValue = { stat . totalValue }
7570 sourceData = { stat . values }
7671 chartLabels = { stat . labels }
77- chartOptions = { stat . options }
72+ chartOptions = { createChartOptions ( stat . timeMode , stat . dataResolution ) }
7873 />
7974 </ div >
8075 ) : (
0 commit comments