Skip to content

Commit d783ea6

Browse files
committed
merged with master
2 parents b3779a4 + e544ca8 commit d783ea6

File tree

12 files changed

+204
-214
lines changed

12 files changed

+204
-214
lines changed

.eslintrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
22
"extends": ["airbnb", "plugin:jest/recommended"],
33
"root": true,
4-
"plugins": ["jest", "react"],
4+
"plugins": ["jest", "react", "react-hooks"],
55
"rules": {
66
"arrow-parens": [2, "as-needed"],
77
"import/no-unresolved": "off",
8-
"import/extensions": "off"
8+
"import/extensions": "off",
9+
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
10+
"react-hooks/exhaustive-deps": "warn" // Checks effect dependencies
911
},
1012
"env": {
1113
"es6": true,

dev-reactime/tree.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class Tree {
5959
// console.log('current tree structure for *this : ', this);
6060
const children = ['children: '];
6161
// DEV: What should we push instead for components using hooks (it wouldn't be state)
62-
this.children.forEach(child => { // if this.children is always initialized to empty array, when would there ever be anything to iterate through here?
62+
// if this.children is always initialized to empty array, when would there ever be anything to iterate through here?
63+
this.children.forEach(child => {
6364
children.push(child.state || child.component.state);
6465
});
6566
if (this.name) console.log('this.name if exists: ', this.name);

src/app/components/Action.jsx

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,37 @@ import { changeView, changeSlider } from '../actions/actions';
66
// viewIndex and handleonkeyDown added to props
77
const Action = props => {
88
const {
9-
selected, last, index, sliderIndex, dispatch, displayName, componentName, state, viewIndex, handleOnkeyDown,
9+
selected, last, index, sliderIndex, dispatch, displayName, componentName, componentData, state, viewIndex, handleOnkeyDown,
1010
} = props;
11-
console.log('last', last)
12-
console.log('index', index)
13-
console.log('viewIndex', viewIndex)
14-
console.log('selected', selected)
15-
selected
11+
12+
// display render time for state change in seconds and miliseconds
13+
const cleanTime = () => {
14+
let seconds;
15+
let miliseconds = componentData.actualDuration;
16+
if (Math.floor(componentData.actualDuration) > 60) {
17+
seconds = Math.floor(componentData.actualDuration / 60);
18+
seconds = JSON.stringify(seconds);
19+
if (seconds.length < 2) {
20+
seconds = '0'.concat(seconds);
21+
}
22+
miliseconds = Math.floor(componentData.actualDuration % 60);
23+
} else {
24+
seconds = '00';
25+
}
26+
miliseconds = JSON.stringify(miliseconds);
27+
const arrayMiliseconds = miliseconds.split('.');
28+
if (arrayMiliseconds[0].length < 2) {
29+
arrayMiliseconds[0] = '0'.concat(arrayMiliseconds[0]);
30+
}
31+
if (arrayMiliseconds[1].length > 3) {
32+
arrayMiliseconds[1] = arrayMiliseconds[1].slice(0, 2);
33+
}
34+
if (index == 0) {
35+
return `${seconds}:${arrayMiliseconds[0]}.${arrayMiliseconds[1]}`;
36+
}
37+
return `+${seconds}:${arrayMiliseconds[0]}.${arrayMiliseconds[1]}`;
38+
};
39+
const displayTime = cleanTime();
1640

1741
return (
1842
<div
@@ -29,6 +53,12 @@ const Action = props => {
2953
<div className="action-component-text">
3054
{`${displayName}: ${componentName} `}
3155
</div>
56+
<button
57+
className="time-button"
58+
type="button"
59+
>
60+
{displayTime}
61+
</button>
3262
<button
3363
className="jump-button"
3464
onClick={e => {
@@ -50,8 +80,8 @@ Action.propTypes = {
5080
selected: PropTypes.bool.isRequired,
5181
index: PropTypes.number.isRequired,
5282
dispatch: PropTypes.func.isRequired,
53-
displayName: PropTypes.string.isRequired,
54-
componentName: PropTypes.string.isRequired,
83+
displayName: PropTypes.string.isRequired,
84+
componentName: PropTypes.string.isRequired,
5585
state: PropTypes.object.isRequired,
5686
handleOnkeyDown: PropTypes.func.isRequired,
5787
viewIndex: PropTypes.number.isRequired,

src/app/components/Chart.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class Chart extends Component {
3434
componentDidUpdate() {
3535
const { hierarchy } = this.props;
3636
root = JSON.parse(JSON.stringify(hierarchy));
37+
console.log("Chart -> componentDidUpdate -> hierarchy", hierarchy);
3738
this.maked3Tree();
3839
}
3940

0 commit comments

Comments
 (0)