'use client';
import { useEffect, useState } from 'react';
import { cn } from '@/lib/cn';
import { fmtAgo } from '@/lib/format';
/** Green live dot with optional pulse ring. */
export function Dot({ pulse = false, className, tone = 'positive' }: { pulse?: boolean; className?: string; tone?: 'positive' | 'warning' | 'danger' | 'muted' }) {
return ;
}
/** "3 min ago" that re-renders every 30 s. Renders the server value first (no hydration mismatch: same formatting). */
export function LiveAgo({ at, prefix = '', className }: { at: string | null | undefined; prefix?: string; className?: string }) {
const [now, setNow] = useState(null);
useEffect(() => {
setNow(Date.now());
const t = setInterval(() => setNow(Date.now()), 30_000);
return () => clearInterval(t);
}, []);
return (
);
}