@@ -6,13 +6,37 @@ import { changeView, changeSlider } from '../actions/actions';
6
6
// viewIndex and handleonkeyDown added to props
7
7
const Action = props => {
8
8
const {
9
- selected, last, index, sliderIndex, dispatch, displayName, componentName, state, viewIndex, handleOnkeyDown,
9
+ selected, last, index, sliderIndex, dispatch, displayName, componentName, componentData , state, viewIndex, handleOnkeyDown,
10
10
} = 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 ( ) ;
16
40
17
41
return (
18
42
< div
@@ -29,6 +53,12 @@ const Action = props => {
29
53
< div className = "action-component-text" >
30
54
{ `${ displayName } : ${ componentName } ` }
31
55
</ div >
56
+ < button
57
+ className = "time-button"
58
+ type = "button"
59
+ >
60
+ { displayTime }
61
+ </ button >
32
62
< button
33
63
className = "jump-button"
34
64
onClick = { e => {
@@ -50,8 +80,8 @@ Action.propTypes = {
50
80
selected : PropTypes . bool . isRequired ,
51
81
index : PropTypes . number . isRequired ,
52
82
dispatch : PropTypes . func . isRequired ,
53
- displayName : PropTypes . string . isRequired ,
54
- componentName : PropTypes . string . isRequired ,
83
+ displayName : PropTypes . string . isRequired ,
84
+ componentName : PropTypes . string . isRequired ,
55
85
state : PropTypes . object . isRequired ,
56
86
handleOnkeyDown : PropTypes . func . isRequired ,
57
87
viewIndex : PropTypes . number . isRequired ,
0 commit comments