Files
electric-cherry/src/lib/ui/components/RuntimeVersion.svelte
T

47 lines
1.2 KiB
Svelte

<script lang="ts">
import type { PlutoniumVersion } from '$lib/plutonium.js';
import { uiNow } from '$ui/stores/servers.js';
let {
name,
version,
after,
ready = true
}: {
name: string;
version?: PlutoniumVersion;
after?: string | null;
ready?: boolean;
} = $props();
const fresh = $derived(
ready &&
version?.checked_at &&
$uiNow - Date.parse(version.checked_at) < 3_600_000 &&
(!after || version.checked_at > after)
);
const revision = $derived(fresh ? version?.revision : null);
const outdated = $derived(fresh && version?.update_status === 'outdated');
</script>
<a
class:outdated
href={`/maintenance?kind=updates&server=${encodeURIComponent(name)}`}
title="View Plutonium updates and verification"
>
Plutonium {revision ? `r${revision}` : 'unverified'}{outdated ? ' · Update available' : ''}
</a>
<style>
a {
font-size: var(--text-xs);
color: var(--text-secondary);
text-decoration: none;
}
a:hover {
color: var(--accent-primary-hover);
text-decoration: underline;
}
.outdated {
color: var(--state-warning);
}
</style>