Skip to content

Commit 283a1b2

Browse files
committed
Troubleshooting Link Fiber
2 parents 129f2da + a7cb01a commit 283a1b2

File tree

6 files changed

+158
-93
lines changed

6 files changed

+158
-93
lines changed

src/app/components/BarGraph.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { schemeSet3 } from 'd3-scale-chromatic';
1212
import snapshots from './snapshots';
1313
import { onHover, onHoverExit } from '../actions/actions';
1414
import { useStoreContext } from '../store';
15+
import { save } from '../actions/actions';
1516

1617
/* TYPESCRIPT */
1718
interface data {
@@ -102,8 +103,35 @@ const BarGraph = (props) => {
102103
const yMax = height - margin.top - 150;
103104
snapshotIdScale.rangeRound([0, xMax]);
104105
renderingScale.range([yMax, 0]);
106+
107+
const toStorage = {
108+
currentTab,
109+
title: tabs[currentTab]['title'],
110+
data,
111+
};
112+
113+
const animateButton = function (e) {
114+
e.preventDefault;
115+
e.target.classList.add('animate');
116+
e.target.innerHTML = 'Saved!';
117+
setTimeout(function () {
118+
e.target.innerHTML = 'Save Series';
119+
e.target.classList.remove('animate');
120+
}, 1000);
121+
};
122+
const classname = document.getElementsByClassName('save-series-button');
123+
for (let i = 0; i < classname.length; i++) {
124+
classname[i].addEventListener('click', animateButton, false);
125+
}
105126
return (
106127
<div>
128+
<button
129+
className='save-series-button'
130+
onClick={(e) => {
131+
dispatch(save(toStorage))
132+
}}>
133+
Save Series
134+
</button>
107135
<svg ref={containerRef} width={width} height={height}>
108136
{}
109137
<rect
@@ -177,6 +205,8 @@ const BarGraph = (props) => {
177205
)
178206
}
179207
</BarStack>
208+
209+
180210
</Group>
181211
<AxisLeft
182212
top={margin.top}

src/app/components/BarGraphComparison.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +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';
22+
// import { save } from '../actions/actions';
2323
/* TYPESCRIPT */
2424
interface data {
2525
snapshotId?: string;
@@ -178,13 +178,7 @@ const BarGraphComparison = (props) => {
178178
setXpoints();
179179
};
180180

181-
const toStorage = {
182-
currentTab,
183-
title: tabs[currentTab]['title'],
184-
data,
185-
};
186-
187-
//manually assignin X -axis points with current Tab keys.
181+
//manually assignin X -axis points with tab ID.
188182
function setXpointsComparison() {
189183
comparison[series].data.barStack.forEach((elem) => {
190184
elem.currentTab = 'comparison';
@@ -231,13 +225,6 @@ const BarGraphComparison = (props) => {
231225
)}
232226
</Select>
233227
</FormControl>
234-
235-
<button
236-
className='save-series-button'
237-
onClick={() => dispatch(save(toStorage))}
238-
>
239-
Save Series
240-
</button>
241228
</div>
242229
</div>
243230

src/app/containers/MainContainer.tsx

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from '../actions/actions';
1414
import { useStoreContext } from '../store';
1515
import MPID from '../user_id/user_id';
16+
import { useState } from 'react';
1617

1718
const mixpanel = require('mixpanel').init('12fa2800ccbf44a5c36c37bc9776e4c0', {
1819
debug: false,
@@ -22,6 +23,7 @@ const mixpanel = require('mixpanel').init('12fa2800ccbf44a5c36c37bc9776e4c0', {
2223
function MainContainer(): any {
2324
const [store, dispatch] = useStoreContext();
2425
const { tabs, currentTab, port: currentPort } = store;
26+
///const [sideBarView , setSideBar] = useState();
2527
// add event listeners to background script
2628
useEffect(() => {
2729
// only open port once
@@ -114,12 +116,12 @@ function MainContainer(): any {
114116

115117
if (!tabs[currentTab]) {
116118
return (
117-
<div className="error-container">
118-
<img src="../assets/logo-no-version.png" height="50px" />
119+
<div className='error-container'>
120+
<img src='../assets/logo-no-version.png' height='50px' />
119121
<a
120-
href="https://reactime.io/"
121-
target="_blank"
122-
rel="noopener noreferrer"
122+
href='https://reactime.io/'
123+
target='_blank'
124+
rel='noopener noreferrer'
123125
>
124126
No React application found. Please visit reactime.io to more info.
125127
</a>
@@ -175,10 +177,31 @@ function MainContainer(): any {
175177
};
176178
const snapshotDisplay = statelessCleaning(snapshotView);
177179
const hierarchyDisplay = statelessCleaning(hierarchy);
180+
const bodyGrid = document.getElementsByClassName('body-container');
181+
let sidebarView = false;
182+
const hideJumpSidebar = (e) => {
183+
console.log('jump side bar func worked!', e);
184+
if (!sidebarView) {
185+
e.preventDefault();
186+
for (let i = 0; i < bodyGrid.length; i += 1) {
187+
bodyGrid[i].classList.add('expand');
188+
}
189+
sidebarView = true;
190+
console.log('if condition worked!');
191+
} else {
192+
e.preventDefault();
193+
for (let i = 0; i < bodyGrid.length; i += 1) {
194+
bodyGrid[i].classList.remove('expand');
195+
}
196+
sidebarView = false;
197+
console.log('else condition worked!');
198+
}
199+
};
200+
178201
return (
179-
<div className="main-container">
202+
<div className='main-container'>
180203
<HeadContainer />
181-
<div className="body-container">
204+
<div id='body-grid' className='body-container'>
182205
<ActionContainer />
183206
{snapshots.length ? (
184207
<StateContainer
@@ -190,6 +213,9 @@ function MainContainer(): any {
190213
) : null}
191214
<TravelContainer snapshotsLength={snapshots.length} />
192215
<ButtonsContainer />
216+
{/* <button className='show-sidebar' onClick={(e) => hideJumpSidebar(e)}>
217+
See Jump Functionality
218+
</button> */}
193219
</div>
194220
</div>
195221
);

src/app/styles/components/_buttons.scss

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@
1616
width: 120px;
1717
background: $red-color-gradient;
1818
height: 30px;
19-
}
20-
.save-series-button:hover {
21-
box-shadow: $box-shadow-red;
19+
position: absolute;
20+
right: 2.5rem;
21+
22+
&.animate {
23+
background: rgb(41, 164, 41);
24+
}
25+
2226
}
2327

2428
.empty-button {
Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
11
.body-container {
2-
height: 94%;
3-
overflow: hidden;
4-
display: grid;
5-
grid-template-columns: 1fr 2fr;
6-
grid-template-rows: 8fr 1fr;
7-
grid-template-areas:
8-
'actions states'
9-
'travel travel'
10-
'buttons buttons';
2+
height: 94%;
3+
overflow: hidden;
4+
display: grid;
5+
grid-template-columns: 1fr 2fr;
6+
grid-template-rows: 8fr 1fr;
7+
grid-template-areas:
8+
'states states'
9+
'travel travel'
10+
'buttons buttons';
11+
&.expand {
12+
grid-template-areas:
13+
'actions states'
14+
'travel travel'
15+
'buttons buttons';
16+
}
1117
}
1218

1319
/* if extension width is less than 500px, stack the body containers */
1420
@media (max-width: 500px) {
15-
.body-container {
16-
grid-template-rows: 3fr 5fr 1fr;
17-
grid-template-columns: auto;
18-
grid-template-areas:
19-
'actions'
20-
'states'
21-
'travel'
22-
'buttons';
23-
}
21+
.body-container {
22+
grid-template-rows: 3fr 5fr 1fr;
23+
grid-template-columns: auto;
24+
grid-template-areas:
25+
'actions'
26+
'states'
27+
'travel'
28+
'buttons';
29+
}
2430
}

0 commit comments

Comments
 (0)