feat(monitor): show commit timestamps in updates tab

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-02 15:58:42 +00:00
parent 7667551f07
commit 9451de5a6c

View file

@ -7,12 +7,24 @@ interface AppStatus {
repo: string
host: string
currentCommit: string
currentCommitAt: string | null
latestCommit: string
latestCommitAt: string | null
updateAvailable: boolean
deployed: boolean
checkedAt: string
}
function relativeTime(iso: string | null | undefined): string | null {
if (!iso) return null
const diff = Date.now() - new Date(iso).getTime()
if (diff < 60_000) return 'just now'
if (diff < 3_600_000) return `${Math.floor(diff / 60_000)}m ago`
if (diff < 86_400_000) return `${Math.floor(diff / 3_600_000)}h ago`
if (diff < 7 * 86_400_000) return `${Math.floor(diff / 86_400_000)}d ago`
return new Date(iso).toLocaleDateString(undefined, { day: 'numeric', month: 'short' })
}
interface HealthStatus {
name: string
up: boolean
@ -172,8 +184,20 @@ export function AdminMonitor({ user }: { user: User }) {
</div>
<div style={{ fontSize: '0.72rem', color: 'var(--text-mid)', fontFamily: 'monospace' }}>
{s.deployed ? `deployed: ${s.currentCommit}` : s.currentCommit}
{s.deployed && relativeTime(s.currentCommitAt) && (
<span style={{ marginLeft: '0.35rem', fontFamily: 'sans-serif', opacity: 0.7 }}>
· {relativeTime(s.currentCommitAt)}
</span>
)}
{s.latestCommit !== 'unknown' && (
<span style={{ marginLeft: '0.75rem' }}>latest: {s.latestCommit}</span>
<span style={{ marginLeft: '0.75rem' }}>
latest: {s.latestCommit}
{relativeTime(s.latestCommitAt) && (
<span style={{ marginLeft: '0.35rem', fontFamily: 'sans-serif', opacity: 0.7 }}>
· {relativeTime(s.latestCommitAt)}
</span>
)}
</span>
)}
</div>
</div>