Add location to statistics

This commit is contained in:
Fred Boniface
2024-06-24 00:06:30 +01:00
parent 35dd00499f
commit 13f7163dd7
2 changed files with 31 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
import Nav from "$lib/navigation/nav.svelte";
import { getApiUrl } from "$lib/scripts/upstream";
import { featureDetect } from "$lib/scripts/featureDetect";
import { getCurrentLocation } from "$lib/scripts/getLocation";
const title = "Statistics";
async function getData() {
@@ -132,6 +133,17 @@
Failed to detect browser features: {error.message}
{/await}
<h3>Detected Location</h3>
{#await getCurrentLocation()}
Fetching Location...
{:then location}
{location.latitude}, {location.longitude}
<br />
<a target="_blank" rel="noopener noreferrer" href="https://www.openstreetmap.org/?mlat={location.latitude}&mlon={location.longitude}&zoom=12">View on Map</a>
{:catch error}
{error.message}
{/await}
<Nav />
<style>