Prix carburant
{' '}
- est une application ayant pour objectif d'afficher facilement sur smartphone l'ensemble des stations services à proximité.
+ est une simple application ayant pour objectif d'afficher facilement sur smartphone l'ensemble des stations services à proximité.
Ce service est entièrement gratuit et libre.
diff --git a/src/Components/GasStation.js b/src/Components/GasStation.js
index 97f93c1..7d3d387 100644
--- a/src/Components/GasStation.js
+++ b/src/Components/GasStation.js
@@ -2,10 +2,9 @@ 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";
+import { capitalizeFirstLetter} from "../helpers";
class GasStation extends React.Component {
/**
@@ -25,61 +24,32 @@ class GasStation extends React.Component {
/**
* Méthode permettant de générer la liste des prix
- * @return {string}
+ * return {string}
*/
renderPrices = () => {
const {
- gasType,
- station,
+ selectedGasType,
+ selectedGasStation,
} = this.props;
return (
- {station.prices ? station.prices.map(price => {
+ {selectedGasStation.prices ? selectedGasStation.prices.map(price => {
return (
-
- {`${this.renderGasType(price.gasType)} : ${price.price.toString().replace('.', ',')} € `}
-
+
+ {`${this.renderGasType(price.gasType)} : ${price.price} € `}
+
);
}) : (null)}
)
}
- /**
- * 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)}`;
- }
-
- renderAddress = () => {
- const {
- station,
- } = this.props;
-
- return (
-
-
- {lowerCaseString(station.address)}
- {' - '}
- {capitalizeFirstLetter(station.city)}
-
- );
- }
-
render () {
const {
showModal,
hideModal,
+ selectedGasStation,
} = this.props;
return (
@@ -92,11 +62,10 @@ class GasStation extends React.Component {
>
- {this.renderFormatTitle()}
+ {`${selectedGasStation.address} - ${capitalizeFirstLetter(selectedGasStation.city)}`}
- {this.renderAddress()}
{this.renderPrices()}
@@ -110,7 +79,7 @@ class GasStation extends React.Component {
}
GasStation.defaultProps = {
- station: {
+ selectedGasStation: {
address: null,
city: null,
prices: []
@@ -118,11 +87,10 @@ GasStation.defaultProps = {
};
GasStation.propTypes = {
- gasType: PropTypes.string.isRequired,
+ selectedGasType: PropTypes.string.isRequired,
showModal: PropTypes.bool.isRequired,
hideModal: PropTypes.func.isRequired,
- station: PropTypes.shape({
- name: PropTypes.string,
+ selectedGasStation: PropTypes.shape({
address: PropTypes.string,
city: PropTypes.string,
prices: PropTypes.array
diff --git a/src/Components/Map.js b/src/Components/Map.js
index 84c4a85..52ca3e6 100644
--- a/src/Components/Map.js
+++ b/src/Components/Map.js
@@ -22,7 +22,10 @@ class Map extends React.Component {
longitude: -0.57918,
zoom: 11,
},
- userLocation: {},
+ userLocation: {
+ // latitude: 44.837789,
+ // longitude: -0.57918,
+ },
gasStations: [],
};
@@ -84,7 +87,7 @@ class Map extends React.Component {
width: '100vw',
latitude: position.coords.latitude,
longitude: position.coords.longitude,
- zoom: 11,
+ zoom: 10,
};
this.setState({
viewport: newViewport,
diff --git a/src/helpers.js b/src/helpers.js
index 0e04e71..21d4ee2 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -11,16 +11,9 @@ export const haveSelectedGas = (station, gas) => {
return false;
}
-export const lowerCaseString = (string) => {
- if ( !string){
- return '';
- }
- return string.toLowerCase();
-}
-
export const capitalizeFirstLetter = (string) => {
if ( !string){
return '';
}
- return string.charAt(0).toUpperCase() + lowerCaseString(string.slice(1));
+ return string.charAt(0).toUpperCase() + string.slice(1);
}
\ No newline at end of file