clove/pkviewer
web/src/lib/components/StaleNotice.svelte
back to web/src/lib/components
<!-- web/src/lib/components/StaleNotice.svelte -->
<script lang="ts">
import Icon from "./Icon.svelte";
// PluralKit was unreachable, so the page rendered from the last good snapshot (P3)
let { staleSinceMs }: { staleSinceMs: number } = $props();
function formatAge(ms: number): string {
const minutes = Math.round(ms / 60_000);
if (minutes < 60) return `${Math.max(1, minutes)} minute${minutes === 1 ? "" : "s"}`;
const hours = Math.round(minutes / 60);
if (hours < 24) return `${hours} hour${hours === 1 ? "" : "s"}`;
const days = Math.round(hours / 24);
return `${days} day${days === 1 ? "" : "s"}`;
}
</script>
<p class="notice muted" role="status">
<Icon name="clock-history" />
<span>
PluralKit could not be reached, so this page is showing information
saved {formatAge(staleSinceMs)} ago. It may be out of date.
</span>
</p>