"use client" import { useEffect, useState } from "react" import { ScrollText } from "lucide-react" interface ActivityEntry { id: string type: string timestamp: string description: string source: string } export default function ActivityPage() { const [entries, setEntries] = useState([]) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) useEffect(() => { fetch("/api/activity?limit=20") .then(r => r.json()) .then(data => { if (data?.entries) { setEntries(data.entries) } setLoading(false) }) .catch(e => { console.error("Failed to load:", e) setError(e.message) setLoading(false) }) }, []) const formatDate = (ts: string) => { if (!ts) return "" return new Date(ts).toLocaleString() } const getTypeColor = (type: string) => { switch (type) { case "heartbeat": return "text-green-500" case "chat": return "text-blue-500" case "config": return "text-yellow-500" case "memory": return "text-purple-500" case "system": return "text-orange-500" case "cron": return "text-cyan-500" default: return "text-muted-foreground" } } const getSourceLabel = (source: string) => { switch (source) { case "main": return "🐅 Tiger" case "coder": return "📦 Cody" case "researcher": return "🔬 Ethan" case "pm": return "📋 Elon" default: return source || "🤖" } } if (loading) { return (

Activity

Loading activity log...
) } if (error) { return (

Activity

Failed to load activity log
{error}
) } return (

Activity

({entries.length} entries)
{entries.map((entry, i) => (
{getSourceLabel(entry.source)}
{entry.description}
{entry.type} {formatDate(entry.timestamp)}
))}
) }