11// @ts -nocheck
22/// <reference lib="dom" />
33/* eslint-disable no-param-reassign */
4- import React , { useEffect } from 'react' ;
4+ import React , { useEffect , useState } from 'react' ;
55import { BarStack } from '@visx/shape' ;
66import { Group } from '@visx/group' ;
77import { Grid } from '@visx/grid' ;
@@ -10,7 +10,12 @@ import { scaleBand, scaleLinear, scaleOrdinal } from '@visx/scale';
1010import { useTooltip , useTooltipInPortal , defaultStyles } from '@visx/tooltip' ;
1111import { Text } from '@visx/text' ;
1212import { schemeTableau10 } from 'd3-scale-chromatic' ;
13-
13+ import { styled } from '@mui/system' ;
14+ import Select from '@mui/material/Select' ;
15+ import MenuItem from '@mui/material/MenuItem' ;
16+ import FormControl from '@mui/material/FormControl' ;
17+ import { useTheme } from '@mui/material/styles' ;
18+ import { Button } from '@mui/material' ;
1419import { onHover , onHoverExit , deleteSeries , setCurrentTabInApp } from '../../../actions/actions' ;
1520import { useStoreContext } from '../../../store' ;
1621import {
@@ -45,9 +50,13 @@ const tooltipStyles = {
4550const BarGraphComparison = ( props : BarGraphComparisonProps ) : JSX . Element => {
4651 const [ { tabs, currentTab } , dispatch ] = useStoreContext ( ) ;
4752 const { width, height, data, comparison, setSeries, series, setAction } = props ;
48- const [ snapshots ] = React . useState ( 0 ) ;
49- const [ open , setOpen ] = React . useState ( false ) ;
50- const [ picOpen , setPicOpen ] = React . useState ( false ) ;
53+ const [ snapshots ] = useState ( 0 ) ;
54+ const [ open , setOpen ] = useState ( false ) ;
55+ const [ picOpen , setPicOpen ] = useState ( false ) ;
56+ //tracking whether or not the clear series button is clicked
57+ const [ buttonLoad , setButtonLoad ] = useState ( false ) ;
58+
59+ const theme = useTheme ( ) ;
5160 useEffect ( ( ) => {
5261 dispatch ( setCurrentTabInApp ( 'performance-comparison' ) ) ;
5362 } , [ dispatch ] ) ;
@@ -113,25 +122,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
113122 snapshotIdScale . rangeRound ( [ 0 , xMax ] ) ;
114123 renderingScale . range ( [ yMax , 0 ] ) ;
115124
116- // useStyles will change the styling on save series dropdown feature
117- // const useStyles = makeStyles((theme) => ({
118- // formControl: {
119- // margin: theme.spacing(1),
120- // minWidth: 80,
121- // height: 30,
122- // },
123- // select: {
124- // minWidth: 80,
125- // fontSize: '.75rem',
126- // fontWeight: 200,
127- // border: '1px solid grey',
128- // borderRadius: 4,
129- // color: 'grey',
130- // height: 30,
131- // },
132- // }));
133125
134- // const classes = useStyles();
135126
136127 const StyledFormControl = styled ( FormControl ) ( ( { theme } ) => ( {
137128 margin : theme . spacing ( 1 ) ,
@@ -143,9 +134,6 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
143134 minWidth : 80 ,
144135 fontSize : '.75rem' ,
145136 fontWeight : 200 ,
146- border : '1px solid grey' ,
147- borderRadius : 4 ,
148- color : 'grey' ,
149137 height : 30 ,
150138 } ) ;
151139
@@ -197,22 +185,6 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
197185 return data . barStack ;
198186 }
199187
200- const animateButton = ( e : MouseEvent ) => {
201- e . preventDefault ( ) ;
202- const target = e . target as HTMLButtonElement ;
203- if ( target ) {
204- target . classList . add ( 'animate' ) ;
205- target . innerHTML = 'Deleted!' ;
206- setTimeout ( ( ) => {
207- target . innerHTML = 'Clear All Series' ;
208- target . classList . remove ( 'animate' ) ;
209- } , 1000 ) ;
210- }
211- } ;
212- const classname = document . getElementsByClassName ( 'delete-button' ) ;
213- for ( let i = 0 ; i < classname . length ; i += 1 ) {
214- classname [ i ] . addEventListener ( 'click' , animateButton , false ) ;
215- }
216188 const seriesList : ActionObj [ ] [ ] = comparison . map ( ( action : Series ) => action . data . barStack ) ;
217189 const actionsList : ActionObj [ ] = seriesList . flat ( ) ;
218190 const testList : string [ ] = actionsList . map ( ( elem : ActionObj ) => elem . name ) ;
@@ -226,21 +198,38 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
226198 < div >
227199 < div className = 'series-options-container' >
228200 < div className = 'dropdown-and-delete-series-container' >
229- < button
230- type = 'button'
201+ < Button
202+ variant = 'contained'
203+ sx = { { p : 2 , color : 'white' } }
204+ // type='button'
231205 className = 'delete-button'
232206 onClick = { ( ) => {
207+ setButtonLoad ( true ) ;
233208 dispatch ( deleteSeries ( ) ) ;
209+
210+ setTimeout ( ( ) => {
211+ setButtonLoad ( false ) ;
212+ } , 1000 ) ;
234213 } }
214+ style = {
215+ buttonLoad
216+ ? { backgroundColor : theme . palette . secondary . main }
217+ : //KYLE YOU LEFT OFF HERE
218+ { backgroundColor : theme . palette . primary . main }
219+ }
235220 >
236- Clear All Series
237- </ button >
221+ { buttonLoad ? 'Deleted' : 'Clear Series' }
222+ </ Button >
238223 < h4 className = 'compare-series-box' style = { { padding : '0 1rem' } } >
239224 Compare Series:{ ' ' }
240225 </ h4 >
241- < StyledFormControl id = 'selectSeries' variant = 'outlined' >
226+ < StyledFormControl
227+ id = 'selectSeries'
228+ variant = 'outlined'
229+ label = 'compares series'
230+ // sx={{ backgroundColor: theme.palette.primary.main }}
231+ >
242232 < StyledSelect
243- style = { { color : 'white' } }
244233 labelId = 'simple-select-outlined-label'
245234 open = { open }
246235 onClose = { handleClose }
@@ -285,7 +274,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
285274 </ div >
286275
287276 < svg ref = { containerRef } width = { width } height = { height } >
288- { }
277+ { }
289278 < rect x = { 0 } y = { 0 } width = { width } height = { height } fill = { background } rx = { 14 } />
290279 < Grid
291280 top = { margin . top }
0 commit comments