From 658f9aebb7d3809e1dfece16280a60810d77d3d3 Mon Sep 17 00:00:00 2001 From: dbroqua Date: Mon, 2 Mar 2020 22:08:06 +0100 Subject: [PATCH] Added external API for getting gas stations --- .eslintrc.js | 2 +- package.json | 7 +- public/index.html | 2 +- src/App.css | 30 +++------ src/App.js | 7 +- src/Components/GasStation.js | 19 +++++- src/Components/GasTypes.js | 66 +++++-------------- src/Components/Map.js | 121 ++++++++++++++++++++++------------- src/config.js | 29 +++++++++ src/helpers.js | 52 +-------------- yarn.lock | 21 ++++++ 11 files changed, 179 insertions(+), 177 deletions(-) create mode 100644 src/config.js diff --git a/.eslintrc.js b/.eslintrc.js index 96d45e2..7a7b1c0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,7 +4,7 @@ module.exports = { plugins: ['react', 'jsx-a11y', 'import', 'flowtype'], rules: { 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], - 'no-underscore-dangle': ["error", { "allow": ["_ne", "_sw"] }], + 'no-underscore-dangle': ["error", { "allow": ["_ne", "_sw", "_id"] }], "react/jsx-props-no-spreading": [1, { "exceptions": ["ReactMapGL"] }] diff --git a/package.json b/package.json index 6b98f6b..91d43e5 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { - "name": "e85map", + "name": "prix-carburants", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", + "axios": "^0.19.2", "bootstrap": "^4.4.1", "eslint-config-prettier": "^6.10.0", "eslint-plugin-prettier": "^3.1.2", - "iconv-lite": "^0.5.1", "mapbox-gl": "^1.8.1", "moment": "^2.24.0", "prop-types": "^15.7.2", @@ -19,8 +19,7 @@ "react-map-gl": "^5.2.3", "react-moment": "^0.9.7", "react-scripts": "3.4.0", - "react-toast-notifications": "^2.4.0", - "xml-reader": "^2.4.3" + "react-toast-notifications": "^2.4.0" }, "scripts": { "start": "react-scripts start", diff --git a/public/index.html b/public/index.html index c53c344..9858a7c 100644 --- a/public/index.html +++ b/public/index.html @@ -10,7 +10,7 @@ - Carte des stations e85 - un service proposé par DarKou.fr + Carte des stations - un service proposé par DarKou.fr diff --git a/src/App.css b/src/App.css index a39e679..c4bed73 100644 --- a/src/App.css +++ b/src/App.css @@ -1,24 +1,12 @@ -.mapContainer { - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; +.locationIcon { + width: 32px; } -.sidebarStyle { - display: inline-block; - position: absolute; - top: 0; - left: 0; - margin: 12px; - background-color: #404040; - color: #ffffff; - z-index: 1 !important; - padding: 6px; - font-weight: bold; - } +div.react-toast-notifications__container { + z-index: 1031 ; +} - .locationIcon { - width: 32px; - } \ No newline at end of file +.selected-gasType.list-group-item { + font-style: italic; + font-weight: bold; +} \ No newline at end of file diff --git a/src/App.js b/src/App.js index 1ce61c1..728316d 100644 --- a/src/App.js +++ b/src/App.js @@ -43,7 +43,11 @@ class Application extends React.Component { selectedGasStation, } = this.state; if (goToWaze) { - window.open(`https://www.waze.com/livemap/directions?navigate=yes&latlng=${selectedGasStation.latitude}%2C${selectedGasStation.longitude}&zoom=17`); + const { + coordinates, + } = selectedGasStation.location; + + window.open(`https://www.waze.com/livemap/directions?navigate=yes&latlng=${coordinates[1]}%2C${coordinates[0]}&zoom=17`); } this.setState(prevState => ({ ...prevState, @@ -81,6 +85,7 @@ class Application extends React.Component { showModal={showModal} hideModal={this.hideModal} selectedGasStation={selectedGasStation} + selectedGasType={selectedGasType} />