Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7,670 changes: 3,924 additions & 3,746 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
"dependencies": {
"@material-ui/core": "^3.9.0",
"@material-ui/icons": "^3.0.2",
"bootstrap": "^4.2.1",
"firebase": "^5.8.0",
"jodit-react": "^1.0.24",
"react": "^16.7.0",
"react-bootstrap": "^1.0.0-beta.5",
"react-dom": "^16.7.0",
"react-redux": "^5.1.1",
"react-redux-firebase": "^2.2.6",
Expand Down
3 changes: 1 addition & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ class App extends Component {
render() {
return (
<BrowserRouter>

<div className="App">
<Appbar />
<Switch>
<Route exact path = "/" component={Album} />
<Route exact path = "/register" component={Register} />
<Route exact path = "/signin" component={SignIn} />
<Route exact path = "/signin" component={SignIn} />
<Route exact path = "/profile" component={Profile} />
</Switch>

Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/SignedInLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ const mapDispatchToProps = (dispatch) => {
return {
signout: () => dispatch(signout())
}
}
};
export default connect(null,mapDispatchToProps)(SignedInLinks)
81 changes: 40 additions & 41 deletions src/components/profile/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React from 'react';
import "./Profile.css";
import './css4.1/bootstrapcustom.min.css';
import { connect } from 'react-redux';
import PaymentRegisterForm from '../register/PaymentRegisterForm';
import Button from "react-bootstrap/Button";
import ButtonToolbar from "react-bootstrap/ButtonToolbar";
import PaymentDialog from "./editPaymentForm";

class Profile extends React.Component {

Expand All @@ -11,6 +13,7 @@ class Profile extends React.Component {
this.state = {
showProfile : true,
showEditPayment : false,

};
this.changeTab= this.changeTab.bind(this);
this.editPaymentMethod = this.editPaymentMethod.bind(this);
Expand All @@ -20,6 +23,10 @@ class Profile extends React.Component {
this.setState({showEditPayment : true});
}

setShowEditPayment = bool =>{
this.setState({showEditPayment:bool});
};

changeTab(e){
if (e.target.id === "profile-tab") {
this.setState({showProfile:true});
Expand All @@ -40,14 +47,6 @@ class Profile extends React.Component {
<p>{userProfile.firstName} {userProfile.lastName}</p>
</div>
</div>
{/*<div className="row">*/}
{/*<div className="col-md-6">*/}
{/*<label>Email</label>*/}
{/*</div>*/}
{/*<div className="colPhone-md-6">*/}
{/*<p></p>*/}
{/*</div>*/}
{/*</div>*/}
<div className="row">
<div className="col-md-6">
<label>Phone</label>
Expand All @@ -64,60 +63,52 @@ class Profile extends React.Component {
<label>Card Name</label>
</div>
<div className="col-md-6">
<p>{userProfile.card.cardName ? userProfile.card.cardName : " "} </p>
<p>{userProfile.card ? userProfile.card.cardName : " "} </p>
</div>
</div>
<div className="row">
<div className="col-md-6">
<label>Card number</label>
</div>
<div className="col-md-6">
<p> {userProfile.card.cardNumber ? userProfile.card.cardNumber : " "}</p>
<p> {userProfile.card ? userProfile.card.cardNumber : " "}</p>
</div>
</div>
<div className="row">
<div className="col-md-6">
<label>Expirate Date</label>
</div>
<div className="col-md-6">
<p> {userProfile.card.expDate ? userProfile.card.expDate : " "}</p>
<p> {userProfile.card ? userProfile.card.expDate : " "}</p>
</div>
</div>
<div className="row">
<div className="col-md-6">
<label>CVV</label>
</div>
<div className="col-md-6">
<p>{userProfile.card.cvv ? userProfile.card.cvv : " "} </p>
</div>
</div>
</div>);
var editPayment = (<div className="modal" tabIndex="-1" role="dialog">

<div className="modal-dialog" role="document">
<div className="modal-content">
<div className="modal-header">
<h5 className="modal-title">Modal title</h5>
<button type="button" className="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="false">&times;</span>
</button>
</div>
<div className="modal-body">
<p>Modal body text goes here.</p>
</div>
<div className="modal-footer">
<button type="button" className="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" className="btn btn-primary">Save changes</button>
</div>
<p>{userProfile.card ? userProfile.card.cvv : " "} </p>
</div>
</div>
</div>);

return (
<div >
{this.state.showEditPayment === true ? <PaymentRegisterForm/> : (<div/>)}
<script src="https://unpkg.com/react/umd/react.production.js" crossOrigin/>

<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script
src="https://unpkg.com/react-dom/umd/react-dom.production.js"
crossOrigin
/>

<script
src="https://unpkg.com/react-bootstrap@next/dist/react-bootstrap.min.js"
crossOrigin
/>

{this.state.showEditPayment ? <PaymentDialog setEditPayment={this.setShowEditPayment}/> : <div/>}

<script>var Alert = ReactBootstrap.Alert;</script>
<div className="bootstrapiso">

<div className="container emp-profile">
Expand All @@ -142,20 +133,29 @@ class Profile extends React.Component {
<h6>
Web Developer and Designer
</h6>
<p className="proile-rating"></p>
<p className="proile-rating"/>
<ul className="nav nav-tabs" id="myTab" role="tablist">
<li className="nav-item">
<a className="nav-link" id="profile-tab" data-toggle="tab" href="#home" role="tab"
<a className="nav-link" id="profile-tab" data-toggle="tab" role="tab"
onClick={this.changeTab}>About</a>
</li>
<li className="nav-item">
<a className="nav-link" id="payment-tab" data-toggle="tab" href="#profile" role="tab"
<a className="nav-link" id="payment-tab" data-toggle="tab" role="tab"
onClick={this.changeTab}>Payment methods</a>
</li>
</ul>
</div>
</div>
<div className="col-md-2">
<ButtonToolbar>
<Button
variant="primary"
onClick={() => this.setState({ showEditPayment: true })}
>
Payment Method
</Button>
</ButtonToolbar>


</div>
</div>
Expand All @@ -178,7 +178,6 @@ class Profile extends React.Component {
<div className="tab-content profile-tab" id="myTabContent">

{this.state.showProfile === true ? profile : payment}

</div>
</div>
</div>
Expand All @@ -194,6 +193,6 @@ const mapStateToProps = (state) => {
return {
userProfile : state.firebase.profile,
}
}
};

export default connect(mapStateToProps,null)(Profile);
111 changes: 111 additions & 0 deletions src/components/profile/editPaymentForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import React from 'react';
import Button from '@material-ui/core/Button';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogContentText from '@material-ui/core/DialogContentText';
import DialogTitle from '@material-ui/core/DialogTitle';
import TextField from "@material-ui/core/TextField";
import Grid from "@material-ui/core/Grid";
import {changePayment} from "../../store/actions/ChangePaymentActions";
import connect from "react-redux/es/connect/connect";

class PaymentDialog extends React.Component {
constructor(props){
super(props);
this.state = {
open : true ,
setOpen : false ,
cardName : '',
cardNumber : '',
expDate : '',
cvv : ''
};

}

componentWillReceiveProps(nextProps, nextContext) {
if(nextProps.paymentChangeSuccess){
this.handleClose();
}
}

handleClose = () => {
this.setState({open:false});
this.props.setEditPayment(false);
console.log(this.state);
};

changeMethod = () => {
this.props.changePayment(this.state);
};

handleChange = (e) =>{
this.setState({ [e.target.id] : e.target.value});
};
render() {
const {paymentChangeSuccess,paymentChangeError} = this.props;
return (
<div>
<Dialog
open={this.state.open}
onClose={this.handleClose}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle id="alert-dialog-title">Edit Payment</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">

<Grid container spacing={24}>
<Grid item xs={12} md={6}>
<TextField required id="cardName" name="cardName" label="Name on card" fullWidth onChange={this.handleChange}/>
</Grid>
<Grid item xs={12} md={6}>
<TextField required id="cardNumber" name="cardNumber" label="Card number" fullWidth onChange={this.handleChange}/>
</Grid>
<Grid item xs={12} md={6}>
<TextField required id="expDate" name="expDate" label="Expiry date" fullWidth onChange={this.handleChange}/>
</Grid>
<Grid item xs={12} md={6}>
<TextField
required
id="cvv"
name="cvv"
label="CVV"
helperText="Last three digits on signature strip"
onChange={this.handleChange}
fullWidth
/>
</Grid>
</Grid>
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={this.handleClose} color="primary">
Cancel
</Button>
<Button onClick={this.changeMethod} color="primary" autoFocus>
Edit
</Button>
</DialogActions>
</Dialog>
</div>
);
}
}


const mapStateToProps= (state) =>{
return {
paymentChangeSuccess : state.auth.paymentChangeSuccess,
paymentChangeError : state.auth.paymentChangeError,
}
};

const mapDispatchToProps = (dispatch) => {
return {
changePayment: (UserPayment) => dispatch(changePayment(UserPayment))
}
};
export default connect(mapStateToProps,mapDispatchToProps)(PaymentDialog);
2 changes: 1 addition & 1 deletion src/components/register/BasicRegisterForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import TextField from '@material-ui/core/TextField';
class BagicRegisterForm extends React.Component {
handleChange = (e) => {
this.props.callbackFromParent(e);
}
};

render() {
return (
Expand Down
Loading