| Name | Message | Date |
|---|---|---|
| 📄 GpsDialog.svelte | 1 month ago | |
| 📄 HistoryEntry.svelte | 1 month ago | |
| 📄 PatchBanner.svelte | 1 month ago |
📄
src/lib/components/GpsDialog.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<script lang="ts">
import { gps } from "$lib/gps.svelte";
let requesting = $state(false);
function handleGrant() {
requesting = true;
gps.grant();
}
</script>
{#if gps.consent === null}
<dialog
{@attach (node) => {
node.showModal();
return () => {
if (node.open) node.close();
};
}}
>
<div class="panel">
<div class="title-bar">Record bird locations?</div>
<p>
BirdGO can tag each detection with your GPS position. Your location
never leaves this device.
</p>
<div class="actions">
<button class="primary" onclick={handleGrant} disabled={requesting}>
{requesting ? "Requesting…" : "Enable GPS"}
</button>
<button class="secondary" onclick={() => gps.deny()}>
Skip for now
</button>
</div>
</div>
</dialog>
{/if}
<style>
dialog {
border: none;
background: transparent;
padding: 0;
max-width: 26rem;
width: calc(100% - 2rem);
}
dialog::backdrop {
background: rgba(26, 8, 8, 0.65);
}
.panel {
background: var(--bg-paper);
border: 2px solid var(--bg-near-black);
border-radius: 8px;
position: relative;
overflow: hidden;
&::before {
content: "";
position: absolute;
inset: 5px;
border-radius: 4px;
border: 1.5px dashed var(--accent-amber);
pointer-events: none;
z-index: 1;
}
}
.title-bar {
background: var(--brand-red);
color: var(--bg-cream);
padding: 0.6rem 1.25rem;
font-size: 1rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
position: relative;
&::after {
content: "";
position: absolute;
inset: 4px;
border: 1.5px dashed var(--bg-cream);
pointer-events: none;
}
}
p {
padding: 1rem 1.25rem;
font-size: 0.95rem;
line-height: 1.5;
}
.actions {
display: flex;
flex-direction: column;
gap: 0.75rem;
padding: 0 1.25rem 1.25rem;
}
.primary {
background: var(--brand-red);
color: var(--bg-cream);
border: none;
border-radius: 8px;
padding: 0.65rem 1rem;
font-size: 1rem;
font-weight: 700;
font-family: inherit;
box-shadow: 0 3px 0 var(--bg-near-black);
cursor: pointer;
transition: box-shadow 0.1s, transform 0.1s;
&:active:not(:disabled) {
transform: translateY(3px);
box-shadow: none;
}
&:disabled {
opacity: 0.6;
cursor: default;
}
}
.secondary {
background: transparent;
color: var(--bg-near-black);
border: 2px solid var(--bg-near-black);
border-radius: 8px;
padding: 0.65rem 1rem;
font-size: 1rem;
font-family: inherit;
cursor: pointer;
}
</style>