File size: 2,327 Bytes
c2c8c8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { useEditorStore } from '@/stores/editorStore';
import { useAIStore } from '@/stores/aiStore';
import { useWebSocket } from '@/hooks/useWebSocket';
import { cn } from '@/lib/utils';
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from '@/components/ui/tooltip';

const agents = ['security', 'performance', 'style', 'documentation'] as const;

export default function StatusBar() {
  const activeFilePath = useEditorStore((s) => s.activeFilePath);
  const activeFile = useEditorStore((s) => activeFilePath ? s.openFiles[activeFilePath] : null);
  const agentRunning = useAIStore((s) => s.agentRunning);
  const { isConnected } = useWebSocket();

  return (
    <div className="h-6 bg-card/80 border-t border-border flex items-center px-3 text-[11px] text-muted-foreground gap-4">
      {/* Left */}
      <div className="flex items-center gap-3">
        {activeFile && (
          <span className="uppercase">{activeFile.language}</span>
        )}
        <span>main</span>
      </div>

      <div className="flex-1" />

      {/* Center — Agent status dots */}
      <TooltipProvider delayDuration={200}>
        <div className="flex items-center gap-1.5">
          {agents.map((agent) => {
            const running = agentRunning[agent];
            return (
              <Tooltip key={agent}>
                <TooltipTrigger>
                  <span
                    className={cn(
                      'w-2 h-2 rounded-full transition-colors',
                      running ? 'bg-yellow-400 animate-pulse' : 'bg-green-500/50'
                    )}
                  />
                </TooltipTrigger>
                <TooltipContent>{agent} agent: {running ? 'running' : 'idle'}</TooltipContent>
              </Tooltip>
            );
          })}
        </div>
      </TooltipProvider>

      <div className="flex-1" />

      {/* Right */}
      <div className="flex items-center gap-3">
        {activeFile && (
          <span>Ln {activeFile.cursorPosition.lineNumber}, Col {activeFile.cursorPosition.column}</span>
        )}
        <span>UTF-8</span>
        <span className="flex items-center gap-1">
          <span className={cn('w-1.5 h-1.5 rounded-full', isConnected ? 'bg-green-500' : 'bg-red-500')} />
          ASI-1
        </span>
      </div>
    </div>
  );
}