import React, { useState, useEffect } from "react"; import type { Session, Phase } from "../types"; const api = window.api; interface HeaderProps { selectedSession: Session | null; gitBranch: string | null; onOpenSettings: () => void; viewPhase: Phase; onViewPhase: (phase: Phase) => void; } const phaseLabels: Record = { research: "Research", plan: "Plan", implement: "Implement", }; const phases: Phase[] = ["research", "plan", "implement"]; export function Header({ selectedSession, gitBranch, onOpenSettings, viewPhase, onViewPhase, }: HeaderProps) { // ── Maximize ───────────────────────────────────────────────── const [isMaximized, setIsMaximized] = useState(false); useEffect(() => { return api.onWindowMaximized(setIsMaximized); }, []); // ── Branch copy ────────────────────────────────────────────── const [copied, setCopied] = useState(false); const handleCopyBranch = () => { if (!gitBranch) return; navigator.clipboard.writeText(gitBranch); setCopied(true); setTimeout(() => setCopied(false), 1500); }; return (
Claude Flow
{selectedSession && (
{phases.map((phase) => { const phaseIndex = phases.indexOf(phase); const currentIndex = phases.indexOf(selectedSession.phase); const isComplete = phaseIndex < currentIndex; const isActive = phase === selectedSession.phase; const isReachable = phaseIndex <= currentIndex; const isViewing = phase === viewPhase && !isActive; return isReachable ? ( ) : ( {phaseLabels[phase]} ); })}
)} {/* ── Branch badge ── */} {selectedSession && gitBranch && ( )} {/* ── Maximize toggle ── */} {/* ── Settings button ── */}
); }