-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd2193c
commit 7913f73
Showing
13 changed files
with
201 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
Frontend/src/app/components/molecules/RegistrationForm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import React from 'react' | ||
|
||
import { Button, TextField, Input,CircularProgress, Snackbar} from '@material-ui/core' | ||
import {uploadFile} from '../../utils/firebase/storage'; | ||
import {UserData} from '../../utils/localStorage' | ||
|
||
import AvatarIcon from '../../res/icons/user.png' | ||
|
||
function ImageUploader(props){ | ||
const onUpload = props.onUpload; | ||
const uploadState = props.uploadState; | ||
|
||
const [uploading,setUploading] = React.useState(false); | ||
const [image,setImage] = React.useState(AvatarIcon); | ||
const [snackbarStatus, setSnackbarStatus] = React.useState(false); | ||
|
||
|
||
const handleImageSelect = (event)=>{ | ||
setImage(URL.createObjectURL(event.target.files[0])); | ||
const file = event.target.files[0]; | ||
setUploading(true); | ||
const path = "profile/"+UserData.getEmail()+"/profileImage.jpg"; | ||
uploadFile(file,path) | ||
.then((snapshot)=>{ | ||
setUploading(false); | ||
console.log("Upload Successfull!"); | ||
onUpload(path); | ||
|
||
}).catch((err)=>{ | ||
console.log("Error",err); | ||
|
||
}) | ||
} | ||
|
||
return( | ||
<div style={{display:"flex", flexDirection:"row", flexWrap:"wrap"}}> | ||
<div> | ||
<img src = {image} style={{height:140,width:140, borderRadius:70, outlineColor:"#000000",}}/> | ||
</div> | ||
<div style={{display:"flex",alignContent:"center", flexWrap:"wrap", marginLeft:40}}> | ||
<Input type="file" onChange={handleImageSelect}/> | ||
{uploading? <CircularProgress/>:<div/> } | ||
</div> | ||
|
||
<Snackbar open={snackbarStatus} autoHideDuration={6000} onClose={()=>{setSnackbarStatus(false)}}> | ||
Upload Successfull | ||
</Snackbar> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
function RegistrationForm(props){ | ||
const onSubmit = props.onSubmit; | ||
|
||
const [imageUploading, setImageUploading] = React.useState(false); | ||
|
||
var data={ | ||
name:"", | ||
phone:"", | ||
company:"", | ||
website:"", | ||
photo:"", | ||
|
||
} | ||
|
||
return( | ||
<div style={{display:"flex", flexDirection:"column", flexWrap:"wrap"}}> | ||
|
||
<ImageUploader onUpload={(path)=>{data.photo= path}} uploadState={imageUploading}/> | ||
|
||
<TextField | ||
style={{marginTop:20}} | ||
variant="outlined" | ||
label="Name" | ||
onChange={(event)=>{data.name = event.target.value}}/> | ||
<TextField | ||
style={{marginTop:20}} | ||
variant="outlined" | ||
label="Phone" | ||
onChange={(event)=>{data.phone = event.target.value}}/> | ||
<TextField | ||
style={{marginTop:20}} | ||
variant="outlined" | ||
label="Company or Organisation" | ||
onChange={(event)=>{data.company = event.target.value}}/> | ||
<TextField | ||
style={{marginTop:20}} | ||
variant = "outlined" | ||
label ="Website" | ||
onChange = {(event)=>{data.website = event.target.value}}/> | ||
<div style={{flexGrow:1}}> | ||
<Button variant="contained" color="primary" style={{marginTop:30}} onClick={()=>{onSubmit(data)}}> | ||
Submit | ||
</Button> | ||
</div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
export default RegistrationForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,6 @@ const InterviewerDialog = withRouter((props)=>{ | |
} | ||
|
||
}) | ||
|
||
} | ||
}else{ | ||
console.log(data.msg); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react' | ||
import './style.css' | ||
|
||
import RegistrationForm from '../../components/molecules/RegistrationForm' | ||
|
||
import {withRouter} from 'react-router-dom' | ||
|
||
import {updateProfile} from '../../utils/api/controllers/profileCtrl' | ||
import {UserData} from '../../utils/localStorage' | ||
|
||
function RegisterScreen(props){ | ||
|
||
const handleSubmit = (data)=>{ | ||
//updating the profile | ||
console.log("Token",UserData.getToken()); | ||
updateProfile(data).then((res)=>(res.json())) | ||
.then((res)=>{ | ||
if(res.success){ | ||
UserData.setProfileData(data); | ||
UserData.userExists(true); | ||
props.history.push('/interviewer'); | ||
}else{ | ||
console.log("Error",res.msg); | ||
} | ||
}).catch((err)=>{ | ||
console.log("Error",err); | ||
}) | ||
} | ||
|
||
return( | ||
<div className="root" style={{flexWrap:"wrap"}}> | ||
<div style={{fontFamily:"Roboto-Black", fontSize:50, textAlign:"center"}}> | ||
Please enter the details. | ||
</div> | ||
<div style={{display:"flex",flexDirection:"column" ,flexWrap:"wrap", margin:"auto", alignContent:"center", marginTop:40}}> | ||
<RegistrationForm onSubmit={handleSubmit}/> | ||
</div> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
export default withRouter(RegisterScreen); |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import firebase from 'firebase' | ||
import {firebaseConfig}from '../../config'; | ||
import {UserData} from '../localStorage' | ||
|
||
firebase.initializeApp(firebaseConfig); | ||
const storageRef = firebase.storage().ref(); | ||
|
||
|
||
export const uploadFile = (file,path)=>{ | ||
const fileRef = storageRef.child(path); | ||
return fileRef.put(file); | ||
} | ||
|
||
export const downloadFile = (path)=>{ | ||
const fileRef = storageRef.child(path); | ||
return fileRef.getDownloadURL(); | ||
} |