Skip to content

Commit c852dc2

Browse files
Merge pull request yowiputra#29 from yowiputra/cleanup
Cleanup
2 parents cac1bb1 + 7ad80fb commit c852dc2

23 files changed

+247
-278
lines changed

client/actions/userDataActions.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ export function currentUserDataRequest() {
1313
export function userUpdateProfile(userProfileData) {
1414
return dispatch => {
1515
return axios.post('/api/profileupdate', userProfileData).then(res => {
16-
console.log('outcoming data' + res.data);
17-
return res.data;
16+
return res.data;
1817
});
1918
}
2019
}

client/package-lock.json

+18-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"react-bootstrap": "^0.31.2",
2727
"react-dom": "^15.6.1",
2828
"react-notifications": "^1.4.3",
29-
"react-popup": "^0.8.0",
3029
"react-popupbox": "^2.0.1",
3130
"react-redux": "^5.0.6",
3231
"react-router": "^4.1.2",

client/reducers/authReducer.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const initialState = {
77
};
88

99
export default (state = initialState, action = {}) => {
10-
switch(action.type) {
10+
switch (action.type) {
1111
case set_current_user:
1212
return {
1313
isAuthenticated: !isEmpty(action.user),

client/src/App.jsx

+21-9
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,33 @@ class App extends Component {
1515
super(props);
1616
this.state = {
1717
loginPage: [],
18-
uploadScreen: []
18+
uploadScreen: [],
19+
isLoading: true
1920
}
2021
}
2122

23+
componentDidMount() {
24+
this.setState({ isLoading: false }
25+
)
26+
}
27+
2228
render() {
2329
const { isAuthenticated } = this.props.auth;
2430
return (
25-
<div className="container">
26-
<NavigationBar />
27-
<Route exact path="/" component={Greetings} />
28-
<Route path="/signup" component={SignupPage} />
29-
<Route path="/login" component={LoginPage} />
30-
<Route path="/profile" component={ProfilePage} />
31-
<Route path="/matchmaker" render={() => ( isAuthenticated ? <MatchmakerPage/> : <Redirect to="/"/> )} />
32-
<Route path="/profileupdate" component={ProfileForm} />
31+
<div>
32+
{this.state.isLoading ?
33+
<div id="preloader">
34+
<div id="load"></div>
35+
</div> :
36+
<div className="container">
37+
<NavigationBar />
38+
<Route exact path="/" component={Greetings} />
39+
<Route path="/signup" component={SignupPage} />
40+
<Route path="/login" component={LoginPage} />
41+
<Route path="/profile" component={ProfilePage} />
42+
<Route path="/matchmaker" render={() => (isAuthenticated ? <MatchmakerPage /> : <Redirect to="/" />)} />
43+
<Route path="/profileupdate" component={ProfileForm} />
44+
</div>}
3345
</div>
3446
);
3547
}

client/src/Greetings.jsx

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
import React, { Component } from 'react';
2-
// BELOW = preloader div (insert into line 15 if desired)
3-
// <div id="preloader">
4-
// <div id="load"></div>
5-
// </div>
6-
72

83
class Greetings extends Component {
9-
render () {
4+
render() {
105
return (
116
<div id="page-top" className="page-top" data-spy="scroll" data-target=".navbar-custom">
12-
7+
138
<section id="intro" className="intro">
14-
<video autoPlay loop muted src="/greetingsVid.mp4"/>
9+
<video autoPlay loop muted src="/greetingsVid.mp4" />
1510
</section>
1611

1712
<section id="logo">
18-
<img src="/logo.png"/>
13+
<img src="/logo.png" />
1914
</section>
2015

2116
<section id="about" className="home-section text-center">
@@ -36,7 +31,7 @@ class Greetings extends Component {
3631
<div className="container">
3732
<div className="row">
3833
<div className="col-lg-2 col-lg-offset-5">
39-
<hr className="marginbot-50"/>
34+
<hr className="marginbot-50" />
4035
</div>
4136
</div>
4237
<div className="row">
@@ -45,7 +40,7 @@ class Greetings extends Component {
4540
<div className="team boxed-grey">
4641
<div className="inner">
4742
<h5>Yohan Wiputra</h5>
48-
43+
4944
<div className="avatar"><img src="https://steamuserimages-a.akamaihd.net/ugc/544144200753106252/C5719C7DFD1044AFD01D948FCE0946A3E341FA7B/" alt="" className="img-responsive img-circle" /></div>
5045
</div>
5146
</div>
@@ -56,8 +51,8 @@ class Greetings extends Component {
5651
<div className="team boxed-grey">
5752
<div className="inner">
5853
<h5>Helen Lee</h5>
59-
60-
<div className="avatar"><img src="http://i.imgur.com/utol4F4.jpg" alt="" className="img-responsive img-circle" /></div>
54+
55+
<div className="avatar"><img src="http://i.imgur.com/utol4F4.jpg" alt="" className="img-responsive img-circle" /></div>
6156
</div>
6257
</div>
6358
</div>
@@ -67,7 +62,7 @@ class Greetings extends Component {
6762
<div className="team boxed-grey">
6863
<div className="inner">
6964
<h5>Victor Cortez</h5>
70-
65+
7166
<div className="avatar"><img src="https://dota2.gamepedia.com/media/dota2.gamepedia.com/thumb/3/31/Cosmetic_icon_Cluckles_the_Brave.png/256px-Cosmetic_icon_Cluckles_the_Brave.png?version=ccb8c03b51aa4e14b8307c18e053a89c" alt="" className="img-responsive img-circle" /></div>
7267
</div>
7368
</div>
@@ -78,7 +73,7 @@ class Greetings extends Component {
7873
<div className="team boxed-grey">
7974
<div className="inner">
8075
<h5>John Wong</h5>
81-
76+
8277
<div className="avatar"><img src="https://s3-eu-west-1.amazonaws.com/media.valvetimes.com/uploads/2016/01/batpas12.jpg" alt="" className="img-responsive img-circle" /></div>
8378
</div>
8479
</div>

client/src/LoginForm.jsx

+30-30
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ class LoginForm extends Component {
99
super(props);
1010
this.state = {
1111
identifier: '',
12-
password:'',
12+
password: '',
1313
errors: {},
1414
isLoading: false,
1515
};
1616
this.onSubmit = this.onSubmit.bind(this)
1717
this.onChange = this.onChange.bind(this)
1818
}
1919

20-
isValid () {
20+
isValid() {
2121
const { errors, isValid } = validateInput(this.state);
2222
if (!isValid) {
2323
this.setState({ errors })
@@ -30,11 +30,11 @@ class LoginForm extends Component {
3030
if (this.isValid()) {
3131
this.setState({ errors: {}, isLoading: true })
3232
this.props.login(this.state).then(
33-
(res) => {
34-
this.context.router.history.push('/matchmaker');
35-
window.location.reload();
36-
},
37-
(err) => this.setState({ errors: err.data.errors, isLoading: false })
33+
(res) => {
34+
this.context.router.history.push('/matchmaker');
35+
window.location.reload();
36+
},
37+
(err) => this.setState({ errors: err.data.errors, isLoading: false })
3838
);
3939
}
4040
}
@@ -43,41 +43,41 @@ class LoginForm extends Component {
4343
this.setState({ [e.target.name]: e.target.value });
4444
}
4545

46-
render () {
46+
render() {
4747
const { errors, identifier, password, isLoading } = this.state;
4848
return (
4949
<div id="page-top" className="page-top" data-spy="scroll" data-target=".navbar-custom">
50-
51-
<section id="login" className="login">
52-
<div>
53-
<video autoPlay loop muted src="/loginVid.mp4"/>
54-
</div>
50+
51+
<section id="login" className="login">
52+
<div>
53+
<video autoPlay loop muted src="/loginVid.mp4" />
54+
</div>
5555
<div className="formdiv">
5656
<form onSubmit={this.onSubmit} >
5757
<h1>Account Login</h1>
5858

59-
{ errors.form && <div className="alert alert-danger"> {errors.form}</div>}
60-
61-
<TextFieldGroup
62-
field="identifier"
63-
label="Username / Email"
64-
value={this.state.identifier}
65-
error={errors.identifier}
66-
onChange={this.onChange} />
59+
{errors.form && <div className="alert alert-danger"> {errors.form}</div>}
60+
61+
<TextFieldGroup
62+
field="identifier"
63+
label="Username / Email"
64+
value={this.state.identifier}
65+
error={errors.identifier}
66+
onChange={this.onChange} />
6767

68-
<TextFieldGroup
69-
field="password"
70-
label="Password"
71-
value={this.state.password}
72-
error={errors.password}
73-
onChange={this.onChange}
74-
type="password" />
68+
<TextFieldGroup
69+
field="password"
70+
label="Password"
71+
value={this.state.password}
72+
error={errors.password}
73+
onChange={this.onChange}
74+
type="password" />
7575

76-
<div className="form-group"><button className="btn btn-primary btn-lg" disabled={isLoading}>Login</button></div>
76+
<div className="form-group"><button className="btn btn-primary btn-lg" disabled={isLoading}>Login</button></div>
7777
</form>
7878
</div>
7979
</section>
80-
</div>
80+
</div>
8181
);
8282
}
8383
}

client/src/LoginPage.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import LoginForm from './LoginForm.jsx';
33

44

55
class LoginPage extends Component {
6-
render () {
6+
render() {
77
return (
88
<div className="row">
99
<div>

client/src/MainApp/MatchmakerEvent.jsx

+11-12
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,24 @@ import React, { Component } from 'react';
22
import Cards, { Card } from 'react-swipe-card';
33

44
class MatchmakerEvent extends Component {
5-
render () {
5+
render() {
66
const data = this.props.compatUsers
7-
console.log(data)
87
return (
98
<div>
109
<Cards onEnd={() => console.log('end')} className='master-root'>
1110
{data.map(item =>
12-
<Card
13-
onSwipeLeft={() => console.log('reject ' + item.username)}
14-
onSwipeRight={() => {
11+
<Card
12+
onSwipeLeft={() => console.log('reject ' + item.username)}
13+
onSwipeRight={() => {
1514
console.log('accept ' + item.username);
1615
this.props.inviteUserB(item);
17-
}}>
18-
<h2>{item.username}</h2>
19-
<img className="avatar" src={item.imageurl} alt="avatar image"/>
20-
<p className="card-text-description">{item.tagline}</p>
21-
<p className="card-text-description">{item.blurb}</p>
22-
</Card>
23-
)}
16+
}}>
17+
<h2>{item.username}</h2>
18+
<img className="avatar" src={item.imageurl} alt="avatar image" />
19+
<p className="card-text-description">{item.tagline}</p>
20+
<p className="card-text-description">{item.blurb}</p>
21+
</Card>
22+
)}
2423
</Cards>
2524
</div>
2625
)

0 commit comments

Comments
 (0)