"use client"; import { useState, useEffect } from "react"; interface ChangeLogEntry { id: string; date: string; agent: string; type: string; description: string; version?: string; } const TYPE_ICONS: Record = { skill_update: "🧠", template_change: "📝", new_feature: "✨", bug_fix: "🐛" }; const TYPE_COLORS: Record = { skill_update: "#8b5cf6", template_change: "#ec4899", new_feature: "#10b981", bug_fix: "#ef4444" }; const AGENT_NAMES: Record = { thoth: "Thoth", "thoth-trading": "Thoth Trading", ptah: "Ptah", seshat: "Seshat", anubis: "Anubis", sekhmet: "Sekhmet", horus: "Horus" }; export default function ChangeLogPanel() { const [entries, setEntries] = useState([]); const [loading, setLoading] = useState(true); const [showAdd, setShowAdd] = useState(false); const [newEntry, setNewEntry] = useState({ agent: "horus", type: "new_feature", description: "", version: "" }); useEffect(() => { fetchChangelog(); }, []); const fetchChangelog = async () => { const res = await fetch("/api/changelog?limit=50"); const data = await res.json(); setEntries(data); setLoading(false); }; const addEntry = async () => { if (!newEntry.description.trim()) return; await fetch("/api/changelog", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ action: "add", entry: newEntry }) }); setNewEntry({ agent: "horus", type: "new_feature", description: "", version: "" }); setShowAdd(false); fetchChangelog(); }; const deleteEntry = async (entryId: string) => { if (!confirm("Delete this entry?")) return; await fetch("/api/changelog", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ action: "delete", entryId }) }); fetchChangelog(); }; if (loading) { return
Loading changelog...
; } return (

📝 Change Log

{/* Add Entry Form */} {showAdd && (
setNewEntry({ ...newEntry, version: e.target.value })} placeholder="Version (optional, e.g., v2.0)" className="w-full bg-black/30 border border-white/20 rounded px-3 py-2 text-white placeholder-white/50" />