1
1
// @ts -nocheck
2
+ /// <reference lib="dom" />
2
3
/* eslint-disable no-param-reassign */
3
4
import React , { useEffect } from 'react' ;
4
5
import { BarStack } from '@visx/shape' ;
@@ -18,12 +19,12 @@ import {
18
19
} from '../../../actions/actions' ;
19
20
import { useStoreContext } from '../../../store' ;
20
21
import {
21
- snapshot , TooltipData , margin , BarGraphComparisonProps , ActionObj ,
22
+ snapshot , TooltipData , Margin , BarGraphComparisonProps , ActionObj , Series ,
22
23
} from '../../FrontendTypes' ;
23
- import { BarStack } from '@visx/shape/lib/types' ;
24
+ // import { BarStack as BarStacks } from '@visx/shape/lib/types';
24
25
25
26
/* DEFAULTS */
26
- const margin : margin = {
27
+ const margin : Margin = {
27
28
top : 30 , right : 30 , bottom : 0 , left : 50 ,
28
29
} ;
29
30
const axisColor = '#62d6fb' ;
@@ -70,7 +71,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
70
71
const getSnapshotId = ( d : snapshot ) => d . snapshotId ;
71
72
const formatSnapshotId = ( id : string ) : string => `Snapshot ID: ${ id } ` ;
72
73
const formatRenderTime = ( time : string ) : string => `${ time } ms ` ;
73
- const getCurrentTab = ( storedSeries : Record < string , unknown > ) => storedSeries . currentTab ;
74
+ const getCurrentTab = ( storedSeries : ActionObj ) => storedSeries . currentTab ;
74
75
75
76
// create visualization SCALES with cleaned data
76
77
// the domain array/xAxisPoints elements will place the bars along the x-axis
@@ -139,8 +140,11 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
139
140
140
141
const handleSeriesChange = ( event : Event ) => {
141
142
if ( ! event ) return ;
142
- setSeries ( event . target . value ) ;
143
- setAction ( false ) ;
143
+ const target = event . target as HTMLInputElement ;
144
+ if ( target ) {
145
+ setSeries ( target . value ) ;
146
+ setAction ( false ) ;
147
+ }
144
148
} ;
145
149
146
150
const handleClose = ( ) => {
@@ -152,9 +156,12 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
152
156
} ;
153
157
154
158
const handleActionChange = ( event : Event ) => {
155
- if ( ! event . target . value ) return ;
156
- setAction ( event . target . value ) ;
157
- setSeries ( false ) ;
159
+ const target = event . target as HTMLInputElement ;
160
+ if ( ! target . value ) return ;
161
+ if ( target ) {
162
+ setAction ( target . value ) ;
163
+ setSeries ( false ) ;
164
+ }
158
165
} ;
159
166
160
167
const picHandleClose = ( ) => {
@@ -178,14 +185,18 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
178
185
} ) ;
179
186
return data . barStack ;
180
187
}
188
+
181
189
const animateButton = ( e : MouseEvent ) => {
182
190
e . preventDefault ( ) ;
183
- e . target . classList . add ( 'animate' ) ;
184
- e . target . innerHTML = 'Deleted!' ;
185
- setTimeout ( ( ) => {
186
- e . target . innerHTML = 'Clear All Series' ;
187
- e . target . classList . remove ( 'animate' ) ;
188
- } , 1000 ) ;
191
+ const target = ( e . target as HTMLButtonElement ) ;
192
+ if ( target ) {
193
+ target . classList . add ( 'animate' ) ;
194
+ target . innerHTML = 'Deleted!' ;
195
+ setTimeout ( ( ) => {
196
+ target . innerHTML = 'Clear All Series' ;
197
+ target . classList . remove ( 'animate' ) ;
198
+ } , 1000 ) ;
199
+ }
189
200
} ;
190
201
const classname = document . getElementsByClassName ( 'delete-button' ) ;
191
202
for ( let i = 0 ; i < classname . length ; i += 1 ) {
0 commit comments