Skip to content

Commit 812f0d9

Browse files
committed
merged dev
2 parents 32a90c7 + 81139c4 commit 812f0d9

20 files changed

+360
-155
lines changed

package-lock.json

Lines changed: 135 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,15 @@
4545
"webpack-cli": "^3.3.6"
4646
},
4747
"dependencies": {
48+
"auto-bind": "^2.1.0",
4849
"prop-types": "^15.7.2",
4950
"rc-slider": "^8.6.13",
5051
"rc-tooltip": "^3.7.3",
5152
"react": "^16.8.6",
53+
"react-16-dropdown": "^0.3.1",
5254
"react-dom": "^16.8.6",
5355
"react-json-tree": "^0.11.2",
56+
"react-router-dom": "^5.0.1",
5457
"redux-devtools-themes": "^1.0.0",
5558
"sass": "^1.22.7"
5659
}

package/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const snapShot = { tree: null };
22

3-
const mode = { jumping: false };
3+
const mode = { jumping: false, paused: false, locked: false };
44

55
const linkFiber = require('./linkFiber')(snapShot, mode);
66
const timeJump = require('./timeJump')(snapShot, mode);
@@ -12,11 +12,12 @@ window.addEventListener('message', ({ data: { action, payload } }) => {
1212
case 'jumpToSnap':
1313
timeJump(payload);
1414
break;
15-
case 'stepToSnap': {
16-
const { steps, speed } = payload;
17-
console.log('i would like to step through here');
15+
case 'setLock':
16+
mode.locked = payload;
17+
break;
18+
case 'setPause':
19+
mode.paused = payload;
1820
break;
19-
}
2021
default:
2122
}
2223
});

package/linkFiber.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ module.exports = (snap, mode) => {
66
let fiberRoot = null;
77

88
function sendSnapshot() {
9-
// don't send messages while jumping
10-
if (mode.jumping) return;
9+
// don't send messages while jumping or while paused
10+
if (mode.jumping || mode.paused) return;
1111
const payload = snap.tree.getCopy();
1212
window.postMessage({
1313
action: 'recordSnap',
@@ -23,6 +23,8 @@ module.exports = (snap, mode) => {
2323
const oldSetState = component.setState.bind(component);
2424

2525
function newSetState(state, callback = () => { }) {
26+
// dont do anything if state is locked
27+
if (mode.locked) return;
2628
// continue normal setState functionality, except add sending message middleware
2729
oldSetState(state, () => {
2830
updateSnapShotTree();

src/app/components/Chart.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react';
2+
3+
const Chart = props => <div>Chart</div>;
4+
5+
export default Chart;

src/app/components/Dropdown.jsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React, { Component } from 'React'
2+
import Dropdown from 'react-16-dropdown';
3+
4+
const options = [{
5+
label: 'Prestige 🎩',
6+
value: 'prestige',
7+
}, {
8+
label: 'Inception 😴',
9+
value: 'inception',
10+
}];
11+
12+
<Dropdown
13+
align='left'
14+
className='custom-classname'
15+
closeOnEscape={true}
16+
options={options}
17+
triggerLabel='Movies'
18+
onClick={val => console.log(val)}
19+
/>
20+
21+
export default Dropdown;

src/app/components/Tree.jsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
import JSONTree from 'react-json-tree';
3+
4+
const getItemString = (type, data, itemType, itemString) => (
5+
<span>
6+
//
7+
{type}
8+
</span>
9+
);
10+
11+
const Tree = (props) => {
12+
const { snapshot } = props;
13+
console.log('TREE COMPONENT IS PRINTED');
14+
console.log(snapshot);
15+
return (
16+
<React.Fragment>
17+
{snapshot && (
18+
<JSONTree
19+
data={snapshot}
20+
theme={{ tree: () => ({ className: 'json-tree' }) }}
21+
getItemString={getItemString}
22+
/>
23+
)}
24+
</React.Fragment>
25+
);
26+
};
27+
export default Tree;

0 commit comments

Comments
 (0)