Skip to content

Commit 20b4e66

Browse files
committed
Challenge-3 results
1 parent 52c501b commit 20b4e66

File tree

81 files changed

+594
-2970
lines changed

Some content is hidden

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

81 files changed

+594
-2970
lines changed

README.md

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# dsp-fronted
1+
## DSP app
22

33
## Requirements
44
* node v6 (https://nodejs.org)
@@ -11,7 +11,7 @@
1111

1212

1313
## Configuration
14-
Configuration files are located under `config` dir.
14+
Configuration files are located under `config` dir.
1515
See Guild https://github.com/lorenwest/node-config/wiki/Configuration-Files
1616

1717
|Name|Description|
@@ -32,27 +32,7 @@ See Guild https://github.com/lorenwest/node-config/wiki/Configuration-Files
3232
|`dev`|Start app in the dev mode.|
3333
|`lint`|Lint all `.js` files.|
3434
|`lint:fix`|Lint and fix all `.js` files. [Read more on this](http://eslint.org/docs/user-guide/command-line-interface.html#fix).|
35-
|`test`|Run tests using [mocha-webpack](https://github.com/webpack/mocha-loader) for all `*.spec.(js|jsx)` files in the `src` dir.|
36-
37-
## Google Map
38-
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.
35+
36+
37+
## Video
38+
http://take.ms/WZkTO

config/default.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@
55
module.exports = {
66
PORT: process.env.PORT || 3000,
77
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI',
8-
//API_BASE_PATH: process.env.API_BASE_PATH || 'http://localhost:3000',
9-
API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com',
108
};

package.json

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"start": "cross-env NODE_ENV=production node server",
99
"build": "cross-env NODE_ENV=production webpack --bail --progress --build --tc",
1010
"lint": "eslint --ext jsx --ext js .",
11-
"lint:fix": "npm run lint -- --fix",
12-
"test": "mocha-webpack --require setup-test.js --webpack-config webpack.config-test.js \"src/**/*.spec.(jsx|js)\""
11+
"lint:fix": "npm run lint -- --fix"
1312
},
1413
"author": "",
1514
"license": "MIT",
@@ -32,6 +31,7 @@
3231
"copy-webpack-plugin": "^4.0.0",
3332
"cross-env": "^3.1.2",
3433
"css-loader": "^0.23.0",
34+
"dateformat": "^2.0.0",
3535
"express": "^4.14.0",
3636
"extract-text-webpack-plugin": "^1.0.1",
3737
"file-loader": "^0.9.0",
@@ -52,15 +52,18 @@
5252
"react-css-modules": "^3.7.10",
5353
"react-date-picker": "^5.3.28",
5454
"react-dom": "^15.3.2",
55+
"react-modal": "^1.5.2",
5556
"react-flexbox-grid": "^0.10.2",
56-
"react-google-maps": "^6.0.1",
57+
"react-highcharts": "^11.0.0",
5758
"react-modal": "^1.5.2",
5859
"react-redux": "^4.0.0",
59-
"react-redux-toastr": "^4.2.2",
6060
"react-router": "^2.8.1",
6161
"react-router-redux": "^4.0.0",
6262
"react-select": "^1.0.0-rc.2",
6363
"react-simple-dropdown": "^1.1.5",
64+
"react-slick": "^0.14.5",
65+
"react-star-rating-component": "^1.2.2",
66+
"react-timeago": "^3.1.3",
6467
"redbox-react": "^1.2.10",
6568
"redux": "^3.0.0",
6669
"redux-actions": "^0.10.1",
@@ -78,23 +81,15 @@
7881
"yargs": "^4.0.0"
7982
},
8083
"devDependencies": {
81-
"chai": "^3.5.0",
82-
"css-modules-require-hook": "^4.0.5",
83-
"enzyme": "^2.6.0",
8484
"eslint": "^3.7.1",
8585
"eslint-config-airbnb": "^12.0.0",
8686
"eslint-plugin-babel": "^3.3.0",
8787
"eslint-plugin-import": "^1.16.0",
8888
"eslint-plugin-jsx-a11y": "^2.2.2",
8989
"eslint-plugin-react": "^6.3.0",
90-
"jsdom": "^9.8.3",
91-
"mocha": "^3.2.0",
92-
"mocha-webpack": "^0.7.0",
9390
"nodemon": "^1.8.1",
94-
"react-addons-test-utils": "^15.4.1",
9591
"webpack-dev-middleware": "^1.8.3",
96-
"webpack-hot-middleware": "^2.13.0",
97-
"webpack-node-externals": "^1.5.4"
92+
"webpack-hot-middleware": "^2.13.0"
9893
},
9994
"engines": {
10095
"node": "6.7.0"

setup-test.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/components/Accordion/Accordion.jsx

Lines changed: 3 additions & 3 deletions
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
});

src/components/Button/Button.jsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,19 @@ import _ from 'lodash';
44
import cn from 'classnames';
55
import styles from './Button.scss';
66

7-
export const Button = ({children, color, size, ...rest}) => (
8-
<button {..._.omit(rest, 'styles')} styleName={cn('button', `color-${color}`, `size-${size}`)}>
7+
export const Button = ({ children, color, ...rest }) => (
8+
<button {..._.omit(rest, 'styles')} styleName={cn('button', `color-${color}`)}>
99
{children}
1010
</button>
1111
);
1212

1313
Button.propTypes = {
1414
children: PropTypes.string.isRequired,
1515
color: PropTypes.string.isRequired,
16-
size: PropTypes.string,
1716
};
1817

1918
Button.defaultProps = {
2019
type: 'button',
21-
size: 'normal',
2220
};
2321

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

src/components/Button/Button.scss

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.button {
2+
padding: 13px 10px;
23
min-width: 115px;
34
color: white;
45
border: none;
@@ -11,13 +12,4 @@
1112

1213
.color-blue {
1314
background: #315b95;
14-
}
15-
16-
.size-normal {
17-
padding: 13px 10px;
18-
}
19-
20-
.size-medium {
21-
height: 38px;
22-
padding: 0 10px;
23-
}
15+
}

src/components/DatePicker/DatePicker.jsx

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 7 additions & 8 deletions
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

Lines changed: 25 additions & 26 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export const Header = ({location, selectedCategory, categories, user, notificati
1313
{
1414
(() => {
1515
const currentRoute = routes[routes.length - 1].name;
16-
if (currentRoute === 'ServiceRequest') {
16+
if (currentRoute === 'ServiceRequest'
17+
|| currentRoute === 'MyRequestStatus'
18+
|| currentRoute === 'StatusDetail') {
1719
return (
1820
[(<li key="location" styleName="location">
1921
<i />

src/components/InfoIcon/InfoIcon.jsx

Lines changed: 1 addition & 1 deletion
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" />

src/components/Row/Row.jsx

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

5-
export const Row = ({children}) => (
5+
export const Row = ({ children }) => (
66
<div styleName="row">
7-
{children.map((item, i) => <div key={i} styleName="col" style={{width: `${100 / children.length}%`}}>{item}</div>)}
7+
{children.map((item, i) => <div key={i} styleName="col" style={{ width: `${100 / children.length}%` }}>{item}</div>)}
88
</div>
99
);
1010

0 commit comments

Comments
 (0)