Skip to content

Commit

Permalink
add sync component to footer (#182)
Browse files Browse the repository at this point in the history
* add sync component to footer

* style Age.svelte

* lint
  • Loading branch information
StevenClontz authored Oct 22, 2024
1 parent 6510ca8 commit 7c3939f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/viewer/src/components/Footer.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<script lang="ts">
import Sync from './Dev/Sync.svelte'
</script>

<!-- Footer -->
<footer class="text-center bg-light text-muted">
<div class="p-4">
<div class="pt-4">
Data © {new Date().getFullYear()} Steven Clontz and James Dabbs (<a
class="text-dark"
href="https://github.com/pi-base/data/blob/main/LICENSE.md">CC-BY</a
Expand All @@ -10,4 +14,7 @@
>) |
<a class="text-dark" href="https://github.com/pi-base">GitHub</a>
</div>
<div class="p-2">
Data last synchonized: <Sync />
</div>
</footer>
14 changes: 13 additions & 1 deletion packages/viewer/src/components/Shared/Age.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
return () => clearInterval(interval)
})
let klass: string = ''
const DAY = 1000 * 60 * 60 * 24
const WEEK = DAY * 7
$: if (Date.now() > new Date(date).getTime() + WEEK) {
klass = 'text-danger'
} else if (Date.now() > new Date(date).getTime() + DAY) {
klass = 'text-warning'
} else {
klass = 'text-info'
}
</script>

{$age}
<span class={klass}>{$age}</span>

0 comments on commit 7c3939f

Please sign in to comment.