Skip to content

Commit c199139

Browse files
Kevin NgoC-STYRCourageWolfDennisLpzdemircaner
committed
Add styling for Save Series button, series dropdown, and Snapshat header
Co-authored-by: C-STYR <[email protected]> Co-authored-by: CourageWolf <[email protected]> Co-authored-by: DennisLpz <[email protected]> Co-authored-by: demircaner <[email protected]>
1 parent c3e9ada commit c199139

File tree

3 files changed

+61
-18
lines changed

3 files changed

+61
-18
lines changed

src/app/components/BarGraphComparison.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import FormHelperText from '@material-ui/core/FormHelperText';
1919
import snapshots from './snapshots';
2020
import { onHover, onHoverExit } from '../actions/actions';
2121
import { useStoreContext } from '../store';
22+
import { save } from '../actions/actions';
2223
/* TYPESCRIPT */
2324
interface data {
2425
snapshotId?: string;
@@ -153,7 +154,7 @@ const BarGraphComparison = (props) => {
153154
// console.log('rendering scale invocation', renderingScale);
154155
// setting max dimensions and scale ranges
155156
const xMax = width - margin.left - margin.right;
156-
const yMax = height - margin.top - 150;
157+
const yMax = height - margin.top - 200;
157158
snapshotIdScale.rangeRound([0, xMax]);
158159
renderingScale.range([yMax, 0]);
159160

@@ -172,6 +173,8 @@ const BarGraphComparison = (props) => {
172173
},
173174
select: {
174175
minWidth: 80,
176+
fontSize: '.75rem',
177+
fontWeight: '200',
175178
border: '1px solid grey',
176179
borderRadius: 4,
177180
color: 'grey',
@@ -196,6 +199,12 @@ const BarGraphComparison = (props) => {
196199
setOpen(true);
197200
};
198201

202+
const toStorage = {
203+
currentTab,
204+
title: tabs[currentTab]['title'],
205+
data,
206+
};
207+
199208
//this function creates a dropdown selection for each series of snapshots saved
200209
// const filterSeries = (comparisonArray) => {
201210
// return comparisonArray.map((sessionName, idx) => {
@@ -218,12 +227,11 @@ const BarGraphComparison = (props) => {
218227
</select>
219228
</div> */}
220229
<div className="series-options-container">
221-
<div className="snapshotId-container">
222-
<h1 className="snashotId-header">
223-
{' '}
224-
Snapshot ID: {currentIndex + 1}{' '}
225-
</h1>
230+
<div className="snapshotId-header">
231+
{' '}
232+
Snapshot ID: {currentIndex + 1}{' '}
226233
</div>
234+
227235
<div className="dropdown-and-save-series-container">
228236
<FormControl variant="outlined" className={classes.formControl}>
229237
<Select
@@ -250,8 +258,16 @@ const BarGraphComparison = (props) => {
250258
)}
251259
</Select>
252260
</FormControl>
261+
262+
<button
263+
className="save-series-button"
264+
onClick={() => dispatch(save(toStorage))}
265+
>
266+
Save Series
267+
</button>
253268
</div>
254269
</div>
270+
255271
<svg ref={containerRef} width={width} height={height}>
256272
{}
257273
<rect
@@ -296,7 +312,7 @@ const BarGraphComparison = (props) => {
296312
return (
297313
<rect
298314
key={`bar-stack-${idx}-NewView`}
299-
x={bar.x + 50}
315+
x={bar.x + 30}
300316
y={bar.y}
301317
height={bar.height === 0 ? null : bar.height}
302318
width={bar.width}
@@ -350,7 +366,7 @@ const BarGraphComparison = (props) => {
350366
return (
351367
<rect
352368
key={`bar-stack-${idx}-${bar.index}`}
353-
x={275}
369+
x={225}
354370
y={bar.y}
355371
height={bar.height === 0 ? null : bar.height}
356372
width={bar.width}

src/app/components/PerformanceVisx.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import FormControlLabel from '@material-ui/core/FormControlLabel';
55
import Switch from '@material-ui/core/Switch';
66
import BarGraph from './BarGraph';
77
import BarGraphComparison from './BarGraphComparison';
8-
import { save } from '../actions/actions';
98
import { useStoreContext } from '../store';
109
import {
1110
MemoryRouter as Router,
@@ -146,12 +145,6 @@ const PerformanceVisx = (props: BarStackProps) => {
146145
// filter and structure incoming data for VISX
147146
const data = getPerfMetrics(snapshots, getSnapshotIds(hierarchy));
148147

149-
const toStorage = {
150-
currentTab,
151-
title: tabs[currentTab]['title'],
152-
data,
153-
};
154-
155148
// Extract individual data from chrome.locals.storage and visualize
156149
// Need to setup dropdown menu . Fill dropdown with tabsID (sessions)
157150
// When you select dropdown, change view with ReactRouter
@@ -216,9 +209,7 @@ const PerformanceVisx = (props: BarStackProps) => {
216209
label="Comparison View"
217210
/>
218211

219-
<button onClick={() => dispatch(save(toStorage))}>Save Series</button>
220-
221-
<div style={{ display: 'flex', 'justify-content': 'center' }}>
212+
<div style={{ display: 'flex', justifyContent: 'center' }}>
222213
{/* {detailsView === 'frequencyCards' ? (
223214
<RenderingFrequency data={data.componentData} />
224215
) : (

src/app/styles/components/_buttons.scss

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
2+
.save-series-button {
3+
padding: 3px;
4+
outline: transparent;
5+
color: white;
6+
display: flex;
7+
justify-content: center;
8+
align-items: center;
9+
border-style: solid;
10+
border-color: transparent;
11+
border-radius: 3px;
12+
cursor: pointer;
13+
line-height: 1.5em;
14+
font: 300 14px 'Roboto', sans-serif;
15+
font-size: $button-text-size;
16+
width: 120px;
17+
background: $red-color-gradient;
18+
height: 30px;
19+
}
20+
.save-series-button:hover {
21+
box-shadow: $box-shadow-red;
22+
}
23+
224
.empty-button {
325
padding: 3px;
426
outline: transparent;
@@ -217,3 +239,17 @@
217239
.MuiSelect-icon {
218240
color: lightgrey !important;
219241
}
242+
.series-options-container {
243+
display: flex;
244+
justify-content: space-between;
245+
align-items: center;
246+
margin: 0 1rem;
247+
}
248+
249+
.snapshotId-header {
250+
font-size: 1rem;
251+
}
252+
.dropdown-and-save-series-container {
253+
display: flex;
254+
align-items: center;
255+
}

0 commit comments

Comments
 (0)