import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useSyncExternalStore } from "react";
import { Button } from "../../components/ui/button";
import { Route, Settings, SquarePen } from "lucide-react";
import { subscribeTaskBoardNav, getTaskBoardNavSnapshot, } from "../taskBoardNavStore";
import { useEditContext } from "../../editor/client/editContext";
import { SimpleIconButton } from "../../editor/ui/SimpleIconButton";
import { ProjectSelector } from "./ProjectSelector";
import { TaskboardPersistentLogPanel } from "./TaskboardPersistentLogPanel";
export function TaskBoardTitlebar() {
    const editContext = useEditContext();
    const nav = useSyncExternalStore(subscribeTaskBoardNav, getTaskBoardNavSnapshot, getTaskBoardNavSnapshot);
    const showEditorPanel = editContext?.showAgentsWorkspaceEditor ?? false;
    if (editContext?.isMobile && !nav.hasSelectedProject) {
        return null;
    }
    return (_jsxs("div", { className: "flex w-full items-center justify-between gap-4 pr-2", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(ProjectSelector, { nav: nav }), nav.hasSelectedProject ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "mx-1 h-8 w-px bg-slate-200" }), _jsx(Button, { variant: "outline", size: "icon", onClick: () => {
                                    if (nav.selectedProjectId) {
                                        nav.onOpenProjectSettings?.(nav.selectedProjectId);
                                    }
                                }, disabled: !nav.canManageProject, className: "h-8 w-8", title: "Project settings", "data-testid": "taskboard-project-settings-button", children: _jsx(Settings, { className: "h-4 w-4 text-slate-500" }) }), nav.onToggleWizardMode && (_jsx(SimpleIconButton, { icon: _jsx(Route, { className: "h-4 w-4" }), label: nav.isWizardMode ? "Exit Wizard mode" : "Wizard mode", className: "h-8 w-8 rounded border bg-background text-slate-500 hover:bg-accent hover:text-accent-foreground", "data-testid": "taskboard-wizard-switcher", selected: nav.isWizardMode, onClick: () => nav.onToggleWizardMode?.(!nav.isWizardMode) })), nav.selectedProjectId ? (_jsx(TaskboardPersistentLogPanel, { scope: "project", projectId: nav.selectedProjectId, title: "Project Activity Log", emptyMessage: "No project-level orchestration entries yet.", refreshKey: nav.selectedProjectId, testId: "taskboard-project-dashboard-log-panel" })) : null] })) : null] }), !editContext?.isMobile && (_jsx("div", { className: "flex items-center gap-2", children: _jsx(SimpleIconButton, { icon: _jsx(SquarePen, { className: "h-5 w-5", strokeWidth: 1 }), label: showEditorPanel ? "Hide Editor" : "Show Editor", size: "large", "data-testid": "taskboard-editor-panel-toggle", selected: showEditorPanel, onClick: () => editContext?.setShowAgentsWorkspaceEditor(!showEditorPanel) }) }))] }));
}
//# sourceMappingURL=TaskBoardTitlebar.js.map