'use client' import { useEffect, useRef } from 'react' import { X, MonitorPlay, Brain, Globe, Code2, Terminal, GitBranch, Rocket, CheckCircle, XCircle, Loader, FileText, Search, PenTool, HardDrive } from 'lucide-react' import { useAppStore, type ComputerUseStep } from '@/store/useAppStore' const STEP_ICONS: Record = { thinking: { icon: Brain, color: '#a78bfa', bg: 'rgba(124,58,237,0.12)' }, browsing: { icon: Globe, color: '#22d3ee', bg: 'rgba(34,211,238,0.12)' }, coding: { icon: Code2, color: '#34d399', bg: 'rgba(52,211,153,0.12)' }, terminal: { icon: Terminal, color: '#f59e0b', bg: 'rgba(245,158,11,0.12)' }, executing: { icon: Terminal, color: '#f59e0b', bg: 'rgba(245,158,11,0.12)' }, file: { icon: FileText, color: '#94a3b8', bg: 'rgba(148,163,184,0.1)' }, git: { icon: GitBranch, color: '#60a5fa', bg: 'rgba(96,165,250,0.12)' }, deploy: { icon: Rocket, color: '#f472b6', bg: 'rgba(244,114,182,0.12)' }, complete: { icon: CheckCircle, color: '#22c55e', bg: 'rgba(34,197,94,0.12)' }, error: { icon: XCircle, color: '#ef4444', bg: 'rgba(239,68,68,0.12)' }, reading: { icon: FileText, color: '#94a3b8', bg: 'rgba(148,163,184,0.1)' }, writing: { icon: PenTool, color: '#818cf8', bg: 'rgba(129,140,248,0.12)'}, searching: { icon: Search, color: '#fbbf24', bg: 'rgba(251,191,36,0.12)' }, sandbox: { icon: HardDrive, color: '#fb923c', bg: 'rgba(251,146,60,0.12)' }, } function StepCard({ step }: { step: ComputerUseStep }) { const def = STEP_ICONS[step.type] || STEP_ICONS.thinking const Icon = def.icon return (
{step.status === 'running' && step.type !== 'complete' && step.type !== 'error' && step.type !== 'done' ? ( ) : ( )}
{step.type} {new Date(step.timestamp).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' })}
{step.title}
{step.detail && (
{step.detail}
)} {step.data && step.type === 'coding' && (() => { const code = step.data['code'] as string | undefined return code ? (
              {code.slice(0, 200)}{code.length > 200 ? '...' : ''}
            
) : null })()}
) } export default function ComputerUsePanel() { const { computerUseSteps, clearComputerUseSteps, setComputerUseOpen, locale } = useAppStore() const bottomRef = useRef(null) useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: 'smooth' }) }, [computerUseSteps.length]) const runningSteps = computerUseSteps.filter(s => s.status === 'running').length return (
{/* Header */}
{locale === 'my' ? 'Computer ကြည့်ရန်' : 'Computer Use'}
{locale === 'my' ? 'Agent လုပ်ဆောင်မှုများ' : 'Live agent activity'}
{runningSteps > 0 && (
{runningSteps} {locale === 'my' ? 'လုပ်နေသည်' : 'running'}
)}
{/* Steps */}
{computerUseSteps.length === 0 ? (
{locale === 'my' ? 'လုပ်ဆောင်မှုမရှိသေးပါ' : 'No activity yet'}
{locale === 'my' ? 'Chat မှာ task တစ်ခုပေးပြီး agent ၏ computer အသုံးပြုမှုကြည့်ပါ' : 'Send a task in chat to see Manus-style agent activity here'}
) : ( <> {computerUseSteps.map(step => ( ))}
)}
{/* Footer Stats */}
{computerUseSteps.length} {locale === 'my' ? 'အဆင့်' : 'steps'} {computerUseSteps.filter(s => s.type === 'complete').length} {locale === 'my' ? 'ပြီးဆုံး' : 'completed'}
) }