From 76dc3c44c8bd617bf8db9c4a17abce3b4a74e824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Malak?= Date: Mon, 14 Feb 2022 13:58:57 +0100 Subject: [PATCH] Added option to get user location directly from the app --- CHANGELOG.md | 1 + .../WeatherSettings/WeatherSettings.tsx | 24 ++++++++++++------- .../UI/Forms/InputGroup/InputGroup.module.css | 4 ++-- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe33b19..c28eefd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ### v2.2.2 (2022-02-TBA) +- Added option to get user location directly from the app ([#287](https://github.com/pawelmalak/flame/issues/287)) - Fixed bug with local search not working when using prefix ([#289](https://github.com/pawelmalak/flame/issues/289)) - Fixed bug with app description not updating when using custom icon ([#310](https://github.com/pawelmalak/flame/issues/310)) - Changed some of the settings tabs diff --git a/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx b/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx index 19ba7d4..a6819d8 100644 --- a/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx +++ b/client/src/components/Settings/WeatherSettings/WeatherSettings.tsx @@ -82,6 +82,19 @@ export const WeatherSettings = (): JSX.Element => { }); }; + // Get user location + const getLocation = () => { + window.navigator.geolocation.getCurrentPosition( + ({ coords: { latitude, longitude } }) => { + setFormData({ + ...formData, + lat: latitude, + long: longitude, + }); + } + ); + }; + return (
formSubmitHandler(e)}> @@ -120,15 +133,8 @@ export const WeatherSettings = (): JSX.Element => { step="any" lang="en-150" /> - - You can use - - {' '} - latlong.net - + + Click to get current location diff --git a/client/src/components/UI/Forms/InputGroup/InputGroup.module.css b/client/src/components/UI/Forms/InputGroup/InputGroup.module.css index 93b74f1..3d67554 100644 --- a/client/src/components/UI/Forms/InputGroup/InputGroup.module.css +++ b/client/src/components/UI/Forms/InputGroup/InputGroup.module.css @@ -23,7 +23,7 @@ .InputGroup span { font-size: 12px; - color: var(--color-primary) + color: var(--color-primary); } .InputGroup span a { @@ -37,4 +37,4 @@ .InputGroup textarea { resize: none; height: 50vh; -} \ No newline at end of file +}