Skip to content

Commit 1d12d88

Browse files
committed
render time
1 parent e80de1f commit 1d12d88

File tree

4 files changed

+62
-11
lines changed

4 files changed

+62
-11
lines changed

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/containers/ActionContainer.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,20 @@ function ActionContainer() {
1616
const [{ tabs, currentTab }, dispatch] = useStoreContext();
1717
const { hierarchy, sliderIndex, viewIndex } = tabs[currentTab];
1818
console.log('actionContainer tabs[currentTab];', tabs[currentTab]);
19-
19+
console.log('actionContainer hierarchy;', hierarchy);
2020
let actionsArr = [];
2121
const hierarchyArr = [];
2222

2323
// gabi and nate :: delete function to traverse state from snapshots, now we are tranversing state from hiararchy and alsog getting infromation on display name and component name
2424
const displayArray = obj => {
25-
console.log('obj', obj);
25+
console.log('obj start displayArray', obj);
2626
if (obj.stateSnapshot.children.length > 0 && obj.stateSnapshot.children[0] && obj.stateSnapshot.children[0].state && obj.stateSnapshot.children[0].name) {
2727
const newObj = {
2828
index: obj.index,
2929
displayName: `${obj.name}.${obj.branch}`,
3030
state: obj.stateSnapshot.children[0].state,
3131
componentName: obj.stateSnapshot.children[0].name,
32+
componentData: JSON.stringify(obj.stateSnapshot.children[0].componentData) === '{}' ? '' : obj.stateSnapshot.children[0].componentData
3233
};
3334

3435
hierarchyArr.push(newObj);
@@ -75,6 +76,7 @@ function ActionContainer() {
7576
state={snapshot.state}
7677
displayName={snapshot.displayName}
7778
componentName={snapshot.componentName}
79+
componentData={snapshot.componentData}
7880
selected={selected}
7981
last={last}
8082
dispatch={dispatch}

src/app/styles/components/_actionComponent.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
border-bottom-width: 1px;
1010
border-color: $border-color;
1111
cursor: pointer;
12-
text-overflow: ellipsis;
12+
overflow: hidden;
1313
@extend %disable-highlight
1414
}
1515

16+
.action-component-text{
17+
margin-bottom: 10px;
18+
}
19+
1620
.action-component.selected {
1721
background-color: $light-grey-one;
1822
}

src/app/styles/components/_buttons.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,27 @@
88
margin-left: 20px;
99
}
1010

11+
.action-component:hover .time-button {
12+
display: none;
13+
}
14+
1115
.action-component:hover .jump-button {
1216
opacity: 1;
1317
transform: rotateX(0deg);
1418
transition: opacity 300ms, transform 0.15s linear;
1519
}
1620

21+
.time-button {
22+
outline: none;
23+
height: 20px;
24+
width: 70px;
25+
border: none;
26+
border-radius: 3px;
27+
background-color: #565A61;
28+
font: normal 11px monaco, Consolas, "Lucida Console", monospace, Arial, sans-serif;
29+
color: #B0B0B0;
30+
}
31+
1732
.jump-button {
1833
@extend %button-shared;
1934
width: 50px;

0 commit comments

Comments
 (0)