File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
frontends/web/src/routes/account/summary Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,10 @@ class Chart extends Component<Props, State> {
135
135
return this . props . data . chartDataDaily && this . props . data . chartDataDaily . length > 0 ;
136
136
} ;
137
137
138
+ private hasHourlyData = ( ) : boolean => {
139
+ return this . props . data . chartDataHourly && this . props . data . chartDataHourly . length > 0 ;
140
+ } ;
141
+
138
142
private setFormattedData ( data : ChartData ) {
139
143
this . formattedData = { } as FormattedData ;
140
144
@@ -482,11 +486,14 @@ class Chart extends Component<Props, State> {
482
486
} = this . state ;
483
487
const hasDifferenece = difference && Number . isFinite ( difference ) ;
484
488
const hasData = this . hasData ( ) ;
485
- const disableFilters = ! hasData || chartTotal === 0 || chartDataMissing ;
489
+ const hasHourlyData = this . hasHourlyData ( ) ;
490
+ const disableFilters = ! hasData || chartDataMissing ;
491
+ const disableWeeklyFilters = ! hasHourlyData || chartDataMissing ;
486
492
const showMobileTotalValue = toolTipVisible && ! ! toolTipValue && isMobile ;
487
493
const chartFiltersProps = {
488
494
display,
489
495
disableFilters,
496
+ disableWeeklyFilters,
490
497
onDisplayWeek : this . displayWeek ,
491
498
onDisplayMonth : this . displayMonth ,
492
499
onDisplayYear : this . displayYear ,
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import styles from './chart.module.css';
21
21
const Filters = ( {
22
22
display,
23
23
disableFilters,
24
+ disableWeeklyFilters,
24
25
onDisplayWeek,
25
26
onDisplayMonth,
26
27
onDisplayYear,
@@ -31,7 +32,7 @@ const Filters = ({
31
32
< div className = { styles . filters } >
32
33
< button
33
34
className = { display === 'week' ? styles . filterActive : undefined }
34
- disabled = { disableFilters }
35
+ disabled = { disableFilters || disableWeeklyFilters }
35
36
onClick = { onDisplayWeek } >
36
37
{ t ( 'chart.filter.week' ) }
37
38
</ button >
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export type TChartDisplay = 'week' | 'month' | 'year' | 'all';
19
19
export type TChartFiltersProps = {
20
20
display : TChartDisplay
21
21
disableFilters : boolean ;
22
+ disableWeeklyFilters : boolean ;
22
23
onDisplayWeek : ( ) => void ;
23
24
onDisplayMonth : ( ) => void ;
24
25
onDisplayYear : ( ) => void ;
You can’t perform that action at this time.
0 commit comments