This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
-
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.
* backend support * amplify * Basic create settings progress * Initial settings page on sign up * Create manager settings works after making an account * Finished settings account creation and update in settings tab Added bootstrap error message instead of alert * Small star rating fix * Fixed bug from merging Co-authored-by: evansegaul <[email protected]> Co-authored-by: jsladerman <[email protected]>
- Loading branch information
1 parent
5e5e532
commit a9fe848
Showing
13 changed files
with
432 additions
and
125 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
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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import React, {Component} from 'react'; | ||
import styles from './css/SettingsBox.module.css'; | ||
import {Field, Form, Formik} from "formik"; | ||
import Button from "react-bootstrap/Button"; | ||
import FormControl from "react-bootstrap/FormControl" | ||
|
||
class SettingsBox extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
settingsInfo: this.props.settingsInfo | ||
} | ||
} | ||
|
||
componentDidMount() { | ||
if (!this.state.settingsInfo) { | ||
this.setState({ | ||
settingsInfo: { | ||
firstName: '', | ||
lastName: '', | ||
phone: '' | ||
} | ||
}) | ||
} | ||
} | ||
|
||
render() { | ||
if (!this.state.settingsInfo) { | ||
return null; | ||
} | ||
const phone = this.state.settingsInfo.phone; | ||
let formattedPhoneNum = ''; | ||
if (this.state.settingsInfo.phone) | ||
formattedPhoneNum = phone.substr(0, 3) + '-' | ||
+ phone.substr(3, 3) | ||
+ '-' + phone.substr(6, 4); | ||
return ( | ||
<div> | ||
<div> | ||
<Formik | ||
initialValues={{ | ||
firstName: this.state.settingsInfo.firstName, | ||
lastName: this.state.settingsInfo.lastName, | ||
phone: formattedPhoneNum | ||
}} | ||
onSubmit={this.onSubmit}> | ||
<Form> | ||
<div className={styles.formLabelInputGroup} | ||
style={{marginRight: '20px'}}> | ||
<label className={styles.formLabel} | ||
style={{marginLeft: '12px'}}>First Name</label> | ||
<Field as={FormControl} | ||
className={styles.formInputName} name='firstName' | ||
placeholder='John'/> | ||
</div> | ||
<div className={styles.formLabelInputGroup}> | ||
<label className={styles.formLabel} | ||
style={{marginLeft: '12px'}}>Last Name</label> | ||
<Field as={FormControl} | ||
className={styles.formInputName} name='lastName' | ||
placeholder='Smith'/> | ||
</div> | ||
<br/><br/> | ||
<label className={styles.formLabel} | ||
style={{marginLeft: '12px'}}>Phone Number | ||
</label> | ||
<Field as={FormControl} | ||
className={styles.formInputPhone} name='phone' | ||
placeholder='800-555-1234'/><br/> | ||
<Button type='submit' variant='info' | ||
className={styles.formSubmitBtn}> | ||
Update | ||
</Button> | ||
</Form> | ||
</Formik> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
onSubmit = (values) => { | ||
const phoneRegEx = /^\d{3}-\d{3}-\d{4}$/; | ||
if (!phoneRegEx.test(values.phone)) | ||
this.props.phoneNumErrorFunc() | ||
else { | ||
values.phone = this.parsePhoneNumber(values.phone) | ||
this.props.submitFunc(values); | ||
} | ||
} | ||
|
||
parsePhoneNumber = (phoneNumber) => { | ||
return phoneNumber.split('-').join(''); | ||
} | ||
} | ||
|
||
export default SettingsBox; |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.formLabelInputGroup { | ||
display: inline-block; | ||
width: 48.1%; | ||
} | ||
|
||
.formLabel { | ||
font-family: "Roboto", sans-serif; | ||
font-weight: bold; | ||
} | ||
|
||
.formInputName { | ||
width: 100%; | ||
} | ||
|
||
.formInputPhone { | ||
position: relative; | ||
margin-right: 20px; | ||
width: 100%; | ||
} | ||
|
||
.formSubmitBtn { | ||
position: absolute; | ||
font-family: "Roboto", sans-serif; | ||
font-weight: bold; | ||
border-width: 0; | ||
background-color: #30B3CA; | ||
padding: 5px 22px; | ||
right: 30px; | ||
} | ||
|
||
.formSubmitBtn:hover { | ||
background-color: #51cbe0; | ||
} | ||
|
||
.formSubmitBtn:focus { | ||
background-color: #30B3CA; | ||
} |
Oops, something went wrong.