import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useSyncExternalStore } from "react";
import { RotateCcw, SquarePen } from "lucide-react";
import { Button } from "../../components/ui/button";
import { SimpleIconButton } from "../../editor/ui/SimpleIconButton";
import { useEditContext } from "../../editor/client/editContext";
import { getTaskBoardNavSnapshot, subscribeTaskBoardNav, } from "../taskBoardNavStore";
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 pl-2", children: [_jsx("div", { className: "flex min-w-0 items-center gap-2", children: nav.hasSelectedProject ? (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", size: "icon", onClick: () => {
                                if (nav.selectedProjectId) {
                                    nav.onRestartProject?.(nav.selectedProjectId, nav.projectTitle);
                                }
                            }, disabled: !nav.canManageProject || !nav.onRestartProject, className: "h-8 w-8", title: "Restart project (delete all tasks and subprojects, recreate from template)", "data-testid": "taskboard-project-restart-button", children: _jsx(RotateCcw, { strokeWidth: 1, className: "text-neutral-grey-50 h-4 w-4" }) }), 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