mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-19 03:29:37 +02:00
Added option to get user location directly from the app
This commit is contained in:
parent
2d5cce9fdb
commit
76dc3c44c8
3 changed files with 18 additions and 11 deletions
|
@ -1,4 +1,5 @@
|
||||||
### v2.2.2 (2022-02-TBA)
|
### 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 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))
|
- 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
|
- Changed some of the settings tabs
|
||||||
|
|
|
@ -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 (
|
return (
|
||||||
<form onSubmit={(e) => formSubmitHandler(e)}>
|
<form onSubmit={(e) => formSubmitHandler(e)}>
|
||||||
<SettingsHeadline text="API" />
|
<SettingsHeadline text="API" />
|
||||||
|
@ -120,15 +133,8 @@ export const WeatherSettings = (): JSX.Element => {
|
||||||
step="any"
|
step="any"
|
||||||
lang="en-150"
|
lang="en-150"
|
||||||
/>
|
/>
|
||||||
<span>
|
<span onClick={getLocation}>
|
||||||
You can use
|
<a href="#">Click to get current location</a>
|
||||||
<a
|
|
||||||
href="https://www.latlong.net/convert-address-to-lat-long.html"
|
|
||||||
target="blank"
|
|
||||||
>
|
|
||||||
{' '}
|
|
||||||
latlong.net
|
|
||||||
</a>
|
|
||||||
</span>
|
</span>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
.InputGroup span {
|
.InputGroup span {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: var(--color-primary)
|
color: var(--color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.InputGroup span a {
|
.InputGroup span a {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue