@@ -3,7 +3,9 @@ import React from 'react'
3
3
export default class FormProfileName extends React . Component {
4
4
static propTypes = {
5
5
setIsValid : React . PropTypes . func . isRequired ,
6
+ setHelpText : React . PropTypes . func . isRequired ,
6
7
onSubmit : React . PropTypes . func . isRequired ,
8
+ isOtherUser : React . PropTypes . bool ,
7
9
currentValue : React . PropTypes . string ,
8
10
className : React . PropTypes . string
9
11
}
@@ -15,6 +17,8 @@ export default class FormProfileName extends React.Component {
15
17
16
18
componentDidMount ( ) {
17
19
this . validate ( this . state . name ) // emit isValid update
20
+ if ( this . props . isOtherUser )
21
+ this . props . setHelpText ( 'You can rename anybody. It will only change for you, but other people will see the name you chose.' )
18
22
}
19
23
20
24
onChangeName ( e ) {
@@ -31,14 +35,14 @@ export default class FormProfileName extends React.Component {
31
35
emit ( false )
32
36
return {
33
37
name : name ,
34
- error : 'We\'re sorry, your name can only include A-z 0-9 . _ - and cannot have spaces.' ,
38
+ error : 'We\'re sorry, names can only include A-z 0-9 . _ - and cannot have spaces.' ,
35
39
isValid : false
36
40
}
37
41
} else if ( name . slice ( - 1 ) == '.' ) {
38
42
emit ( false )
39
43
return {
40
44
name : name ,
41
- error : 'We\'re sorry, your name cannot end with a period.' ,
45
+ error : 'We\'re sorry, names cannot end with a period.' ,
42
46
isValid : false
43
47
}
44
48
} else {
@@ -56,8 +60,11 @@ export default class FormProfileName extends React.Component {
56
60
}
57
61
58
62
render ( ) {
63
+ var fallbackCurrentValue = ''
64
+ if ( this . props . isOtherUser )
65
+ fallbackCurrentValue = 'them'
59
66
return < div className = { this . props . className } >
60
- < h1 > < span > What would you like to be called?</ span > </ h1 >
67
+ < h1 > < span > What would you like { this . props . currentValue || fallbackCurrentValue } to be called?</ span > </ h1 >
61
68
< form className = "block" onSubmit = { e => e . preventDefault ( ) } >
62
69
< fieldset >
63
70
< div >
0 commit comments