Skip to content

Commit 8b4eefd

Browse files
committed
challenge 30056079 -- SERVICE REQUEST
1 parent 1b39852 commit 8b4eefd

File tree

73 files changed

+2031
-1116
lines changed

Some content is hidden

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

73 files changed

+2031
-1116
lines changed

config/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ module.exports = {
77
PORT: process.env.PORT || 3000,
88

99
// below env variables are visible in frontend
10-
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyC9tPymo7xUlvPlK_yNulgXTZalxJM2Wv8',
1111
};

config/development.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ module.exports = {
77
PORT: process.env.PORT || 3000,
88

99
// below env variables are visible in frontend
10-
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyC9tPymo7xUlvPlK_yNulgXTZalxJM2Wv8',
1111
};

config/production.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ module.exports = {
77
PORT: process.env.PORT || 3000,
88

99
// below env variables are visible in frontend
10-
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyC9tPymo7xUlvPlK_yNulgXTZalxJM2Wv8',
1111
};

config/staging.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ module.exports = {
77
PORT: process.env.PORT || 3000,
88

99
// below env variables are visible in frontend
10-
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyC9tPymo7xUlvPlK_yNulgXTZalxJM2Wv8',
1111
};

config/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ module.exports = {
77
PORT: process.env.PORT || 3000,
88

99
// below env variables are visible in frontend
10-
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
10+
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyC9tPymo7xUlvPlK_yNulgXTZalxJM2Wv8',
1111
};

src/components/Header/Header.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
width: 100%;
44
color: white;
55
position: relative;
6-
z-index: 2;
6+
z-index: 1001;
77

88
> ul {
99
padding: 0;

src/components/Pagination/Pagination.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ Pagination.propTypes = {
3131
onPageChange: PropTypes.func.isRequired,
3232
};
3333

34-
export default CSSModules(Pagination, styles);
34+
export default CSSModules(Pagination, styles, {allowMultiple: true});

src/components/Pagination/Pagination.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
> a {
3838
color: #fff;
3939
}
40-
}
4140

4241
.break,
4342
.next,
@@ -73,3 +72,5 @@
7372
.next {
7473
background-image: url('icon-pagination-next.png');
7574
}
75+
76+
}

src/components/Spinner/Spinner.jsx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import React, {PropTypes} from 'react';
2+
import CSSModules from 'react-css-modules';
3+
import Modal from 'react-modal';
4+
import styles from './Spinner.scss';
5+
6+
const customStyles = {
7+
overlay: {
8+
position: 'fixed',
9+
top: 0,
10+
left: 0,
11+
right: 0,
12+
bottom: 0,
13+
backgroundColor: 'rgba(9, 9, 9, 0.58)',
14+
zIndex: '9999',
15+
},
16+
content: {
17+
top: '50%',
18+
left: '50%',
19+
right: 'auto',
20+
bottom: 'auto',
21+
marginRight: '-50%',
22+
transform: 'translate(-50%, -50%)',
23+
padding: '20px',
24+
minWidth: '217px',
25+
textAlign: 'center',
26+
borderRadius: '5px',
27+
fontWeight: 'bold',
28+
fontSize: '20px',
29+
zIndex: '99999',
30+
},
31+
};
32+
33+
const Spinner = ({content, isOpen, error}) => (
34+
<Modal
35+
style={customStyles}
36+
isOpen={isOpen}
37+
shouldCloseOnOverlayClick={false}
38+
contentLabel="Spinner"
39+
>
40+
<div styleName={error ? 'error' : ''}>
41+
{content}
42+
</div>
43+
</Modal>
44+
);
45+
46+
Spinner.propTypes = {
47+
content: PropTypes.string,
48+
isOpen: PropTypes.bool.isRequired,
49+
error: PropTypes.bool,
50+
};
51+
52+
export default CSSModules(Spinner, styles);

src/components/Spinner/Spinner.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.error{
2+
color:red;
3+
}

src/components/Spinner/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Spinner from './Spinner';
2+
3+
export default Spinner;

