'use client' import { useState, useEffect } from 'react' interface HistoryEntry { id: string task: string command: string project: string action: string createdAt: string status: string reply?: string } const projects = ['all', 'sitemente', 'holacompi', 'arabredox', 'infrastructure', 'trading'] export function TaskHistoryPanel() { const [history, setHistory] = useState([]) const [loading, setLoading] = useState(true) const [selectedProject, setSelectedProject] = useState('all') useEffect(() => { loadHistory() }, [selectedProject]) const loadHistory = async () => { setLoading(true) try { const url = selectedProject === 'all' ? '/api/command-history' : `/api/command-history?project=${selectedProject}` const response = await fetch(url) if (response.ok) { const data = await response.json() setHistory(data.history || []) } } catch (error) { console.error('Failed to load history:', error) } setLoading(false) } return (
{/* Project Filter Tabs */}
{projects.map(project => ( ))}
{/* History List */}

📜 TASK HISTORY ({history.length} entries)

{loading ? (

Loading...

) : history.length === 0 ? (

No history for this project.

) : (
{history.slice().reverse().map((entry) => (

{entry.task}

{new Date(entry.createdAt).toLocaleString()}

{entry.project} {entry.status}

You sent:

{entry.command}

{entry.reply && (

Horus replied:

{entry.reply}

)}
))}
)}
) }