diff --git a/.env b/.env.example similarity index 100% rename from .env rename to .env.example diff --git a/.eslintrc b/.eslintrc index c15015b..848a361 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,7 +11,7 @@ "google": true, }, "rules": { - "import/no-unresolved": [2, { ignore: ['^components/', '^containers/', '^services/', '^layouts/', '^store/', '^api/', '^routes/'] }], + "import/no-unresolved": [2, { ignore: ['^components/', '^containers/', '^services/', '^layouts/', '^store/', '^api/', '^routes/', '^Const'] }], // temporary for in-progress features "no-alert": 0, diff --git a/.gitignore b/.gitignore index e043f42..20c36db 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ node_modules dist coverage .tmp +/.env diff --git a/README.md b/README.md index 0d4c26c..f8cfdec 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ## Configuration -Configuration files are located under `config` dir. +Configuration files are located under `config` and `src/config` directories. See Guild https://github.com/lorenwest/node-config/wiki/Configuration-Files |Name|Description| @@ -18,7 +18,12 @@ See Guild https://github.com/lorenwest/node-config/wiki/Configuration-Files |`PORT`| The port to listen| |`GOOGLE_API_KEY`| The google api key see (https://developers.google.com/maps/documentation/javascript/get-api-key#key)| |`API_BASE_URL`| The base URL for Drone API | +|`REACT_APP_API_BASE_PATH`| The React app api base path`| +|`REACT_APP_SOCKET_URL`| The React app app socket url`| +|`REACT_APP_AUTH0_CLIEND_ID`| The React app auth0 client id`| +|`REACT_APP_AUTH0_DOMAIN`| The React app auth0 domain`| +Environment variables will be loaded from the .env file during build. Create the .env file based on the provided env.example ## Install dependencies `npm i` diff --git a/config/default.js b/config/default.js index 6bc8230..f1bbbf3 100644 --- a/config/default.js +++ b/config/default.js @@ -8,5 +8,4 @@ module.exports = { // below env variables are visible in frontend GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI', - API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com/', }; diff --git a/config/development.js b/config/development.js index 6bc8230..f1bbbf3 100644 --- a/config/development.js +++ b/config/development.js @@ -8,5 +8,4 @@ module.exports = { // below env variables are visible in frontend GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI', - API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com/', }; diff --git a/config/production.js b/config/production.js index 04e870d..2bdcc33 100644 --- a/config/production.js +++ b/config/production.js @@ -8,5 +8,4 @@ module.exports = { // below env variables are visible in frontend GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI', - API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com/', }; diff --git a/config/staging.js b/config/staging.js index 6bc8230..f1bbbf3 100644 --- a/config/staging.js +++ b/config/staging.js @@ -8,5 +8,4 @@ module.exports = { // below env variables are visible in frontend GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI', - API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com/', }; diff --git a/config/test.js b/config/test.js index 6bc8230..f1bbbf3 100644 --- a/config/test.js +++ b/config/test.js @@ -8,5 +8,4 @@ module.exports = { // below env variables are visible in frontend GOOGLE_API_KEY: process.env.GOOGLE_API_KEY || 'AIzaSyCrL-O319wNJK8kk8J_JAYsWgu6yo5YsDI', - API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com/', }; diff --git a/envSample b/envSample deleted file mode 100644 index 4a42b68..0000000 --- a/envSample +++ /dev/null @@ -1,5 +0,0 @@ -REACT_APP_API_BASE_PATH=https://kb-dsp-server.herokuapp.com -REACT_APP_SOCKET_URL=https://kb-dsp-server.herokuapp.com -REACT_APP_AUTH0_CLIEND_ID=3CGKzjS2nVSqHxHHE64RhvvKY6e0TYpK -REACT_APP_AUTH0_DOMAIN=dronetest.auth0.com -REACT_APP_GOOGLE_API_KEY=AIzaSyCR3jfBdv9prCBYBOf-fPUDhjPP4K05YjE diff --git a/package.json b/package.json index b04c246..d4eb605 100644 --- a/package.json +++ b/package.json @@ -5,20 +5,20 @@ "main": "index.js", "scripts": { "dev": "cross-env NODE_ENV=development nodemon server", - "start": "node --max-old-space-size=512 server", - "build": "node --max-old-space-size=512 ./node_modules/webpack/bin/webpack --bail --progress --build --tc", + "start": "node --max-old-space-size=384 server", + "build": "node --max-old-space-size=384 ./node_modules/webpack/bin/webpack --bail --progress --build --tc", "lint": "eslint --ext jsx --ext js .", "lint:fix": "npm run lint -- --fix", "test": "mocha-webpack --require setup-test.js --webpack-config webpack.config-test.js \"src/**/*.spec.(jsx|js)\"", - "postinstall":"npm run build", - "heroku:prod:init":"git remote remove production && heroku create --remote production && heroku config:set NODE_ENV=production --remote production", - "heroku:dev:init": "git remote remove dev && heroku create --remote dev && heroku config:set NODE_ENV=development NPM_CONFIG_PRODUCTION=false --remote dev", - "heroku:staging:init": "git remote remove staging && heroku create --remote staging && heroku config:set NODE_ENV=staging --remote staging", - "heroku:test:init": "git remote remove test && heroku create --remote test && heroku config:set NODE_ENV=test --remote test", - "heroku:prod:deploy":"git push production master", - "heroku:dev:deploy":"git push dev master", - "heroku:staging:deploy":"git push staging master", - "heroku:test:deploy":"git push test master" + "postinstall": "npm run build", + "heroku:prod:init": "git remote remove production && heroku create --remote production && heroku config:set NODE_ENV=production --remote production", + "heroku:dev:init": "git remote remove dev && heroku create --remote dev && heroku config:set NODE_ENV=production --remote dev", + "heroku:staging:init": "git remote remove staging && heroku create --remote staging && heroku config:set NODE_ENV=production --remote staging", + "heroku:test:init": "git remote remove test && heroku create --remote test && heroku config:set NODE_ENV=production --remote test", + "heroku:prod:deploy": "git push production master", + "heroku:dev:deploy": "git push dev master", + "heroku:staging:deploy": "git push staging master", + "heroku:test:deploy": "git push test master" }, "author": "", "license": "MIT", @@ -37,6 +37,7 @@ "babel-preset-stage-0": "^6.16.0", "babel-runtime": "^6.11.6", "bluebird": "^3.4.6", + "circle-to-polygon": "^1.0.0", "classnames": "^2.2.5", "config": "^1.24.0", "connect-history-api-fallback": "^1.3.0", @@ -44,6 +45,8 @@ "cross-env": "^3.1.2", "css-loader": "^0.23.0", "dateformat": "^2.0.0", + "dotenv": "^2.0.0", + "dotenv-webpack": "^1.3.1", "express": "^4.14.0", "extract-text-webpack-plugin": "^1.0.1", "file-loader": "^0.9.0", @@ -61,21 +64,23 @@ "postcss-flexboxfixer": "0.0.5", "postcss-loader": "^0.13.0", "rc-calendar": "^7.5.1", + "rc-slider": "^5.4.0", "rc-tooltip": "^3.4.2", "react": "^15.3.2", "react-breadcrumbs": "^1.5.1", - "react-count-down": "^1.0.3", "react-click-outside": "^2.2.0", + "react-count-down": "^1.0.3", "react-css-modules": "^3.7.10", "react-date-picker": "^5.3.28", "react-dom": "^15.3.2", + "react-dropdown": "^1.2.0", "react-flexbox-grid": "^0.10.2", "react-google-maps": "^6.0.1", - "react-modal": "^1.5.2", - "react-dropdown": "^1.2.0", + "react-highcharts": "^11.0.0", "react-icheck": "^0.3.6", "react-input-range": "^0.9.3", - "react-highcharts": "^11.0.0", + "react-modal": "^1.5.2", + "react-portal": "^3.0.0", "react-redux": "^4.0.0", "react-redux-toastr": "^4.2.2", "react-router": "^2.8.1", @@ -84,8 +89,8 @@ "react-simple-dropdown": "^1.1.5", "react-slick": "^0.14.5", "react-star-rating-component": "^1.2.2", - "react-timeago": "^3.1.3", "react-tabs": "^0.8.2", + "react-timeago": "^3.1.3", "reactable": "^0.14.1", "redbox-react": "^1.2.10", "redux": "^3.0.0", @@ -95,8 +100,8 @@ "redux-logger": "^2.6.1", "redux-thunk": "^2.0.0", "sass-loader": "^4.0.0", - "socket.io-client": "^1.7.1", "slick-carousel": "^1.6.0", + "socket.io-client": "^1.7.1", "style-loader": "^0.13.0", "superagent": "^2.3.0", "superagent-promise": "^1.1.0", diff --git a/src/Const.js b/src/Const.js new file mode 100644 index 0000000..a7ccc4f --- /dev/null +++ b/src/Const.js @@ -0,0 +1,6 @@ + +export const GOOGLE_MAPS_BOUNDS_TIMEOUT = 1000; + +export default { + GOOGLE_MAPS_BOUNDS_TIMEOUT, +}; diff --git a/src/components/AdminHeader/AdminHeader.jsx b/src/components/AdminHeader/AdminHeader.jsx new file mode 100644 index 0000000..a822dd2 --- /dev/null +++ b/src/components/AdminHeader/AdminHeader.jsx @@ -0,0 +1,30 @@ +import React from 'react'; +import CSSModules from 'react-css-modules'; +import {Link} from 'react-router'; +import styles from './AdminHeader.scss'; + +export const AdminHeader = () => ( + +); + +AdminHeader.propTypes = { + +}; + +export default CSSModules(AdminHeader, styles); diff --git a/src/components/AdminHeader/AdminHeader.scss b/src/components/AdminHeader/AdminHeader.scss new file mode 100644 index 0000000..dcabbf5 --- /dev/null +++ b/src/components/AdminHeader/AdminHeader.scss @@ -0,0 +1,13 @@ +.admin-header { + composes: header from '../Header/Header.scss' +} + +.branding { + composes: branding from '../Header/Header.scss' +} + +.pages { + composes: pages from '../Header/Header.scss' +} + + diff --git a/src/components/AdminHeader/index.js b/src/components/AdminHeader/index.js new file mode 100644 index 0000000..6d761e9 --- /dev/null +++ b/src/components/AdminHeader/index.js @@ -0,0 +1,3 @@ +import AdminHeader from './AdminHeader'; + +export default AdminHeader; diff --git a/src/components/Button/Button.scss b/src/components/Button/Button.scss index 1536e6d..48494a9 100644 --- a/src/components/Button/Button.scss +++ b/src/components/Button/Button.scss @@ -3,6 +3,11 @@ color: white; border: none; font-weight: bold; + + &[disabled] { + opacity: 0.6; + cursor: not-allowed; + } } .color-gray { @@ -22,10 +27,17 @@ padding: 0 10px; } +.size-xs { + height: 20px; + padding: 0 5px; + font-size: 12px; + font-weight: normal; +} + .color-black { background: #4c4c4c; } .color-silver { background: #67879a; -} \ No newline at end of file +} diff --git a/src/components/Header/Header.jsx b/src/components/Header/Header.jsx index f92f525..5467cd4 100644 --- a/src/components/Header/Header.jsx +++ b/src/components/Header/Header.jsx @@ -39,23 +39,23 @@ export const Header = ({ return (