This commit is contained in:
Niccolo Borgioli 2023-01-07 11:36:38 +01:00
parent 11ec116a05
commit 7dd471e50b
No known key found for this signature in database
GPG Key ID: D93C615F75EE4F0B
7 changed files with 52 additions and 22 deletions

View File

@ -7,7 +7,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.2.1' classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.google.gms:google-services:4.3.13' classpath 'com.google.gms:google-services:4.3.13'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong

View File

@ -31,9 +31,3 @@ body {
scroll-behavior: smooth; scroll-behavior: smooth;
box-sizing: border-box; box-sizing: border-box;
} }
svg {
height: 1em;
display: inline-block;
aspect-ratio: 1/1;
}

View File

@ -1,12 +1,13 @@
<script lang="ts"> <script lang="ts">
import Icon from '$lib/icons/Icon.svelte'
import { location } from '$lib/stores/location' import { location } from '$lib/stores/location'
import IconNavigate from './IconNavigate.svelte'
$: degree = ($location?.heading?.heading || 0) - 45 $: degree = ($location?.heading?.heading || 0) - 45
</script> </script>
<div class="text-xl" style="transform: rotate({degree % 360}deg);"> <div class="text-xl" style="transform: rotate({degree % 360}deg);">
<IconNavigate /> <Icon icon="Navigate" />
<!-- <IconNavigate /> -->
</div> </div>
<style> <style>

25
src/lib/icons/Icon.svelte Normal file
View File

@ -0,0 +1,25 @@
<script lang="ts">
import Copy from './copy-outline.svelte'
import Navigate from './navigate-outline.svelte'
const Icons = {
Copy,
Navigate,
}
export let icon: keyof typeof Icons
</script>
<div on:click on:keypress><svelte:component this={Icons[icon]} /></div>
<style>
div {
display: inline-block;
}
div > :global(svg) {
height: 1em;
display: inline-block;
aspect-ratio: 1/1;
}
</style>

View File

Before

Width:  |  Height:  |  Size: 524 B

After

Width:  |  Height:  |  Size: 524 B

View File

Before

Width:  |  Height:  |  Size: 288 B

After

Width:  |  Height:  |  Size: 288 B

View File

@ -1,25 +1,32 @@
<script lang="ts"> <script lang="ts">
import { Clipboard } from '@capacitor/clipboard'
import Button from '$lib/components/Button.svelte' import Button from '$lib/components/Button.svelte'
import Card from '$lib/components/Card.svelte' import Card from '$lib/components/Card.svelte'
import Compass from '$lib/components/Compass.svelte'
import H1 from '$lib/components/H1.svelte' import H1 from '$lib/components/H1.svelte'
import Measurement from '$lib/components/Measurement.svelte' import Measurement from '$lib/components/Measurement.svelte'
import Needle from '$lib/components/Needle.svelte'
import VerticalGrid from '$lib/components/VerticalGrid.svelte' import VerticalGrid from '$lib/components/VerticalGrid.svelte'
import { CoordinateLink } from '$lib/geo' import { CoordinateLink } from '$lib/geo'
import Icon from '$lib/icons/Icon.svelte'
import { app } from '$lib/stores/app' import { app } from '$lib/stores/app'
import { location } from '$lib/stores/location' import { location } from '$lib/stores/location'
import { bearings, type } from '$lib/stores/settings' import { bearings, type } from '$lib/stores/settings'
import Settings from './Settings.svelte' import Settings from './Settings.svelte'
function pad(value: number): string {
return value.toString().padStart(2, '0')
}
$: stamp = $location?.time.stamp $: stamp = $location?.time.stamp
$: date = stamp && `${pad(stamp.getHours())}:${pad(stamp.getMinutes())}:${pad(stamp.getSeconds())}` $: date =
stamp &&
[stamp.getHours(), stamp.getMinutes(), stamp.getSeconds()].map((t) => t.toFixed(0).padStart(2, '0')).join(':')
$: coords = $location?.coords.format($type, $bearings) $: coords = $location?.coords.format($type, $bearings)
$: fix = $location?.time.fix.toFixed(0) $: fix = $location?.time.fix.toFixed(0)
$: copy = () => {
if (!coords) return
const content = `${coords.lat}, ${coords.lon}`
Clipboard.write({ string: content })
}
</script> </script>
<H1 text="GPS Info" /> <H1 text="GPS Info" />
@ -27,14 +34,17 @@
<VerticalGrid> <VerticalGrid>
<Card> <Card>
<VerticalGrid> <VerticalGrid>
<div class="flex items-center"> <div class="flex items-center justify-between">
<div class="flex-grow"> <Measurement label="Heading" value={$location?.heading?.format()} />
<Measurement label="Heading" value={$location?.heading?.format()} /> <Compass />
</div>
<Needle />
</div> </div>
<Measurement label="Latitude" value={coords?.lat} /> <Measurement label="Latitude" value={coords?.lat} />
<Measurement label="Longitude" value={coords?.lon} /> <div class="flex items-end justify-between">
<Measurement label="Longitude" value={coords?.lon} />
<button on:click={copy}>
<Icon icon="Copy" />
</button>
</div>
<div> <div>
<span class="text-sm italic">Open in:</span> <span class="text-sm italic">Open in:</span>
@ -66,7 +76,7 @@
<div> <div>
<span class="text-sm italic">Fixing</span> <span class="text-sm italic">Fixing</span>
<div class="grid gap-4 grid-cols-2"> <div class="grid gap-4 grid-cols-2">
<Measurement label="Time" value={fix} unit="mnarrows" /> <Measurement label="Time" value={fix} unit="ms" />
<Measurement label="Last" value={date || undefined} /> <Measurement label="Last" value={date || undefined} />
</div> </div>
</div> </div>