Files
homelab-optimized/dashboard/ui/components/refresh-indicator.tsx
Gitea Mirror Bot ac7facb000
Some checks failed
Documentation / Deploy to GitHub Pages (push) Has been cancelled
Documentation / Build Docusaurus (push) Has been cancelled
Sanitized mirror from private repository - 2026-04-18 12:16:52 UTC
2026-04-18 12:16:52 +00:00

20 lines
503 B
TypeScript

"use client";
import { useState, useEffect } from "react";
export function RefreshIndicator({ interval = 60 }: { interval?: number }) {
const [countdown, setCountdown] = useState(interval);
useEffect(() => {
const timer = setInterval(() => {
setCountdown(prev => prev <= 1 ? interval : prev - 1);
}, 1000);
return () => clearInterval(timer);
}, [interval]);
return (
<span className="text-[9px] text-muted-foreground tabular-nums">
{countdown}s
</span>
);
}