| Name | Message | Date |
|---|---|---|
| 📄 +page.svelte | 1 month ago |
📄
src/routes/history/+page.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
<script lang="ts">
import { historyStore } from "$lib/history";
import { labelsStore } from "$lib/labels";
import PatchBanner from "$lib/components/PatchBanner.svelte";
function formatDate(iso: string): string {
return new Date(iso).toLocaleDateString(undefined, {
month: "short",
day: "numeric",
year: "numeric",
});
}
function formatTime(iso: string): string {
return new Date(iso).toLocaleTimeString(undefined, {
hour: "2-digit",
minute: "2-digit",
});
}
</script>
<PatchBanner text="Field Log" />
{#if $historyStore.length === 0}
<p class="empty">No birds detected yet.</p>
{:else}
<ol>
{#each $historyStore as entry (entry.detectedAt + entry.labelIndex)}
<li>
<span class="name">{$labelsStore[entry.labelIndex]?.commonName ?? "Unknown"}</span>
<div class="meta">
<span class="confidence">{(entry.confidence * 100).toFixed(0)}%</span>
<span class="when">
<span>{formatDate(entry.detectedAt)}</span>
<span>{formatTime(entry.detectedAt)}</span>
</span>
</div>
</li>
{/each}
</ol>
{/if}
<style>
.empty {
padding: 3rem 1.5rem;
text-align: center;
color: var(--accent-rust);
font-size: 1rem;
}
ol {
list-style: none;
padding: 1rem;
padding-top: 1.25rem;
padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 1rem);
display: flex;
flex-direction: column;
gap: 0.75rem;
li {
background: var(--bg-paper);
border: 2px solid var(--bg-near-black);
border-radius: 8px;
padding: 0.75rem 1rem;
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
&::before {
content: "";
position: absolute;
inset: 5px;
border-radius: 4px;
border: 1.5px dashed var(--accent-amber);
pointer-events: none;
}
.name {
font-weight: 700;
}
.meta {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 0.2rem;
}
.confidence {
color: var(--brand-red);
font-weight: 600;
font-variant-numeric: tabular-nums;
font-size: 0.9rem;
}
.when {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 0.05rem;
font-variant-numeric: tabular-nums;
font-size: 0.8rem;
opacity: 0.6;
}
}
}
</style>