Skip to content

Commit eac942f

Browse files
author
gondzo
committed
login, consumer home, browse provider and drone details
1 parent 94182f9 commit eac942f

File tree

208 files changed

+5657
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+5657
-51
lines changed

.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
REACT_APP_API_BASE_PATH=https://kb-dsp-server.herokuapp.com
2+
REACT_APP_SOCKET_URL=https://kb-dsp-server.herokuapp.com
3+
REACT_APP_AUTH0_CLIEND_ID=3CGKzjS2nVSqHxHHE64RhvvKY6e0TYpK
4+
REACT_APP_AUTH0_DOMAIN=dronetest.auth0.com
5+
REACT_APP_GOOGLE_API_KEY=AIzaSyCR3jfBdv9prCBYBOf-fPUDhjPP4K05YjE

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ See Guild https://github.com/lorenwest/node-config/wiki/Configuration-Files
1818
|----|-----------|
1919
|`PORT`| The port to listen|
2020
|`GOOGLE_API_KEY`| The google api key see (https://developers.google.com/maps/documentation/javascript/get-api-key#key)|
21+
|`REACT_APP_API_BASE_PATH` | api base path
2122

2223

2324
## Install dependencies

envSample

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
REACT_APP_API_BASE_PATH=https://kb-dsp-server.herokuapp.com
2+
REACT_APP_SOCKET_URL=https://kb-dsp-server.herokuapp.com
3+
REACT_APP_AUTH0_CLIEND_ID=3CGKzjS2nVSqHxHHE64RhvvKY6e0TYpK
4+
REACT_APP_AUTH0_DOMAIN=dronetest.auth0.com
5+
REACT_APP_GOOGLE_API_KEY=AIzaSyCR3jfBdv9prCBYBOf-fPUDhjPP4K05YjE

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"author": "",
1414
"license": "MIT",
1515
"dependencies": {
16+
"auth0-js": "^7.6.0",
1617
"autoprefixer": "^6.5.0",
18+
"axios": "^0.15.3",
1719
"babel-core": "^6.17.0",
1820
"babel-eslint": "^7.0.0",
1921
"babel-loader": "^6.2.5",
@@ -36,6 +38,7 @@
3638
"file-loader": "^0.9.0",
3739
"history": "^2.0.0",
3840
"html-webpack-plugin": "^2.22.0",
41+
"icheck": "^1.0.2",
3942
"imports-loader": "^0.6.5",
4043
"ip": "^1.1.3",
4144
"json-loader": "^0.5.4",
@@ -47,15 +50,20 @@
4750
"rc-tooltip": "^3.4.2",
4851
"react": "^15.3.2",
4952
"react-breadcrumbs": "^1.5.1",
53+
"react-click-outside": "^2.2.0",
5054
"react-css-modules": "^3.7.10",
5155
"react-date-picker": "^5.3.28",
5256
"react-dom": "^15.3.2",
53-
"react-modal": "^1.5.2",
57+
"react-dropdown": "^1.2.0",
58+
"react-icheck": "^0.3.6",
59+
"react-input-range": "^0.9.3",
60+
"react-modal": "^1.6.2",
5461
"react-redux": "^4.0.0",
5562
"react-router": "^2.8.1",
5663
"react-router-redux": "^4.0.0",
5764
"react-select": "^1.0.0-rc.2",
5865
"react-simple-dropdown": "^1.1.5",
66+
"react-slick": "^0.14.5",
5967
"redbox-react": "^1.2.10",
6068
"redux": "^3.0.0",
6169
"redux-actions": "^0.10.1",

src/api/User.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/**
2+
* Copyright (c) 2016 Topcoder Inc, All rights reserved.
3+
*/
4+
5+
/**
6+
* A simple implementation of /missions API contract
7+
*
8+
* @author TCSCODER
9+
* @version 1.0.0
10+
*/
11+
import reqwest from 'reqwest';
12+
13+
/**
14+
* UserApi consumer, full implement the rest contract
15+
*/
16+
class UserApi {
17+
/**
18+
* Default Constructor
19+
* @param {String} basePath the base API path
20+
*/
21+
constructor(basePath) {
22+
this.basePath = basePath;
23+
}
24+
25+
login(email, password) {
26+
const url = `${this.basePath}/api/v1/login`;
27+
28+
return reqwest({
29+
url,
30+
method: 'post',
31+
type: 'json',
32+
contentType: 'application/json',
33+
data: JSON.stringify({
34+
email,
35+
password,
36+
}),
37+
error(err) {
38+
return err;
39+
},
40+
});
41+
}
42+
43+
register(name, email, password) {
44+
const url = `${this.basePath}/api/v1/register`;
45+
email = Math.floor((Math.random() * 100) + 1) + email;
46+
return reqwest({
47+
url,
48+
method: 'post',
49+
type: 'json',
50+
contentType: 'application/json',
51+
data: JSON.stringify({
52+
firstName: name,
53+
lastName: name,
54+
email,
55+
phone: '1',
56+
password,
57+
})});
58+
}
59+
60+
registerSocialUser(name, email) {
61+
const url = `${this.basePath}/api/v1/login/social`;
62+
63+
return reqwest({
64+
url,
65+
method: 'post',
66+
type: 'json',
67+
contentType: 'application/json',
68+
data: JSON.stringify({
69+
name,
70+
email,
71+
})});
72+
}
73+
}
74+
75+
export default UserApi;

src/components/Header/Header.jsx

Lines changed: 65 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
import React, { PropTypes } from 'react';
22
import CSSModules from 'react-css-modules';
3+
import LogInSignUpModalContainer from 'routes/Home/containers/LogInSignUpModalContainer';
34
import SearchInput from '../SearchInput';
45
import Dropdown from '../Dropdown';
6+
import Notification from '../Notification';
57
import styles from './Header.scss';
68

7-
export const Header = ({location, selectedCategory, categories, user, notifications, routes}) => (
8-
<nav styleName="header">
9-
<ul>
10-
<li styleName="branding">
9+
export const Header = ({location, selectedCategory, categories, user, notifications,
10+
routes, handleNotification, toggleNotif, loggedUser}) => (
11+
12+
<nav styleName="header">
13+
<ul>
14+
<li styleName="branding">
1115
DRONE MARKET
1216
</li>
13-
{
17+
{
1418
(() => {
1519
const currentRoute = routes[routes.length - 1].name;
16-
if (currentRoute === 'ServiceRequest') {
20+
if (currentRoute === 'ServiceRequest' || currentRoute === 'Home') {
1721
return (
1822
[(<li key="location" styleName="location">
1923
<i />
@@ -38,30 +42,57 @@ export const Header = ({location, selectedCategory, categories, user, notificati
3842
);
3943
})()
4044
}
41-
<li styleName="notifications">
42-
{notifications.length > 0 && <span styleName="counter">{notifications.length}</span>}
43-
</li>
44-
<li>
45-
<Dropdown title={selectedCategory}>
46-
<ul>
47-
{categories.map((item, i) => <li key={i}><a href="javascript:">{item.name}</a></li>)}
48-
</ul>
49-
</Dropdown>
50-
</li>
51-
<li styleName="user">
52-
<Dropdown title={<span>Welcome,<br />{user.name}e</span>}>
53-
<ul>
54-
<li>
55-
<a href="javascript:">Profile</a>
56-
</li>
57-
<li>
58-
<a href="javascript:">Logout</a>
59-
</li>
60-
</ul>
61-
</Dropdown>
62-
</li>
63-
</ul>
64-
</nav>
45+
{
46+
(() => {
47+
const isLoggedIn = false;
48+
if (!loggedUser) {
49+
return (
50+
[
51+
(<li key="category">
52+
<Dropdown title={selectedCategory}>
53+
<ul>
54+
{categories.map((item, i) => <li key={i}><a href="javascript:">{item.name}</a></li>)}
55+
</ul>
56+
</Dropdown>
57+
</li>),
58+
(<li key="login" styleName="login">
59+
<LogInSignUpModalContainer />
60+
</li>),
61+
]
62+
);
63+
}
64+
return (
65+
[
66+
(<li key="notification" styleName="notifications" onClick={() => handleNotification(!toggleNotif)}>
67+
{notifications.length > 0 && <span styleName="counter">{notifications.length}</span>}
68+
{toggleNotif && <Notification notifications={notifications} toggleNotif={toggleNotif} handleNotification={handleNotification} />}
69+
</li>),
70+
(<li key="category">
71+
<Dropdown title={selectedCategory}>
72+
<ul>
73+
{categories.map((item, i) => <li key={i}><a href="javascript:">{item.name}</a></li>)}
74+
</ul>
75+
</Dropdown>
76+
</li>),
77+
(<li key="welcome" styleName="user">
78+
<Dropdown title={<span>Welcome,<br />{user.name}e</span>}>
79+
<ul>
80+
<li>
81+
<a href="javascript:">Profile</a>
82+
</li>
83+
<li>
84+
<a href="javascript:">Logout</a>
85+
</li>
86+
</ul>
87+
</Dropdown>
88+
</li>),
89+
]
90+
);
91+
})()
92+
}
93+
94+
</ul>
95+
</nav>
6596
);
6697

6798
Header.propTypes = {
@@ -71,6 +102,10 @@ Header.propTypes = {
71102
categories: PropTypes.array.isRequired,
72103
notifications: PropTypes.array.isRequired,
73104
user: PropTypes.object.isRequired,
105+
handleNotification: PropTypes.func,
106+
toggleNotif: PropTypes.bool,
107+
loggedUser: PropTypes.bool,
108+
isLoggedIn: PropTypes.bool,
74109
};
75110

76111
export default CSSModules(Header, styles);

src/components/Header/Header.scss

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@
8888

8989
.notifications {
9090
background: url("icon-notification.png") no-repeat center center;
91-
91+
cursor: pointer;
92+
position: relative;
9293
.counter {
9394
position: relative;
9495
top: -5px;
@@ -104,3 +105,13 @@
104105
font-weight: bold;
105106
}
106107
}
108+
109+
.signup, .login {
110+
a {
111+
display: block;
112+
font-size: 14px;
113+
color: #fff;
114+
font-weight: bold;
115+
}
116+
117+
}

src/components/InfoIcon/InfoIcon.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import CSSModules from 'react-css-modules';
33
import Tooltip from 'rc-tooltip';
44
import styles from './InfoIcon.scss';
55

6-
export const InfoIcon = ({children}) => (
6+
export const InfoIcon = ({children, cName, position}) => (
77
<div styleName="info-icon">
8-
<Tooltip placement="right" trigger={['hover', 'click']} overlay={children}>
9-
<div styleName="icon" />
8+
<Tooltip placement={position} trigger={['hover', 'click']} overlay={children}>
9+
<div styleName="icon" className={cName} />
1010
</Tooltip>
1111
</div>
1212
);

src/components/InfoIcon/InfoIcon.scss

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,18 @@
99
display: block;
1010
}
1111

12-
:global {
1312

13+
:global {
14+
.black {
15+
background: url('../../styles/img/icon-info-black.png') no-repeat 0 0;
16+
width: 20px;
17+
height: 13px;
18+
display: inline-block;
19+
vertical-align: middle;
20+
margin-left: 7px;
21+
position: relative;
22+
top: -1px;
23+
}
1424
.rc-tooltip {
1525
position: absolute;
1626
z-index: 1070;
@@ -19,7 +29,7 @@
1929
line-height: 1.5;
2030
font-size: 13px;
2131
background-color: #fff;
22-
opacity: 0.73;
32+
opacity: 1;
2333
font-style: italic;
2434
box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.2);
2535
border-radius: 3px;
@@ -116,4 +126,9 @@
116126
transform: scale(0, 0);
117127
}
118128
}
129+
.infowindowContent {
130+
.rc-tooltip {
131+
opacity: 1;
132+
}
133+
}
119134
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React, { PropTypes, Component } from 'react';
2+
import CSSModules from 'react-css-modules';
3+
import _ from 'lodash';
4+
import enhanceWithClickOutside from 'react-click-outside';
5+
import styles from './Notification.scss';
6+
import NotificationRow from './NotificationRow';
7+
8+
9+
class Notification extends Component {
10+
handleClickOutside() {
11+
this.props.handleNotification(!this.props.toggleNotif);
12+
}
13+
render() {
14+
const {toggleNotif, handleNotification, notifications} = this.props;
15+
return (
16+
<div styleName="notifications">
17+
<div styleName="notifications-head">
18+
<p>You have {notifications.length} notifications:</p>
19+
</div>
20+
<div styleName="notifications-rows">
21+
{
22+
notifications.map((notification, i) => (
23+
<div key={i} className={styles.notifiRow}><NotificationRow notification={notification} /></div>
24+
))
25+
}
26+
</div>
27+
<div styleName="notifications-footer">
28+
<a href="javascript:;">See All Notifications</a>
29+
</div>
30+
</div>
31+
);
32+
}
33+
}
34+
35+
Notification.defaultProps = {
36+
notifications: PropTypes.array.isRequired,
37+
};
38+
39+
export default enhanceWithClickOutside(CSSModules(Notification, styles));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy