@@ -6,13 +6,37 @@ import { changeView, changeSlider } from '../actions/actions';
66// viewIndex and handleonkeyDown added to props
77const 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 ,
0 commit comments