Sanitized mirror from private repository - 2026-04-19 07:39:14 UTC
This commit is contained in:
19
dashboard/ui/components/refresh-indicator.tsx
Normal file
19
dashboard/ui/components/refresh-indicator.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
"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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user