From e516184104dc424cf9446b6a8703c8817f595989 Mon Sep 17 00:00:00 2001 From: dbroqua Date: Wed, 4 Mar 2020 18:48:55 +0100 Subject: [PATCH 1/6] Updated about --- src/Components/About.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/About.js b/src/Components/About.js index bae884d..a682bc3 100644 --- a/src/Components/About.js +++ b/src/Components/About.js @@ -22,7 +22,7 @@ const About = (props) => { Prix carburant {' '} - est une simple application ayant pour objectif d'afficher facilement sur smartphone l'ensemble des stations services à proximité. + est une application ayant pour objectif d'afficher facilement sur smartphone l'ensemble des stations services à proximité.
Ce service est entièrement gratuit et libre.
-- 2.39.2 From f336fd67ed472a08595f1e7392e5ed39155cb0e5 Mon Sep 17 00:00:00 2001 From: dbroqua Date: Fri, 6 Mar 2020 15:52:33 +0100 Subject: [PATCH 2/6] Added station name on modal --- src/App.js | 4 ++-- src/Components/GasStation.js | 35 +++++++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/App.js b/src/App.js index 5e376c3..4d286dc 100644 --- a/src/App.js +++ b/src/App.js @@ -105,8 +105,8 @@ class Application extends React.Component { { const { - selectedGasType, - selectedGasStation, + gasType, + station, } = this.props; return ( - {selectedGasStation.prices ? selectedGasStation.prices.map(price => { + {station.prices ? station.prices.map(price => { return ( - + {`${this.renderGasType(price.gasType)} : ${price.price} € `} ); @@ -45,11 +45,25 @@ class GasStation extends React.Component { ) } + /** + * Méthode permettant de formater le titre de la modale en fonction des infos reçues + * @return {string} + */ + renderFormatTitle = () => { + const { + station, + } = this.props; + + if ( station.name ) { + return station.name; + } + return `${lowerCaseString(station.address)} - ${capitalizeFirstLetter(station.city)}`; + } + render () { const { showModal, hideModal, - selectedGasStation, } = this.props; return ( @@ -62,7 +76,7 @@ class GasStation extends React.Component { > - {`${lowerCaseString(selectedGasStation.address)} - ${capitalizeFirstLetter(selectedGasStation.city)}`} + {this.renderFormatTitle()} @@ -79,7 +93,7 @@ class GasStation extends React.Component { } GasStation.defaultProps = { - selectedGasStation: { + station: { address: null, city: null, prices: [] @@ -87,10 +101,11 @@ GasStation.defaultProps = { }; GasStation.propTypes = { - selectedGasType: PropTypes.string.isRequired, + gasType: PropTypes.string.isRequired, showModal: PropTypes.bool.isRequired, hideModal: PropTypes.func.isRequired, - selectedGasStation: PropTypes.shape({ + station: PropTypes.shape({ + name: PropTypes.string, address: PropTypes.string, city: PropTypes.string, prices: PropTypes.array -- 2.39.2 From 74edd64615e6c29a7d85b517f2999c4ae89676af Mon Sep 17 00:00:00 2001 From: dbroqua Date: Sat, 7 Mar 2020 21:49:56 +0100 Subject: [PATCH 3/6] Updated default zoom value --- src/Components/Map.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Map.js b/src/Components/Map.js index a6b6dec..1606dd6 100644 --- a/src/Components/Map.js +++ b/src/Components/Map.js @@ -20,7 +20,7 @@ class Map extends React.Component { height: '100vh', latitude: 44.837789, longitude: -0.57918, - zoom: 11, + zoom: 12, }, userLocation: {}, gasStations: [], @@ -84,7 +84,7 @@ class Map extends React.Component { width: '100vw', latitude: position.coords.latitude, longitude: position.coords.longitude, - zoom: 10, + zoom: 12, }; this.setState({ viewport: newViewport, -- 2.39.2 From 5a00d8f1f355aab8a93b05c5df396c97ce467f2d Mon Sep 17 00:00:00 2001 From: dbroqua Date: Sat, 7 Mar 2020 22:16:25 +0100 Subject: [PATCH 4/6] Updated zoom (again) --- src/Components/Map.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Map.js b/src/Components/Map.js index 1606dd6..84c4a85 100644 --- a/src/Components/Map.js +++ b/src/Components/Map.js @@ -20,7 +20,7 @@ class Map extends React.Component { height: '100vh', latitude: 44.837789, longitude: -0.57918, - zoom: 12, + zoom: 11, }, userLocation: {}, gasStations: [], @@ -84,7 +84,7 @@ class Map extends React.Component { width: '100vw', latitude: position.coords.latitude, longitude: position.coords.longitude, - zoom: 12, + zoom: 11, }; this.setState({ viewport: newViewport, -- 2.39.2 From 96f8d2900084008bcb006e315b7375fa43ed13e9 Mon Sep 17 00:00:00 2001 From: dbroqua Date: Sat, 21 Mar 2020 16:44:50 +0100 Subject: [PATCH 5/6] Added staton address on modal (#4) --- src/Components/GasStation.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Components/GasStation.js b/src/Components/GasStation.js index 5b547a6..97f93c1 100644 --- a/src/Components/GasStation.js +++ b/src/Components/GasStation.js @@ -2,6 +2,7 @@ import React from 'react'; import { Modal, Button, ListGroup } from "react-bootstrap"; import PropTypes from 'prop-types'; import { FaWaze } from "react-icons/fa"; +import { GiPositionMarker } from "react-icons/gi"; import { gasTypes } from "../config"; import { capitalizeFirstLetter, lowerCaseString } from "../helpers"; @@ -37,8 +38,8 @@ class GasStation extends React.Component { {station.prices ? station.prices.map(price => { return ( - {`${this.renderGasType(price.gasType)} : ${price.price} € `} - + {`${this.renderGasType(price.gasType)} : ${price.price.toString().replace('.', ',')} € `} + ); }) : (null)} @@ -60,6 +61,21 @@ class GasStation extends React.Component { return `${lowerCaseString(station.address)} - ${capitalizeFirstLetter(station.city)}`; } + renderAddress = () => { + const { + station, + } = this.props; + + return ( +

+ + {lowerCaseString(station.address)} + {' - '} + {capitalizeFirstLetter(station.city)} +

+ ); + } + render () { const { showModal, @@ -80,6 +96,7 @@ class GasStation extends React.Component { + {this.renderAddress()} {this.renderPrices()} -- 2.39.2 From 48e5a6d27fcb2bbd2d3588b8b7fd6b80bb4970c7 Mon Sep 17 00:00:00 2001 From: Dbroqua Date: Sat, 27 Mar 2021 17:52:42 +0100 Subject: [PATCH 6/6] Updated scripts --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 4410f1f..3c3593b 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ }, "scripts": { "start": "react-scripts start", - "build": "react-scripts build && ssh porto 'rm -r www/darkou.fr/carburants/static www/darkou.fr/carburants/precache-manifest*' && scp -r build/* porto:www/darkou.fr/carburants", + "build": "react-scripts build", + "deploy": "ssh porto 'rm -r www/darkou.fr/carburants/static www/darkou.fr/carburants/precache-manifest*' && scp -r build/* porto:www/darkou.fr/carburants:", "test": "react-scripts test", "lint": "./node_modules/.bin/eslint . --fix", "eject": "react-scripts eject" -- 2.39.2