src/components/StatusLabel/StatusLabel.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ const statusLabels = {
88
inProgress: 'In Progress', // old style should be removed when all code is binded to backend
99
cancelled: 'Cancelled',
1010
completed: 'Completed',
11-
waiting: 'Waiting',
11+
pending: 'Pending',
1212
scheduled: 'Scheduled',
13+
rejected: 'Rejected',
1314
};
1415

1516
export const StatusLabel = ({value}) => (

src/components/StatusLabel/StatusLabel.scss

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,22 @@
3434
@extend .status-label;
3535
}
3636

37-
.status-label_waiting {
38-
background-color: #e3e3e3;
37+
.status-label_pending {
38+
background-color: lightblue;
3939
background-image: url('icon-status-inprogress.png');
4040

4141
@extend .status-label;
4242
}
4343

44-
.status-label_scheduled {
45-
background-color: #4c4c4c;
44+
.status-label_rejected{
45+
background-color: red;
46+
background-image: url('icon-status-cancelled.png');
47+
48+
@extend .status-label;
49+
}
50+
51+
.status-label_scheduled{
52+
background-color: pink;
4653
background-image: url('icon-status-inprogress.png');
4754

4855
@extend .status-label;

src/components/Tabs/Tabs.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ import React, {PropTypes} from 'react';
22
import CSSModules from 'react-css-modules';
33
import styles from './Tabs.scss';
44

5-
export const Tabs = ({tabList, activeTab}) => (
5+
export const Tabs = ({tabList, onSelect, activeTab}) => (
66
<ul styleName="tab-list">
77
{(tabList || []).map((tab, i) => (
8-
<li onClick={tabList.onClick} styleName={activeTab === i ? 'active-tab' : null} key={i}>{tab.name}</li>
8+
<li onClick={() => onSelect(i)} styleName={activeTab === i ? 'active-tab' : null} key={i}>{tab.name}</li>
99
))}
1010
</ul>
1111
);
1212

1313
Tabs.propTypes = {
1414
tabList: PropTypes.array.isRequired,
1515
activeTab: PropTypes.number.isRequired,
16+
onSelect: PropTypes.func,
1617
};
1718

1819
export default CSSModules(Tabs, styles);

src/config/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ module.exports = {
1212
AUTH0_CLIENT_ID: process.env.REACT_APP_AUTH0_CLIENT_ID || 'h7p6V93Shau3SSvqGrl6V4xrATlkrVGm',
1313
AUTH0_CLIENT_DOMAIN: process.env.REACT_APP_AUTH0_CLIENT_DOMAIN || 'spanhawk.auth0.com',
1414
AUTH0_CALLBACK: 'http://localhost:3000',
15-
1615
};

src/containers/HeaderContainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const mapState = (state) => ({...state.global});
1313
(i.e. if the toggleNotification and loginAction actions are part of
1414
the acetions object, injected into the asyncConnect call below).
1515
16-
const mapDispatchToProps = (dispatch) => ({
16+
const mapDispatchToProps = (dispatch) => ({ // eslint-disable-line no-unused-vars
1717
handleNotification: (value) => {
1818
dispatch(toggleNotification(value));
1919
},

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<title>Drone Market</title>
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
7-
<script src="https://maps.googleapis.com/maps/api/js?key=<%= htmlWebpackPlugin.options.GOOGLE_API_KEY %>&libraries=drawing" type="text/javascript"></script>
7+
<script src="https://maps.googleapis.com/maps/api/js?key=<%= htmlWebpackPlugin.options.GOOGLE_API_KEY %>&libraries=drawing,geometry" type="text/javascript"></script>
88
</head>
99
<body>
1010
<div id="root" style="height: 100%"></div>
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import React, {PropTypes, Component} from 'react';
2+
import CSSModules from 'react-css-modules';
3+
import cn from 'classnames';
4+
import Modal from 'react-modal';
5+
import styles from './AssignDrone.scss';
6+
7+
const customStyles = {
8+
overlay: {
9+
position: 'fixed',
10+
top: 0,
11+
left: 0,
12+
right: 0,
13+
bottom: 0,
14+
backgroundColor: 'rgba(9, 9, 9, 0.58)',
15+
zIndex: '9999',
16+
},
17+
content: {
18+
top: '50%',
19+
left: '50%',
20+
right: 'auto',
21+
bottom: 'auto',
22+
marginRight: '-50%',
23+
transform: 'translate(-50%, -50%)',
24+
width: '450px',
25+
height: '500px',
26+
textAlign: 'center',
27+
borderRadius: '5px',
28+
fontWeight: 'bold',
29+
fontSize: '20px',
30+
zIndex: '99999',
31+
padding: '0',
32+
},
33+
};
34+
35+
class AssignDrone extends Component {
36+
constructor() {
37+
super();
38+
39+
this.state = {
40+
selectedDrone: null,
41+
};
42+
this.selectDrone = this.selectDrone.bind(this);
43+
}
44+
45+
selectDrone(i) {
46+
const {afterSelect} = this.props;
47+
48+
this.setState({
49+
selectedDrone: i,
50+
}, () => afterSelect(i));
51+
}
52+
53+
render() {
54+
const {drones, isOpen, closeModal, confirmAssign} = this.props;
55+
return (
56+
<div>
57+
<Modal style={customStyles} isOpen={isOpen} contentLabel="assign-drone">
58+
<div onClick={closeModal} styleName="icon-close" />
59+
<div styleName="title">
60+
Assign drone for the mission
61+
</div>
62+
<div styleName="body">
63+
{
64+
(drones && drones.length > 0) ?
65+
(
66+
<ul>
67+
{
68+
drones.map((d, i) => (
69+
<li key={i} onClick={() => this.selectDrone(i)} styleName={this.state.selectedDrone === i ? 'selected' : null}>
70+
{d.name}
71+
</li>
72+
)
73+
)
74+
}
75+
</ul>
76+
) :
77+
(
78+
<div styleName="no-drones">
79+
No available drones for now!
80+
</div>
81+
)
82+
}
83+
</div>
84+
<div styleName="foot">
85+
<div
86+
styleName={cn({'btn-confirm': true, disabled: this.state.selectedDrone === null})} onClick={
87+
() => {
88+
if (this.state.selectedDrone !== null) {
89+
confirmAssign();
90+
}
91+
}
92+
}
93+
>Confirm</div>
94+
</div>
95+
</Modal>
96+
</div>
97+
);
98+
}
99+
}
100+
101+
AssignDrone.propTypes = {
102+
afterSelect: PropTypes.func,
103+
drones: PropTypes.array,
104+
isOpen: PropTypes.bool.isRequired,
105+
closeModal: PropTypes.func,
106+
confirmAssign: PropTypes.func,
107+
};
108+
109+
export default CSSModules(AssignDrone, styles, {allowMultiple: true});
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
:global{
2+
.ReactModal__Body--open{
3+
overflow: hidden;
4+
}
5+
}
6+
.title{
7+
height: 50px;
8+
background-color: #E1E2E5;
9+
line-height: 50px;
10+
padding-left:20px;
11+
border-bottom: 1px solid #333;
12+
}
13+
.icon-close{
14+
background-image: url("icon-close-modal.png");
15+
position: absolute;
16+
width: 24px;
17+
height: 24px;
18+
top:12px;
19+
right:12px;
20+
cursor: pointer;
21+
}
22+
.body{
23+
padding-top:20px;
24+
height: calc(100% - 110px);
25+
overflow: auto;
26+
ul{
27+
text-align: left;
28+
list-style:none;
29+
padding:0;
30+
margin:0;
31+
li{
32+
padding: 10px 20px;
33+
cursor: pointer;
34+
&.selected{
35+
background-color: #224488;
36+
color:#fff;
37+
}
38+
}
39+
}
40+
}
41+
.no-drones{
42+
text-align: center;
43+
}
44+
.foot{
45+
height: 60px;
46+
display: flex;
47+
align-items:center;
48+
justify-content: flex-end;
49+
background-color: #E1E2E5;
50+
padding: 0 20px;
51+
.btn-confirm{
52+
color:#fff;
53+
background-color: #224488;
54+
height: 36px;
55+
line-height: 36px;
56+
padding:0 16px;
57+
border-radius: 4px;
58+
cursor: pointer;
59+
&.disabled{
60+
cursor: not-allowed;
61+
}
62+
}
63+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import AssignDrone from './AssignDrone';
2+
3+
export default AssignDrone;

0 commit comments

Comments
 (0)