From 1823f9eda057f1acd315035a72a9a387d8f871c7 Mon Sep 17 00:00:00 2001 From: Tuomas Suutari Date: Fri, 9 Feb 2018 11:34:54 +0200 Subject: [PATCH] Dashboard: Implement initial version of the app Following features are currently implemented: * A Map showing parking regions (ParkingRegionMap) - Map shows usage of each region by a color from green to red - Map shows more info about a region by clicking a region - Regions can be selected by clicking them on the map * Region can be selected or deselected from a dropdown (RegionSelector) * Possibility to select a date and time of interest; by default uses the current time (TimeSelect) - Time updates automatically every 5 minutes There is also some static non-updating dummy UI components shown to demonstrate features that will be implemented in the future: * A table that will list currently active parkings * A bar diagram that will show histogram of the parking counts from last 24h (or whatever time range is selected) Layout is implemented with Bootstrap 4. Map is implemented using Leaflet. API communication is done with Axios. --- dashboard/.indium | 0 dashboard/LICENSE | 21 ++ dashboard/package.json | 35 +- dashboard/public/index.html | 2 +- dashboard/src/App.css | 28 -- dashboard/src/App.tsx | 22 -- dashboard/src/actions.ts | 65 ++++ dashboard/src/api/index.ts | 66 ++++ dashboard/src/api/types.ts | 60 ++++ .../src/components/CalendarContainer.d.ts | 12 + .../src/components/ParkingRegionsMap.css | 3 + .../src/components/ParkingRegionsMap.tsx | 199 ++++++++++++ dashboard/src/components/RegionSelector.css | 5 + dashboard/src/components/RegionSelector.tsx | 47 +++ dashboard/src/components/TimeSelect.css | 26 ++ dashboard/src/components/TimeSelect.tsx | 197 +++++++++++ dashboard/src/components/types.ts | 29 ++ dashboard/src/components/utils.ts | 5 + dashboard/src/config.ts | 6 + dashboard/src/containers/App.tsx | 9 + dashboard/src/containers/Dashboard.css | 19 ++ dashboard/src/containers/Dashboard.tsx | 261 +++++++++++++++ dashboard/src/containers/ParkingRegionsMap.ts | 48 +++ dashboard/src/containers/RegionSelector.ts | 35 ++ dashboard/src/containers/TimeSelect.ts | 35 ++ dashboard/src/converters.ts | 30 ++ dashboard/src/dispatchers.ts | 86 +++++ dashboard/src/global.d.ts | 3 + dashboard/src/index.tsx | 47 ++- dashboard/src/logo.svg | 7 - dashboard/src/reducers.ts | 107 ++++++ dashboard/src/types.ts | 37 +++ dashboard/tsconfig.json | 1 + dashboard/yarn.lock | 305 +++++++++++++++++- 34 files changed, 1790 insertions(+), 68 deletions(-) create mode 100644 dashboard/.indium create mode 100644 dashboard/LICENSE delete mode 100644 dashboard/src/App.css delete mode 100644 dashboard/src/App.tsx create mode 100644 dashboard/src/actions.ts create mode 100644 dashboard/src/api/index.ts create mode 100644 dashboard/src/api/types.ts create mode 100644 dashboard/src/components/CalendarContainer.d.ts create mode 100644 dashboard/src/components/ParkingRegionsMap.css create mode 100644 dashboard/src/components/ParkingRegionsMap.tsx create mode 100644 dashboard/src/components/RegionSelector.css create mode 100644 dashboard/src/components/RegionSelector.tsx create mode 100644 dashboard/src/components/TimeSelect.css create mode 100644 dashboard/src/components/TimeSelect.tsx create mode 100644 dashboard/src/components/types.ts create mode 100644 dashboard/src/components/utils.ts create mode 100644 dashboard/src/config.ts create mode 100644 dashboard/src/containers/App.tsx create mode 100644 dashboard/src/containers/Dashboard.css create mode 100644 dashboard/src/containers/Dashboard.tsx create mode 100644 dashboard/src/containers/ParkingRegionsMap.ts create mode 100644 dashboard/src/containers/RegionSelector.ts create mode 100644 dashboard/src/containers/TimeSelect.ts create mode 100644 dashboard/src/converters.ts create mode 100644 dashboard/src/dispatchers.ts create mode 100644 dashboard/src/global.d.ts delete mode 100644 dashboard/src/logo.svg create mode 100644 dashboard/src/reducers.ts create mode 100644 dashboard/src/types.ts diff --git a/dashboard/.indium b/dashboard/.indium new file mode 100644 index 00000000..e69de29b diff --git a/dashboard/LICENSE b/dashboard/LICENSE new file mode 100644 index 00000000..5f031604 --- /dev/null +++ b/dashboard/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017-2018, City of Helsinki + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/dashboard/package.json b/dashboard/package.json index bad72a06..35874e76 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -2,10 +2,32 @@ "name": "parkkidash", "version": "0.1.0", "private": true, + "license": "MIT", "dependencies": { + "axios": "^0.17.1", + "bootstrap": "^4.0.0", + "chart.js": "^2.7.1", + "chroma-js": "^1.3.4", + "font-awesome": "^4.7.0", + "jquery": "^3.3.1", + "leaflet": "^1.3.1", + "lodash": "^4.17.4", + "moment": "^2.20.1", + "popper.js": "^1.12.9", + "prop-types": "^15.6.0", "react": "^16.2.0", + "react-chartjs-2": "^2.7.0", + "react-datetime": "^2.10.3", "react-dom": "^16.2.0", - "react-scripts-ts": "2.13.0" + "react-leaflet": "^1.8.0", + "react-redux": "^5.0.6", + "react-scripts-ts": "2.13.0", + "react-select": "^1.2.1", + "react-table": "^6.7.6", + "reactstrap": "^5.0.0-beta", + "redux": "^3.7.2", + "redux-logger": "^3.0.6", + "redux-thunk": "^2.2.0" }, "scripts": { "start": "react-scripts-ts start", @@ -14,10 +36,21 @@ "eject": "react-scripts-ts eject" }, "devDependencies": { + "@types/axios": "^0.14.0", + "@types/chart.js": "^2.7.6", + "@types/chroma-js": "^1.3.3", "@types/jest": "^22.1.1", + "@types/leaflet": "^1.2.5", + "@types/lodash": "^4.14.98", "@types/node": "^9.4.0", "@types/react": "^16.0.35", "@types/react-dom": "^16.0.3", + "@types/react-leaflet": "^1.1.4", + "@types/react-redux": "^5.0.14", + "@types/react-select": "^1.2.0", + "@types/react-table": "^6.7.2", + "@types/reactstrap": "^5.0.12", + "@types/redux-logger": "^3.0.5", "typescript": "^2.6.2" } } diff --git a/dashboard/public/index.html b/dashboard/public/index.html index ed0ebafa..251d409c 100644 --- a/dashboard/public/index.html +++ b/dashboard/public/index.html @@ -19,7 +19,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - React App + Parkkidash