Skip to content

Commit a557bf8

Browse files
authored
Merge pull request #5 from topcoderinc/dev
Dev +map and mission and 3 and 4
2 parents 5ae6e01 + 047430b commit a557bf8

File tree

148 files changed

+3908
-200
lines changed

Some content is hidden

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

148 files changed

+3908
-200
lines changed

.eslintrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"no-script-url": 0,
2222
"max-len": 0,
2323
"new-cap": 0,
24-
"object-curly-spacing": 0,
24+
"object-curly-spacing": ["error", "always"],
2525
"react/jsx-no-bind": 0,
2626
"no-mixed-operators": 0,
2727
"arrow-parens": [
@@ -41,6 +41,6 @@
4141
"jsx-a11y/label-has-for": 0,
4242
"no-plusplus": 0,
4343
"jsx-a11y/no-static-element-interactions": 0,
44-
"no-use-before-define": ["error", { "functions": false, "classes": true }]
44+
"no-use-before-define": ["error", { "functions": false, "classes": true }],
4545
}
4646
}

README.md

+2-22
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# dsp-fronted
1+
## DSP app
22

33
## Requirements
44
* node v6 (https://nodejs.org)
55

66
## Quick Start
7-
* `npm install -g nodemon`
87
* `npm install`
98
* `npm run dev`
109
* Navigate browser to `http://localhost:3000`
@@ -18,6 +17,7 @@ See Guild https://github.com/lorenwest/node-config/wiki/Configuration-Files
1817
|----|-----------|
1918
|`PORT`| The port to listen|
2019
|`GOOGLE_API_KEY`| The google api key see (https://developers.google.com/maps/documentation/javascript/get-api-key#key)|
20+
|`API_BASE_URL`| The base URL for Drone API |
2121

2222

2323
## Install dependencies
@@ -36,23 +36,3 @@ See Guild https://github.com/lorenwest/node-config/wiki/Configuration-Files
3636

3737
## Google Map
3838
In this project module [react-google-maps](https://github.com/tomchentw/react-google-maps) is used to work with google maps. So it can be used for any new functionality.
39-
40-
# Challenges
41-
42-
## [30055900](https://www.topcoder.com/challenge-details/30055900)
43-
## DONE
44-
- All modules were rewritten almost from the scratch because the previous code was very buggy, hard to support and too far from the redux way which is used in the new project. This was the biggest job. Current code is much more robust and is 99% stateless.
45-
- For most important parts detailed unit tests are written.
46-
- Redrawing mission on the map was optimised, no unnecessary redrawing.
47-
- Readme file was cleaned and updated with information about tests and module used to implement google maps for future developers.
48-
49-
## ADDITIONALLY
50-
- These small things from `kbowerma` was added:
51-
- - I know this was not in the challenge req but another thing that would be nice is if the label for PARAM4 changed to “Heading” only if NAV_WAYPOINT is selected. and PARAMA1 label changed to “hold time” only if NAV_WAYPOINT is selected.
52-
- - IT should be, but home and take off should be pinned together with the first click, but then should be able to be dragged or updated with text separately
53-
- All modules integrated with current project styles.
54-
- Test environment was set up. It uses `Mocha`, `Chai` and `Enzyme`. Also, it supports `jsx`, `css-modules` and `webpack resolve aliases`. Even though it's implicitly the scope of the challenge, it was a tangible part.
55-
56-
## NOTES
57-
- As there is no Authorization implemented in the project. In the API I've hardcoded automatic registering and authorization of a dumb user to make requests to the server.
58-
- A lot of files in the repository had the `crlf` line endings. Though `eslint` and `.editorconfig` prescribe using `lf` line endings. So all files were converted to `lf` line endings to pass the linting process and follow configuration.

config/default.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
* Main config file
44
*/
55
module.exports = {
6+
// below env variables are NOT visible in frontend
67
PORT: process.env.PORT || 3000,
8+
9+
// below env variables are visible in frontend
710
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
8-
//API_BASE_PATH: process.env.API_BASE_PATH || 'http://localhost:3000',
911
API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com',
1012
};

package.json

+9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"copy-webpack-plugin": "^4.0.0",
3333
"cross-env": "^3.1.2",
3434
"css-loader": "^0.23.0",
35+
"dateformat": "^2.0.0",
3536
"express": "^4.14.0",
3637
"extract-text-webpack-plugin": "^1.0.1",
3738
"file-loader": "^0.9.0",
@@ -43,6 +44,7 @@
4344
"json-loader": "^0.5.4",
4445
"lodash": "^4.16.4",
4546
"moment": "^2.17.0",
47+
"node-js-marker-clusterer": "^1.0.0",
4648
"node-sass": "^3.7.0",
4749
"postcss-flexboxfixer": "0.0.5",
4850
"postcss-loader": "^0.13.0",
@@ -55,12 +57,18 @@
5557
"react-flexbox-grid": "^0.10.2",
5658
"react-google-maps": "^6.0.1",
5759
"react-modal": "^1.5.2",
60+
"react-flexbox-grid": "^0.10.2",
61+
"react-highcharts": "^11.0.0",
62+
"react-modal": "^1.5.2",
5863
"react-redux": "^4.0.0",
5964
"react-redux-toastr": "^4.2.2",
6065
"react-router": "^2.8.1",
6166
"react-router-redux": "^4.0.0",
6267
"react-select": "^1.0.0-rc.2",
6368
"react-simple-dropdown": "^1.1.5",
69+
"react-slick": "^0.14.5",
70+
"react-star-rating-component": "^1.2.2",
71+
"react-timeago": "^3.1.3",
6472
"redbox-react": "^1.2.10",
6573
"redux": "^3.0.0",
6674
"redux-actions": "^0.10.1",
@@ -69,6 +77,7 @@
6977
"redux-logger": "^2.6.1",
7078
"redux-thunk": "^2.0.0",
7179
"sass-loader": "^4.0.0",
80+
"socket.io-client": "^1.7.1",
7281
"style-loader": "^0.13.0",
7382
"superagent": "^2.3.0",
7483
"superagent-promise": "^1.1.0",

src/components/Accordion/Accordion.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import CSSModules from 'react-css-modules';
44
import cn from 'classnames';
55
import styles from './Accordion.scss';
66

7-
export const Accordion = ({onToggleExpand, isExpanded, children, title}) => (
8-
<div styleName={cn('accordion', {expanded: isExpanded})}>
7+
export const Accordion = ({ onToggleExpand, isExpanded, children, title }) => (
8+
<div styleName={cn('accordion', { expanded: isExpanded })}>
99
<div styleName="title" onClick={() => onToggleExpand(!isExpanded)}>
1010
{title}
1111
</div>
@@ -20,6 +20,6 @@ Accordion.propTypes = {
2020
title: PropTypes.any,
2121
};
2222

23-
export default uncontrollable(CSSModules(Accordion, styles, {allowMultiple: true}), {
23+
export default uncontrollable(CSSModules(Accordion, styles, { allowMultiple: true }), {
2424
isExpanded: 'onToggleExpand',
2525
});
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React, { PropTypes } from 'react';
2+
import CSSModules from 'react-css-modules';
3+
import { Link } from 'react-router';
4+
import styles from './Breadcrumb.scss';
5+
6+
export const Breadcrumb = ({ items }) => (
7+
<ul styleName="breadcrumb">
8+
{items.map((item, index) => (
9+
<li styleName="item" key={index}>
10+
{item.path
11+
? <Link to={item.path}>{item.text}</Link>
12+
: <span key={index}>{item.text}</span>}
13+
</li>
14+
))}
15+
</ul>
16+
);
17+
18+
const BreadcrumbItemPropType = {
19+
text: PropTypes.string.isRequired,
20+
path: PropTypes.string,
21+
};
22+
23+
Breadcrumb.propTypes = {
24+
items: PropTypes.arrayOf(
25+
PropTypes.shape(BreadcrumbItemPropType)
26+
).isRequired,
27+
};
28+
29+
export default CSSModules(Breadcrumb, styles);
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.breadcrumb {
2+
background-color: #fff;
3+
border-bottom: 1px solid #d8d8d8;
4+
border-top: 1px solid #d8d8d8;
5+
color: #525051;
6+
font-size: 12px;
7+
line-height: 37px;
8+
margin: 0;
9+
padding: 0 30px;
10+
}
11+
12+
.item {
13+
display: inline;
14+
list-style: none;
15+
16+
&:after {
17+
content: '>';
18+
display: inline;
19+
margin-left: 4px;
20+
margin-right: 8px;
21+
}
22+
23+
&:last-child:after {
24+
content: '';
25+
display: none;
26+
}
27+
28+
> a {
29+
color: #525051;
30+
}
31+
32+
> span {
33+
color: #525051;
34+
font-weight: 600;
35+
}
36+
}

src/components/Breadcrumb/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Breadcrumb from './Breadcrumb';
2+
3+
export default Breadcrumb;

src/components/Button/Button.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ Button.defaultProps = {
2121
size: 'normal',
2222
};
2323

24-
export default CSSModules(Button, styles, {allowMultiple: true});
24+
export default CSSModules(Button, styles, { allowMultiple: true });

src/components/DatePicker/DatePicker.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import CSSModules from 'react-css-modules';
33
import { DateField, TransitionView, Calendar } from 'react-date-picker';
44
import styles from './DatePicker.scss';
55

6-
export const DatePicker = ({onChange, value}) => (
6+
export const DatePicker = ({ onChange, value }) => (
77
<div styleName="date-picker">
88
<DateField
99
dateFormat="YYYY-MM-DD hh:mm:ss A"
1010
onChange={onChange}
1111
value={value}
1212
>
1313
<TransitionView>
14-
<Calendar style={{padding: 10}} />
14+
<Calendar style={{ padding: 10 }} />
1515
</TransitionView>
1616
</DateField>
1717
</div>

src/components/Dropdown/Dropdown.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import CSSModules from 'react-css-modules';
33
import ReactDropdown, { DropdownTrigger, DropdownContent } from 'react-simple-dropdown';
44
import styles from './Dropdown.scss';
55

6-
export const Dropdown = ({title, children}) => (
6+
export const Dropdown = ({ title, children }) => (
77
<div styleName="dropdown">
88
<ReactDropdown>
99
<DropdownTrigger className={styles.trigger}>{title}</DropdownTrigger>

src/components/Dropdown/Dropdown.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
background: white;
2020
border: 1px solid #d8d8d8;
2121
box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.06);
22+
z-index: 1;
2223

2324
ul {
2425
margin: 0;
@@ -45,7 +46,7 @@
4546
.trigger {
4647
position: relative;
4748
padding-right: 20px;
48-
49+
4950
&, &:hover, &:active, &:focus, &:focus:active {
5051
color: white;
5152
}

src/components/Footer/Footer.jsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ import styles from './Footer.scss';
44

55
export const Footer = () => (
66
<div styleName="footer">
7-
<div styleName="copyright">
8-
Copyright © Drone Website. All Rights Reserved
9-
</div>
10-
<ul>
11-
<li><a href="#">Disclaimer</a></li>
12-
<li><a href="#">Privacy Policy</a></li>
13-
<li><a href="#">Terms & Conditions</a></li>
14-
</ul>
7+
<p styleName="copyright">Copyright © Drone Website. All Rights Reserved</p>
8+
9+
<nav styleName="menu">
10+
<a styleName="menu-item" href="javascript:;">Disclaimer</a>
11+
<a styleName="menu-item" href="javascript:;">Privacy Policy</a>
12+
<a styleName="menu-item" href="javascript:;">Terms & Conditions</a>
13+
</nav>
1514
</div>
1615
);
1716

src/components/Footer/Footer.scss

+25-26
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
11
.footer {
2-
width: 100%;
3-
background-color: #101010;
4-
min-height: 50px;
5-
display: flex;
2+
background-color: #131313;
63
color: #fff;
74
font-size: 14px;
8-
display: flex;
9-
align-items: center;
10-
padding: 0 18px 0 30px;
11-
flex-direction: row;
5+
line-height: 49px;
6+
padding: 0 35px;
7+
}
128

9+
.footer:after {
10+
clear: both;
11+
content: '';
12+
display: table;
13+
}
1314

14-
.copyright {
15-
display: flex;
16-
}
15+
.copyright {
16+
float: left;
17+
margin: 0;
18+
padding: 0;
19+
}
1720

18-
ul {
19-
display: flex;
20-
flex-direction: row;
21-
margin: 0;
22-
padding: 0;
23-
list-style: none;
24-
margin-left: auto;
21+
.menu {
22+
float: right;
23+
}
2524

26-
li {
27-
margin: 0 25px;
25+
a.menu-item {
26+
color: #fff;
27+
margin-right: 65px;
28+
text-decoration: none;
29+
}
2830

29-
a {
30-
color: #fff;
31-
}
32-
}
33-
}
34-
}
31+
.menu-item:last-child {
32+
margin-right: 0;
33+
}

src/components/FormField/FormField.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import CSSModules from 'react-css-modules';
33
import cn from 'classnames';
44
import styles from './FormField.scss';
55

6-
export const FormField = ({label, error, touched, children}) => (
7-
<div styleName={cn('form-field', {error: error && touched})}>
6+
export const FormField = ({ label, error, touched, children }) => (
7+
<div styleName={cn('form-field', { error: error && touched })}>
88
<div styleName="label">{label || <span>&nbsp;</span>}</div>
99
{children}
1010
{error && touched && <div styleName="error-message">{error}</div>}
@@ -18,4 +18,4 @@ FormField.propTypes = {
1818
children: PropTypes.any.isRequired,
1919
};
2020

21-
export default CSSModules(FormField, styles, {allowMultiple: true});
21+
export default CSSModules(FormField, styles, { allowMultiple: true });

src/components/Header/Header.jsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { PropTypes } from 'react';
22
import CSSModules from 'react-css-modules';
3+
import { Link } from 'react-router';
34
import SearchInput from '../SearchInput';
45
import Dropdown from '../Dropdown';
56
import styles from './Header.scss';
@@ -13,7 +14,9 @@ export const Header = ({location, selectedCategory, categories, user, notificati
1314
{
1415
(() => {
1516
const currentRoute = routes[routes.length - 1].name;
16-
if (currentRoute === 'ServiceRequest') {
17+
if (currentRoute === 'ServiceRequest'
18+
|| currentRoute === 'MyRequestStatus'
19+
|| currentRoute === 'StatusDetail') {
1720
return (
1821
[(<li key="location" styleName="location">
1922
<i />
@@ -28,11 +31,13 @@ export const Header = ({location, selectedCategory, categories, user, notificati
2831
return (
2932
<li styleName="pages">
3033
<ul>
31-
<li className={currentRoute === 'Dashboard' ? 'active' : null}><a href="/dashboard">Dashboard</a></li>
32-
<li className={currentRoute === 'Requests' ? 'active' : null}><a href="/my-request">Requests</a></li>
34+
<li className={currentRoute === 'Dashboard' ? 'active' : null}><Link to="/dashboard">Dashboard</Link></li>
35+
<li className={currentRoute === 'Requests' ? 'active' : null}><Link to="/my-request">Requests</Link></li>
3336
<li className={currentRoute === 'MyDrones' ? 'active' : null}>My Drones</li>
3437
<li className={currentRoute === 'MyServices' ? 'active' : null}>My Services</li>
3538
<li className={currentRoute === 'Analytics' ? 'active' : null}>Analytics</li>
39+
<li className={currentRoute === 'DroneMap' ? 'active' : null}><Link to="/drones-map">Drone Traffic</Link></li>
40+
<li className={currentRoute === 'MissionPlanner' ? 'active' : null}><Link to="/mission-planner">MissionPlanner</Link></li>
3641
</ul>
3742
</li>
3843
);

src/components/InfoIcon/InfoIcon.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ 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 }) => (
77
<div styleName="info-icon">
88
<Tooltip placement="right" trigger={['hover', 'click']} overlay={children}>
99
<div styleName="icon" />

0 commit comments

Comments
 (0)