1+ import { faChartLine , faLock , faUser } from '@fortawesome/free-solid-svg-icons' ;
12import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
2- import { faChartLine , faUser , faLock } from '@fortawesome/free-solid-svg-icons' ;
33import { EditPassword } from 'app/components/UserProfileModal/EditPassword' ;
44import { EditProfile } from 'app/components/UserProfileModal/EditProfile' ;
55import * as styles from 'app/styles/UserProfileModal.module.css' ;
@@ -19,47 +19,14 @@ export class UserProfileModal extends React.Component<
1919 private editPasswordRef = React . createRef < HTMLFormElement > ( ) ;
2020 private reactFlagRef = React . createRef < ReactFlagsSelect > ( ) ;
2121
22- public renderSwitch ( param :any , username :any , fullName :any , userDetails :any , country :any , avatar :any , oldPassword :any , password :any , repeatPassword :any ) {
23- switch ( param ) {
24- case UserProfileInterfaces . SelectedPage . EDITPROFILE :
25- return ( < EditProfile
26- handleEditProfile = { this . handleEditProfile }
27- onInputChange = { this . onInputChange }
28- editProfileRef = { this . editProfileRef }
29- reactFlagRef = { this . reactFlagRef }
30- username = { username }
31- fullName = { fullName }
32- userDetails = { userDetails }
33- country = { country }
34- avatar = { avatar }
35- /> ) ;
36- break ;
37-
38- case UserProfileInterfaces . SelectedPage . EDITPASSWORD :
39- return ( < EditPassword
40- handleEditPassword = { this . handleEditPassword }
41- onInputChange = { this . onInputChange }
42- editPasswordRef = { this . editPasswordRef }
43- oldPassword = { oldPassword }
44- password = { password }
45- repeatPassword = { repeatPassword }
46- userDetails = { userDetails }
47- /> ) ;
48- break ;
49-
50- default :
51- return < p > Hello World</ p > ;
52- }
53- }
54-
5522 constructor ( props : UserProfileInterfaces . Props ) {
5623 super ( props ) ;
5724 const { userDetails } = this . props ;
5825 this . state = {
5926 avatar : userDetails . avatar ,
6027 country : userDetails . country ,
61- fullName : userDetails . fullName ,
6228 currentPage : UserProfileInterfaces . SelectedPage . EDITPROFILE ,
29+ fullName : userDetails . fullName ,
6330 isPasswordPage : true ,
6431 oldPassword : '' ,
6532 password : '' ,
@@ -68,6 +35,54 @@ export class UserProfileModal extends React.Component<
6835 } ;
6936 }
7037
38+ public renderSwitch (
39+ param : UserProfileInterfaces . SelectedPage ,
40+ username : string ,
41+ fullName : string ,
42+ // tslint:disable-next-line
43+ userDetails : any ,
44+ country : string ,
45+ avatar : string ,
46+ oldPassword : string ,
47+ password : string ,
48+ repeatPassword : string ,
49+ ) {
50+ switch ( param ) {
51+ case UserProfileInterfaces . SelectedPage . EDITPROFILE :
52+ return (
53+ < EditProfile
54+ handleEditProfile = { this . handleEditProfile }
55+ onInputChange = { this . onInputChange }
56+ editProfileRef = { this . editProfileRef }
57+ reactFlagRef = { this . reactFlagRef }
58+ username = { username }
59+ fullName = { fullName }
60+ userDetails = { userDetails }
61+ country = { country }
62+ avatar = { avatar }
63+ />
64+ ) ;
65+ break ;
66+
67+ case UserProfileInterfaces . SelectedPage . EDITPASSWORD :
68+ return (
69+ < EditPassword
70+ handleEditPassword = { this . handleEditPassword }
71+ onInputChange = { this . onInputChange }
72+ editPasswordRef = { this . editPasswordRef }
73+ oldPassword = { oldPassword }
74+ password = { password }
75+ repeatPassword = { repeatPassword }
76+ userDetails = { userDetails }
77+ />
78+ ) ;
79+ break ;
80+
81+ default :
82+ return < p > Hello World</ p > ;
83+ }
84+ }
85+
7186 public render ( ) {
7287 const {
7388 fullName,
@@ -81,49 +96,73 @@ export class UserProfileModal extends React.Component<
8196 const { userDetails } = this . props ;
8297 return (
8398 < Grid fluid = { true } className = { classnames ( styles . UserEdit ) } >
84- < div style = { { display :'flex' , flexDirection :'column' , justifyContent :'' , position :"absolute" , marginLeft :'10%' , marginTop :'10%' , borderRight :'2px solid #D3D3D3' } } >
85-
86- < div style = { { paddingBottom :'10px' , paddingRight :'10px' , cursor :'pointer' } }
87- onClick = { ( ) => {
88- this . setState ( {
89- currentPage :UserProfileInterfaces . SelectedPage . EDITPROFILE ,
90- } ) ;
91- } }
92- >
93- < FontAwesomeIcon icon = { faUser } style = { { fontSize :'30' } } />
94- < label style = { { paddingLeft :'10px' , cursor :'pointer' } } > User Details</ label >
95- </ div >
96-
97- < div style = { { paddingBottom :'10px' , paddingRight :'10px' , cursor :'pointer' } }
98- onClick = { ( ) => {
99- this . setState ( {
100- currentPage :UserProfileInterfaces . SelectedPage . EDITPASSWORD ,
101- } ) ;
102- } }
103- >
104- < FontAwesomeIcon icon = { faLock } style = { { fontSize :'30' } } />
105- < label style = { { paddingLeft :'10px' , cursor :'pointer' } } > User Credentials</ label >
106- </ div >
99+ < div
100+ style = { {
101+ borderRight : '2px solid #D3D3D3' ,
102+ display : 'flex' ,
103+ flexDirection : 'column' ,
104+ justifyContent : '' ,
105+ marginLeft : '10%' ,
106+ marginTop : '10%' ,
107+ position : 'absolute' ,
108+ } }
109+ >
110+ < div
111+ style = { { paddingBottom : '10px' , paddingRight : '10px' , cursor : 'pointer' } }
112+ onClick = { ( ) => {
113+ this . setState ( {
114+ currentPage : UserProfileInterfaces . SelectedPage . EDITPROFILE ,
115+ } ) ;
116+ } }
117+ >
118+ < FontAwesomeIcon icon = { faUser } style = { { fontSize : '30' } } />
119+ < label style = { { paddingLeft : '10px' , cursor : 'pointer' } } > User Details</ label >
120+ </ div >
107121
108- < div style = { { paddingBottom :'10px' , paddingRight :'10px' , cursor :'pointer' } }
122+ < div
123+ style = { { paddingBottom : '10px' , paddingRight : '10px' , cursor : 'pointer' } }
109124 onClick = { ( ) => {
110125 this . setState ( {
111- currentPage :UserProfileInterfaces . SelectedPage . USERSTATS ,
126+ currentPage : UserProfileInterfaces . SelectedPage . EDITPASSWORD ,
112127 } ) ;
113- } } >
114- < FontAwesomeIcon icon = { faChartLine } style = { { fontSize :'30' } } />
115- < label style = { { paddingLeft :'10px' , paddingRight :'10px' , cursor :'pointer' } } > User Stats</ label >
116- </ div >
128+ } }
129+ >
130+ < FontAwesomeIcon icon = { faLock } style = { { fontSize : '30' } } />
131+ < label style = { { paddingLeft : '10px' , cursor : 'pointer' } } > User Credentials</ label >
132+ </ div >
117133
134+ < div
135+ style = { { paddingBottom : '10px' , paddingRight : '10px' , cursor : 'pointer' } }
136+ onClick = { ( ) => {
137+ this . setState ( {
138+ currentPage : UserProfileInterfaces . SelectedPage . USERSTATS ,
139+ } ) ;
140+ } }
141+ >
142+ < FontAwesomeIcon icon = { faChartLine } style = { { fontSize : '30' } } />
143+ < label style = { { paddingLeft : '10px' , paddingRight : '10px' , cursor : 'pointer' } } >
144+ User Stats
145+ </ label >
118146 </ div >
147+ </ div >
119148 < Row
120149 className = {
121150 this . state . isPasswordPage
122151 ? classnames ( styles . editProfileElement )
123152 : classnames ( styles . editPasswordElement )
124153 }
125154 >
126- { this . renderSwitch ( this . state . currentPage , username , fullName , userDetails , country , avatar , oldPassword , password , repeatPassword ) }
155+ { this . renderSwitch (
156+ this . state . currentPage ,
157+ username ,
158+ fullName ,
159+ userDetails ,
160+ country ,
161+ avatar ,
162+ oldPassword ,
163+ password ,
164+ repeatPassword ,
165+ ) }
127166 </ Row >
128167 < Row >
129168 < a
@@ -133,13 +172,20 @@ export class UserProfileModal extends React.Component<
133172 : classnames ( 'labeltext' , styles . passwordPageLink )
134173 }
135174 onClick = { ( ) => {
136- let newState = this . state . currentPage === UserProfileInterfaces . SelectedPage . EDITPROFILE ?UserProfileInterfaces . SelectedPage . EDITPASSWORD :UserProfileInterfaces . SelectedPage . EDITPROFILE ;
175+ const newState =
176+ this . state . currentPage === UserProfileInterfaces . SelectedPage . EDITPROFILE
177+ ? UserProfileInterfaces . SelectedPage . EDITPASSWORD
178+ : UserProfileInterfaces . SelectedPage . EDITPROFILE ;
137179 this . setState ( {
138- currentPage : newState
180+ currentPage : newState ,
139181 } ) ;
140182 } }
141183 >
142- { ( this . state . currentPage === UserProfileInterfaces . SelectedPage . EDITPROFILE ) ? 'Want to change Credentials?' : ( this . state . currentPage === UserProfileInterfaces . SelectedPage . EDITPASSWORD ) ? 'Want to change Info?' :null }
184+ { this . state . currentPage === UserProfileInterfaces . SelectedPage . EDITPROFILE
185+ ? 'Want to change Credentials?'
186+ : this . state . currentPage === UserProfileInterfaces . SelectedPage . EDITPASSWORD
187+ ? 'Want to change Info?'
188+ : null }
143189 </ a >
144190 </ Row >
145191 { this . state . isPasswordPage ? (
0 commit comments