1
1
import React from 'react'
2
- import RaisedButton from 'material-ui/RaisedButton' ;
3
2
import { Link } from 'react-router-dom' ;
4
3
import { connect } from 'react-redux' ;
5
4
import { bindActionCreators } from 'redux' ;
6
- import * as talentActions from '../../../actions/talentActions' ;
5
+ import { withStyles } from '@material-ui/core/styles' ;
6
+ import Grid from '@material-ui/core/Grid' ;
7
+ import Button from '@material-ui/core/Button' ;
8
+ import Typography from '@material-ui/core/Typography' ;
9
+ import * as videoActions from 'actions/videoActions' ;
10
+ import * as talentActions from 'actions/talentActions' ;
11
+ import styles from 'styles' ;
7
12
8
13
const title = {
9
14
"cruise" : "Cruise Staff" ,
@@ -18,12 +23,8 @@ const title = {
18
23
"video-technician" : "Video Technician" ,
19
24
"youth-staff" : "Youth Staff"
20
25
}
21
- const styles = {
22
- raisedButton : {
23
- whiteSpace : "normal" ,
24
- width : "240px" ,
25
- }
26
- }
26
+
27
+
27
28
class InterviewInstructionLive extends React . Component {
28
29
constructor ( ) {
29
30
super ( ) ;
@@ -33,86 +34,115 @@ class InterviewInstructionLive extends React.Component {
33
34
}
34
35
}
35
36
36
- componentDidMount ( ) {
37
- let __this = this ;
38
- setTimeout ( function ( ) {
39
- __this . props . talentActions . getCurrentTalentInfo ( ) ;
40
- } , 400 ) ;
41
- }
37
+ getInfoFromProps ( props ) {
38
+ const { location, talentInfo } = this . props ;
39
+ let positionType = ( location && location . state && location . state . positionType ) ? location . state . positionType : null ;
40
+ let subPositionType = null ;
42
41
43
- componentWillReceiveProps ( nextProps ) {
44
- const { talentInfo } = nextProps ;
45
42
if ( talentInfo ) {
46
43
const { talent_position_types, talent_position_sub_types } = talentInfo ;
47
- let positionType = null ;
48
- let subPositionType = null ;
49
44
50
- if ( talent_position_types && talent_position_types . length > 0 )
51
- positionType = talent_position_types [ 0 ] . position_type ;
45
+ if ( ! positionType && talent_position_types && talent_position_types . length > 0 )
46
+ positionType = talent_position_types [ 0 ] ;
52
47
if ( talent_position_sub_types && talent_position_sub_types . length > 0 )
53
- subPositionType = talent_position_sub_types [ 0 ] . position_sub_type ;
54
-
55
- this . setState ( { positionType, subPositionType} ) ;
48
+ subPositionType = talent_position_sub_types [ 0 ] . position_sub_type ;
56
49
}
50
+
51
+ return { positionType, subPositionType } ;
52
+ }
53
+
54
+ componentWillMount ( ) {
55
+ this . setState ( { ...this . getInfoFromProps ( this . props ) } , ( ) => {
56
+ const { positionType } = this . state ;
57
+ this . props . talentActions . getCurrentTalentInfo ( ) ;
58
+ this . props . videoActions . getVideoQuestionsActions ( positionType . position_type , 'live' ) ;
59
+ } ) ;
60
+ }
61
+
62
+ componentWillReceiveProps ( nextProps ) {
63
+ this . setState ( { ...this . getInfoFromProps ( this . props ) } ) ;
57
64
}
58
65
66
+ onClick = ( ) => {
67
+ this . props . history . push ( '/live-interview' , { positionType : this . state . positionType } ) ;
68
+ } ;
69
+
59
70
render ( ) {
71
+ const { videoQuestions, classes } = this . props ;
60
72
const { positionType, subPositionType } = this . state ;
61
73
let positionName = positionType ? positionType . position_type : '' ;
62
74
63
- return ( < div className = "video-interview" >
75
+ return (
76
+ < div className = "video-interview" >
64
77
< div className = "video-interview-header" >
65
78
< h1 > { `My Video Interview (${ positionName } )` } </ h1 >
66
79
< h3 > Live!</ h3 >
67
80
</ div >
68
- < div className = "video-interview-body" >
69
- < p >
70
- OK, here we go!
71
- </ p >
72
- < p >
73
- The “live” Video Interview will now begin and is conducted just like the practice questions
74
- with 30 seconds to read the question and prepare your response,
75
- and up to two minutes to answer.
76
- </ p >
77
- < p >
78
- Follow the onscreen prompts until all Video Interview questions have been answered.
79
- </ p >
80
- < p >
81
- Remember, once you begin the actual interview,
82
- you will be “live” and unable to stop or go back,
83
- just like with an in-person interview.
84
- </ p >
85
- < p >
86
- Relax, be yourself and enjoy the process. You’re gonna be great!
87
- </ p >
88
- < br /> < br />
89
- {
90
- < Link to = { { pathname : "/live-interview/" , state : { positionType : positionType } } } >
91
- < RaisedButton
92
- label = "Begin My Video Interview"
93
- className = "btn-video-buttons btn-vpb"
94
- style = { styles . raisedButton }
95
- secondary = { true }
96
- />
97
- </ Link >
98
- }
99
- </ div >
100
- </ div > )
81
+ < Grid container spacing = { 16 } justify = "center" alignItems = "center" >
82
+ < Grid item lg = { 2 } md = { 1 } xs = { 12 } />
83
+ < Grid item lg = { 8 } md = { 10 } xs = { 12 } >
84
+ < div className = "video-interview-body" >
85
+ < p >
86
+ OK, here we go!
87
+ </ p >
88
+ < p >
89
+ The “live” Video Interview will now begin and is conducted just like the practice questions
90
+ with 30 seconds to read the question and prepare your response,
91
+ and up to two minutes to answer.
92
+ </ p >
93
+ < p >
94
+ Follow the onscreen prompts until all Video Interview questions have been answered.
95
+ </ p >
96
+ < p >
97
+ Remember, once you begin the actual interview,
98
+ you will be “live” and unable to stop or go back,
99
+ just like with an in-person interview.
100
+ </ p >
101
+ < p >
102
+ Relax, be yourself and enjoy the process. You’re gonna be great!
103
+ </ p >
104
+ < br />
105
+ </ div >
106
+ </ Grid >
107
+ < Grid item lg = { 2 } md = { 1 } xs = { 12 } />
108
+
109
+ < Grid item lg = { 5 } md = { 4 } xs = { 12 } />
110
+ < Grid item lg = { 2 } md = { 4 } xs = { 12 } className = { classes . centerText } >
111
+ < Button variant = "contained" size = "large" fullWidth
112
+ color = "secondary" className = { classes . generalButtonClass }
113
+ disabled = { ! videoQuestions || videoQuestions . length <= 0 }
114
+ onClick = { this . onClick }
115
+ >
116
+ < Typography className = { classes . talentProfileGuideButtonTitle } >
117
+ Begin My Video Interview
118
+ </ Typography >
119
+ </ Button >
120
+ </ Grid >
121
+ < Grid item lg = { 5 } md = { 4 } xs = { 12 } />
122
+
123
+ </ Grid >
101
124
125
+ </ div >
126
+ ) ;
102
127
}
103
128
}
104
129
105
130
function mapStateToProps ( state ) {
106
- const { auth, talentInfo } = state ;
131
+ const { auth, talentInfo, videoQuestions , videoSettings , deviceSettings } = state ;
107
132
return {
108
133
auth : auth ,
109
- talentInfo : talentInfo . value
134
+ talentInfo : talentInfo . value ,
135
+ videoQuestions : videoQuestions . value ,
136
+ isLoading : ! videoQuestions . isFetched ,
137
+ videoSettings : videoSettings ,
138
+ deviceSettings : deviceSettings ,
110
139
}
111
140
}
112
141
function mapDispatchToProps ( dispatch ) {
113
142
return {
114
143
talentActions : bindActionCreators ( talentActions , dispatch ) ,
144
+ videoActions : bindActionCreators ( videoActions , dispatch ) ,
115
145
}
116
146
}
117
147
118
- export default connect ( mapStateToProps , mapDispatchToProps ) ( InterviewInstructionLive ) ;
148
+ export default connect ( mapStateToProps , mapDispatchToProps ) ( withStyles ( styles ) ( InterviewInstructionLive ) ) ;
0 commit comments