| 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
<script lang="ts">
import { historyStore } from "$lib/history";
import { labelsStore } from "$lib/labels";
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>
{#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>
<span class="when">
<span>{formatDate(entry.detectedAt)}</span>
<span>{formatTime(entry.detectedAt)}</span>
</span>
</li>
{/each}
</ol>
{/if}
<style>
.empty {
padding: 2rem 1rem;
opacity: 0.5;
text-align: center;
}
ol {
list-style: none;
padding: 1rem;
padding-top: 2rem;
padding-bottom: calc(
var(--nav-height) + env(safe-area-inset-bottom) + 1rem
);
display: flex;
flex-direction: column;
gap: 0.5rem;
li {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 1rem;
border-radius: 0.5rem;
background: var(--nav-bg);
.name {
font-weight: 500;
}
.when {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 0.1rem;
font-variant-numeric: tabular-nums;
opacity: 0.7;
font-size: 0.85rem;
}
}
}
</style>