@@ -2,6 +2,7 @@ import React, { Component } from 'react';
2
2
import { connect } from 'react-redux' ;
3
3
import { Link } from 'react-router' ;
4
4
import PageHeader from 'react-bootstrap/lib/PageHeader' ;
5
+ import Modal from 'react-bootstrap/lib/Modal' ;
5
6
import Row from 'react-bootstrap/lib/Row' ;
6
7
import Col from 'react-bootstrap/lib/Col' ;
7
8
import Button from 'react-bootstrap/lib/Button' ;
@@ -11,13 +12,17 @@ import Head from '../../widgets/Head';
11
12
import PageLayout from '../../layouts/PageLayout' ;
12
13
import Time from '../../widgets/Time' ;
13
14
import RefreshImage from '../../utils/RefreshImage' ;
15
+ import VerifyEmailForm from '../../forms/user/VerifyEmailForm' ;
14
16
15
17
class ShowPage extends Component {
16
18
constructor ( props ) {
17
19
super ( props ) ;
18
20
this . state = {
19
21
user : props . initialUser ,
22
+ isShowVerifyEmailModal : false ,
20
23
} ;
24
+ this . openModal = this . _openModal . bind ( this ) ;
25
+ this . closeModal = this . _closeModal . bind ( this ) ;
21
26
}
22
27
23
28
componentDidMount ( ) {
@@ -36,6 +41,35 @@ class ShowPage extends Component {
36
41
} ) ;
37
42
}
38
43
44
+ _openModal ( ) {
45
+ this . setState ( { isShowVerifyEmailModal : true } ) ;
46
+ }
47
+
48
+ _closeModal ( ) {
49
+ this . setState ( { isShowVerifyEmailModal : false } ) ;
50
+ }
51
+
52
+ renderModal ( ) {
53
+ let { isShowVerifyEmailModal, user } = this . state ;
54
+
55
+ return (
56
+ < Modal
57
+ show = { isShowVerifyEmailModal }
58
+ onHide = { this . closeModal }
59
+ >
60
+ < Modal . Header closeButton >
61
+ < Modal . Title > Send Verification Mail</ Modal . Title >
62
+ </ Modal . Header >
63
+ < Modal . Body >
64
+ < VerifyEmailForm
65
+ email = { user . email && user . email . value }
66
+ onCancel = { this . closeModal }
67
+ />
68
+ </ Modal . Body >
69
+ </ Modal >
70
+ ) ;
71
+ }
72
+
39
73
render ( ) {
40
74
const { user } = this . state ;
41
75
return (
@@ -45,6 +79,7 @@ class ShowPage extends Component {
45
79
'https://www.gstatic.com/firebasejs/live/3.0/firebase.js' ,
46
80
] }
47
81
/>
82
+ { this . renderModal ( ) }
48
83
< Row >
49
84
< Col md = { 12 } >
50
85
< Link to = "/user/me/edit" >
@@ -64,7 +99,14 @@ class ShowPage extends Component {
64
99
< dt > name</ dt >
65
100
< dd > { user . name } </ dd >
66
101
< dt > email</ dt >
67
- < dd > { user . email && user . email . value } </ dd >
102
+ < dd >
103
+ { user . email && user . email . value }
104
+ { user . email && ! user . email . isVerified && (
105
+ < Button onClick = { this . openModal } >
106
+ Verify Now
107
+ </ Button >
108
+ ) }
109
+ </ dd >
68
110
< dt > updatedAt</ dt >
69
111
< dd >
70
112
< Time value = { user . updatedAt } format = "YYYY-MM-DD" />
0 commit comments