Skip to content

Commit 8ea2feb

Browse files
committed
Co-authored-by: Sean Kelly <[email protected]>
1 parent 626b30b commit 8ea2feb

File tree

4 files changed

+69
-44
lines changed

4 files changed

+69
-44
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
"@fortawesome/react-fontawesome": "^0.1.12",
165165
"@mui/icons-material": "^5.14.1",
166166
"@mui/material": "^5.14.1",
167+
"@mui/styled-engine-sc": "^5.12.0",
167168
"@types/react-dom": "^17.0.14",
168169
"@types/react-router-dom": "^5.3.3",
169170
"@visx/axis": "^1.0.0",
@@ -211,6 +212,7 @@
211212
"react-select": "^3.2.0",
212213
"react-spinners": "^0.11.0",
213214
"recoil": "0.0.10",
215+
"styled-components": "^6.0.4",
214216
"util": "^0.12.4",
215217
"web-vitals": "^1.1.0",
216218
"yarn": "^1.22.19"

src/app/components/App.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import MainContainer from '../containers/MainContainer';
44
import { StoreContext } from '../store';
55
import mainReducer from '../reducers/mainReducer.js';
66
import { InitialStateProps } from '../FrontendTypes';
7+
import { ThemeProvider } from '@mui/material/styles';
8+
import theme from './theme';
79
// currentTab is the current active tab within Google Chrome.
810
// This is used to decide what tab Reactime should be monitoring. This can be "locked"
911
// currentTabInApp is the current active tab within Reactime (Map, Performance, History, etc).
@@ -20,11 +22,13 @@ const initialState: InitialStateProps = {
2022

2123
function App(): JSX.Element {
2224
return (
23-
<Router> {/* we wrap our application with the <Router> tag so that all components that are nested will have the react-router context */}
24-
<StoreContext.Provider value={useReducer(mainReducer, initialState)}> {/* we wrap our MainContainer with the provider so that we will be able to use the store context. We create our store by using useReducer and passing it into the value property */}
25-
<MainContainer />
26-
</StoreContext.Provider>
27-
</Router>
25+
<ThemeProvider theme={theme}>
26+
<Router>
27+
<StoreContext.Provider value={useReducer(mainReducer, initialState)}>
28+
<MainContainer />
29+
</StoreContext.Provider>
30+
</Router>
31+
</ThemeProvider>
2832
);
2933
}
3034

src/app/components/StateRoute/PerformanceVisx/BarGraphComparison.tsx

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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';
55
import { BarStack } from '@visx/shape';
66
import { Group } from '@visx/group';
77
import { Grid } from '@visx/grid';
@@ -10,7 +10,12 @@ import { scaleBand, scaleLinear, scaleOrdinal } from '@visx/scale';
1010
import { useTooltip, useTooltipInPortal, defaultStyles } from '@visx/tooltip';
1111
import { Text } from '@visx/text';
1212
import { 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';
1419
import { onHover, onHoverExit, deleteSeries, setCurrentTabInApp } from '../../../actions/actions';
1520
import { useStoreContext } from '../../../store';
1621
import {
@@ -45,9 +50,13 @@ const tooltipStyles = {
4550
const 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]);
@@ -197,22 +206,22 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
197206
return data.barStack;
198207
}
199208

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-
}
209+
// const animateButton = (e: MouseEvent) => {
210+
// e.preventDefault();
211+
// const target = e.target as HTMLButtonElement;
212+
// if (target) {
213+
// target.classList.add('animate');
214+
// target.innerHTML = 'Deleted!';
215+
// setTimeout(() => {
216+
// target.innerHTML = 'Clear All Series';
217+
// target.classList.remove('animate');
218+
// }, 1000);
219+
// }
220+
// };
221+
// const classname = document.getElementsByClassName('delete-button');
222+
// for (let i = 0; i < classname.length; i += 1) {
223+
// classname[i].addEventListener('click', animateButton, false);
224+
// }
216225
const seriesList: ActionObj[][] = comparison.map((action: Series) => action.data.barStack);
217226
const actionsList: ActionObj[] = seriesList.flat();
218227
const testList: string[] = actionsList.map((elem: ActionObj) => elem.name);
@@ -226,19 +235,34 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
226235
<div>
227236
<div className='series-options-container'>
228237
<div className='dropdown-and-delete-series-container'>
229-
<button
230-
type='button'
238+
<Button
239+
variant='contained'
240+
// type='button'
231241
className='delete-button'
232242
onClick={() => {
243+
setButtonLoad(true);
233244
dispatch(deleteSeries());
245+
246+
setTimeout(() => {
247+
setButtonLoad(false);
248+
}, 1000);
234249
}}
250+
style={
251+
buttonLoad
252+
? { backgroundColor: theme.palette.primary.main }
253+
: { backgroundColor: '#f21861' }
254+
}
235255
>
236-
Clear All Series
237-
</button>
256+
{buttonLoad ? 'Deleted' : 'Clear Series'}
257+
</Button>
238258
<h4 className='compare-series-box' style={{ padding: '0 1rem' }}>
239259
Compare Series:{' '}
240260
</h4>
241-
<StyledFormControl id='selectSeries' variant='outlined'>
261+
<StyledFormControl
262+
id='selectSeries'
263+
variant='outlined'
264+
sx={{ backgroundColor: 'secondary.main' }}
265+
>
242266
<StyledSelect
243267
style={{ color: 'white' }}
244268
labelId='simple-select-outlined-label'

src/app/styles/components/_buttons.scss

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
font: 300 16px 'Roboto', sans-serif;
4242
font-size: $button-text-size;
4343
width: 120px;
44-
background: $red-color-gradient;
44+
// background: $red-color-gradient;
4545
height: 30px;
4646

4747
&.animate {
48-
background: rgb(41, 164, 41);
48+
background-color: rgb(41, 164, 41);
4949
}
5050
}
5151

@@ -95,8 +95,8 @@
9595
border: none;
9696
/* border-radius: 3px; */
9797
background: linear-gradient(145deg, #5c6068, #4d5157);
98-
font: normal 16px "Roboto", sans-serif;
99-
color: #FFFFFF;
98+
font: normal 16px 'Roboto', sans-serif;
99+
color: #ffffff;
100100
display: flex;
101101
justify-content: center;
102102
align-items: center;
@@ -111,8 +111,8 @@
111111
border: transparent;
112112
border-radius: 3px;
113113
background-color: #232529;
114-
font: normal 16px "Roboto", sans-serif;
115-
color: #FFFFFF;
114+
font: normal 16px 'Roboto', sans-serif;
115+
color: #ffffff;
116116
transform: rotateX(90deg);
117117
transition: opacity 300ms, transform 0.15s linear;
118118
opacity: 0;
@@ -251,16 +251,11 @@
251251
.dropdown-dark {
252252
background: #444;
253253
border-color: #111111 #0a0a0a black;
254-
background-image: -webkit-linear-gradient(
255-
top,
256-
transparent,
257-
rgba(0, 0, 0, 0.4)
258-
);
254+
background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.4));
259255
background-image: -moz-linear-gradient(top, transparent, rgba(0, 0, 0, 0.4));
260256
background-image: -o-linear-gradient(top, transparent, rgba(0, 0, 0, 0.4));
261257
background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.4));
262-
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.1),
263-
0 1px 1px rgba(0, 0, 0, 0.2);
258+
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
264259
box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
265260
}
266261

0 commit comments

Comments
 (0)