"use client"; import { ChannelFeed } from "@/types"; import { Badge } from "@/components/ui/badge"; import { Radio, Clock } from "lucide-react"; interface LiveFeedItemProps { feed: ChannelFeed; } function formatTime(timestamp: string | null): string { if (!timestamp) return "No activity"; const date = new Date(timestamp); const now = new Date(); const diffMs = now.getTime() - date.getTime(); const diffMins = Math.floor(diffMs / (1000 * 60)); if (diffMins < 1) return "Active now"; if (diffMins < 60) return `${diffMins}m ago`; const diffHours = Math.floor(diffMins / 60); if (diffHours < 24) return `${diffHours}h ago`; return date.toLocaleDateString("en-US", { month: "short", day: "numeric" }); } export function LiveFeedItem({ feed }: LiveFeedItemProps) { const isActive = feed.status === "active" || feed.message_count_24h > 0; return (
#{feed.name}
{formatTime(feed.last_activity)}
{feed.message_count_24h} msgs {isActive ? "Active" : "Idle"}
); }