diff --git a/pkg/interface/weather/tile/tile.js b/pkg/interface/weather/tile/tile.js index ac548c94d..6bad9b684 100644 --- a/pkg/interface/weather/tile/tile.js +++ b/pkg/interface/weather/tile/tile.js @@ -37,7 +37,7 @@ export default class WeatherTile extends Component { locationSubmit() { console.log('location submit'); if (location.protocol === "http:") { - this.setState({manualEntry: !this.state.manualEntry}) + this.setState({manualEntry: !this.state.manualEntry}); } else { navigator.geolocation.getCurrentPosition((res) => { @@ -54,19 +54,19 @@ export default class WeatherTile extends Component { } manualLocationSubmit() { - event.preventDefault() - let gpsInput = document.getElementById('gps') - let latlngNoSpace = gpsInput.value.replace(/\s+/g, '') - let latlngParse = /-?[0-9]+(?:\.[0-9]*)?,-?[0-9]+(?:\.[0-9]*)?/g + event.preventDefault(); + let gpsInput = document.getElementById('gps'); + let latlngNoSpace = gpsInput.value.replace(/\s+/g, ''); + let latlngParse = /-?[0-9]+(?:\.[0-9]*)?,-?[0-9]+(?:\.[0-9]*)?/g; if (latlngParse.test(latlngNoSpace)) { - let latlng = latlngNoSpace - this.setState({latlng}, (err) => {console.log(err)}, {maximumAge: Infinity, timeout: 10000}) - api.action('weather', 'json', latlng) - this.setState({manualEntry: !this.state.manualEntry}) + let latlng = latlngNoSpace; + this.setState({latlng}, (err) => {console.log(err)}, {maximumAge: Infinity, timeout: 10000}); + api.action('weather', 'json', latlng); + this.setState({manualEntry: !this.state.manualEntry}); } else { - this.setState({error: true}) - return false + this.setState({error: true}); + return false; } } @@ -92,14 +92,34 @@ export default class WeatherTile extends Component { renderManualEntry() { let error; if (this.state.error === true) { - error =
Incorrect latitude/longitude formatting. Please try again.
(eg. "29.558107,-95.089023")
+ Incorrect latitude/longitude formatting. Please try again.
+ (eg. "29.558107,-95.089023")
+
Please enter your latitude and longitude.
+ this.setState({manualEntry: !this.state.manualEntry})}> + <- + ++ Please enter your latitude and longitude.
{error} - +