loop-task 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/App.js +119 -0
- package/dist/{tui → app}/index.js +4 -5
- package/dist/app/providers/index.js +1 -0
- package/dist/cli/import-writer.js +1 -1
- package/dist/cli.js +9 -9
- package/dist/client/cli-format.js +7 -0
- package/dist/client/commands.js +2 -164
- package/dist/client/ipc.js +3 -3
- package/dist/client/project-commands.js +159 -0
- package/dist/core/{command-runner.js → command/command-runner.js} +3 -3
- package/dist/core/{foreground-loop.js → foreground/index.js} +4 -4
- package/dist/core/{log-rotator.js → logging/log-rotator.js} +1 -1
- package/dist/core/loop/chain-executor.js +67 -0
- package/dist/core/loop/delay-utils.js +65 -0
- package/dist/core/loop/loop-controller.js +191 -0
- package/dist/core/loop/loop-runner.js +133 -0
- package/dist/core/loop/run-executor.js +90 -0
- package/dist/core/loop/types.js +1 -0
- package/dist/daemon/daemon-log.js +1 -1
- package/dist/daemon/http/helpers.js +81 -0
- package/dist/daemon/http/openapi.js +92 -0
- package/dist/daemon/http/route-loops.js +218 -0
- package/dist/daemon/http/route-misc.js +36 -0
- package/dist/daemon/http/route-projects.js +55 -0
- package/dist/daemon/http/route-tasks.js +53 -0
- package/dist/daemon/http/routes.js +17 -0
- package/dist/daemon/http/server.js +64 -0
- package/dist/daemon/http/sse.js +36 -0
- package/dist/daemon/index.js +7 -9
- package/dist/{ipc/handlers → daemon/ipc}/logs-stream.js +1 -1
- package/dist/daemon/managers/loop-entry.js +24 -0
- package/dist/daemon/{manager.js → managers/loop-manager.js} +32 -152
- package/dist/daemon/managers/loop-options.js +16 -0
- package/dist/daemon/managers/loop-serialization.js +43 -0
- package/dist/daemon/{projects.js → managers/project-manager.js} +6 -4
- package/dist/daemon/{task-manager.js → managers/task-manager.js} +5 -3
- package/dist/daemon/server/handlers/index.js +86 -0
- package/dist/daemon/server/handlers/log-handlers.js +130 -0
- package/dist/daemon/server/handlers/loop-handlers.js +54 -0
- package/dist/daemon/server/handlers/project-handlers.js +37 -0
- package/dist/daemon/server/handlers/task-handlers.js +20 -0
- package/dist/daemon/server/index.js +113 -0
- package/dist/daemon/{spawner.js → spawner/index.js} +4 -4
- package/dist/daemon/{state.js → state/index.js} +4 -4
- package/dist/daemon/{file-watcher.js → watcher/index.js} +8 -6
- package/dist/duration.js +1 -1
- package/dist/{tui/state.js → entities/loops/filters.js} +0 -76
- package/dist/entities/loops/index.js +1 -0
- package/dist/entities/projects/filters.js +69 -0
- package/dist/entities/projects/index.js +1 -0
- package/dist/entities/tasks/filters.js +41 -0
- package/dist/entities/tasks/index.js +1 -0
- package/dist/{tui/components → features/chain-editor}/ChainEditor.js +7 -5
- package/dist/features/code-editor/CodeEditorModal.js +84 -0
- package/dist/{tui/components → features/code-editor}/CodeEditorPreview.js +3 -3
- package/dist/features/code-editor/useEditorKeyboard.js +147 -0
- package/dist/features/code-editor/useModalDimensions.js +9 -0
- package/dist/{tui → features/commands}/commands.js +2 -2
- package/dist/features/commands/useCommandHandlers.js +147 -0
- package/dist/features/commands/useContextualActions.js +75 -0
- package/dist/features/commands/useGlobalShortcuts.js +152 -0
- package/dist/features/forms/FormRouter.js +44 -0
- package/dist/{tui/components → features/overlays}/ContextHelpModal.js +3 -3
- package/dist/{tui/components → features/overlays}/ExportModal.js +3 -3
- package/dist/{tui/components → features/overlays}/HelpGuideModal.js +3 -3
- package/dist/{tui/components → features/overlays}/HelpModal.js +3 -3
- package/dist/features/overlays/OverlayStack.js +9 -0
- package/dist/{tui/components → features/overlays}/ProjectsModal.js +2 -2
- package/dist/{tui/components → features/overlays}/TaskPickerModal.js +2 -2
- package/dist/{tui/components → features/overlays}/WelcomeScreen.js +5 -3
- package/dist/features/overlays/useOverlayStack.js +51 -0
- package/dist/features/state/useAppState.js +150 -0
- package/dist/logger.js +0 -1
- package/dist/loop-config.js +9 -4
- package/dist/{config → shared/config}/constants.js +1 -1
- package/dist/shared/container/index.js +22 -0
- package/dist/{tui → shared}/hooks/useBreakpoint.js +1 -1
- package/dist/shared/hooks/useInject.js +6 -0
- package/dist/{tui → shared}/hooks/useLogStream.js +7 -5
- package/dist/{hooks → shared/hooks}/useLoopFormValidation.js +2 -2
- package/dist/{tui → shared}/hooks/useLoopPolling.js +6 -4
- package/dist/shared/{useUndoRedo.js → hooks/useUndoRedo.js} +2 -4
- package/dist/shared/providers/InversifyProvider.js +6 -0
- package/dist/shared/services/export-service.js +43 -0
- package/dist/shared/services/log-service.js +28 -0
- package/dist/shared/services/loop-service.js +78 -0
- package/dist/shared/services/project-service.js +39 -0
- package/dist/shared/services/task-service.js +41 -0
- package/dist/shared/services/types.js +7 -0
- package/dist/{tui/components → shared/ui}/Button.js +1 -1
- package/dist/{tui/components → shared/ui}/DebugPanel.js +1 -1
- package/dist/{tui/components → shared/ui}/FocusableButton.js +1 -1
- package/dist/{tui/components → shared/ui}/FocusableInput.js +1 -1
- package/dist/{tui/components → shared/ui}/FocusableList.js +1 -1
- package/dist/{tui/components → shared/ui}/Modal.js +1 -1
- package/dist/{tui/components → shared/ui}/SelectModal.js +2 -2
- package/dist/{tui/components → shared/ui}/Toast.js +1 -1
- package/dist/shared/ui/state.js +9 -0
- package/dist/{tui → shared}/utils/paste.js +2 -2
- package/dist/{tui → shared}/utils/validation.js +1 -1
- package/dist/widgets/command-input/CommandDropdown.js +69 -0
- package/dist/widgets/command-input/CommandInput.js +129 -0
- package/dist/widgets/command-input/HintBar.js +9 -0
- package/dist/widgets/command-input/InputModes.js +68 -0
- package/dist/{tui/components → widgets/commands-browser}/CommandsBrowserModal.js +3 -3
- package/dist/{tui/components → widgets/header}/Header.js +3 -3
- package/dist/{tui/components → widgets/header}/TabBar.js +1 -1
- package/dist/{tui/components → widgets/left-panel}/LeftPanel.js +3 -3
- package/dist/{tui/components → widgets/left-panel}/Navigator.js +3 -3
- package/dist/{tui/components → widgets/left-panel}/ProjectsPage.js +9 -34
- package/dist/widgets/left-panel/ProjectsPageParts.js +34 -0
- package/dist/{tui/components → widgets/left-panel}/TaskBrowser.js +4 -4
- package/dist/{tui/components → widgets/log-modal}/LogModal.js +8 -6
- package/dist/widgets/loop-form/CreateForm.js +75 -0
- package/dist/widgets/loop-form/TextField.js +9 -0
- package/dist/{tui/components → widgets/loop-form}/WizardForm.js +5 -10
- package/dist/widgets/loop-form/useCreateSteps.js +107 -0
- package/dist/widgets/loop-form/useHandleComplete.js +74 -0
- package/dist/{tui/components → widgets/project-form}/ProjectForm.js +9 -7
- package/dist/{tui/components → widgets/right-panel}/Inspector.js +4 -4
- package/dist/{tui/components → widgets/right-panel}/RightPanel.js +4 -4
- package/dist/{tui/components → widgets/right-panel}/RunHistory.js +52 -4
- package/dist/{tui/components → widgets/task-form}/TaskForm.js +11 -9
- package/package.json +2 -1
- package/dist/core/loop-controller.js +0 -511
- package/dist/daemon/http-server.js +0 -599
- package/dist/daemon/server.js +0 -374
- package/dist/tui/App.js +0 -680
- package/dist/tui/components/CodeEditorModal.js +0 -244
- package/dist/tui/components/CommandInput.js +0 -273
- package/dist/tui/components/CreateForm.js +0 -224
- package/dist/tui/daemon.js +0 -142
- package/dist/tui/format.js +0 -111
- /package/dist/{tui/router.js → app/router/index.js} +0 -0
- /package/dist/{tui → app}/types.js +0 -0
- /package/dist/core/{resolve-cwd.js → command/resolve-cwd.js} +0 -0
- /package/dist/core/{context-parser.js → context/context-parser.js} +0 -0
- /package/dist/core/{template.js → context/template.js} +0 -0
- /package/dist/core/{log-parser.js → logging/log-parser.js} +0 -0
- /package/dist/core/{scheduling.js → scheduling/index.js} +0 -0
- /package/dist/{ipc → daemon/ipc}/send.js +0 -0
- /package/dist/{config → shared/config}/paths.js +0 -0
- /package/dist/{i18n → shared/i18n}/en.json +0 -0
- /package/dist/{i18n → shared/i18n}/index.js +0 -0
- /package/dist/{board → shared/ui}/format.js +0 -0
- /package/dist/{tui → shared/ui}/hooks/useHoverState.js +0 -0
- /package/dist/{tui → shared/ui}/theme.js +0 -0
- /package/dist/{tui → shared}/utils/syntax.js +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CODE_EDITOR_MODAL_HEIGHT, CODE_EDITOR_MODAL_WIDTH, } from "../../shared/config/constants.js";
|
|
2
|
+
export function useModalDimensions() {
|
|
3
|
+
const termRows = process.stdout.rows || 24;
|
|
4
|
+
const termCols = process.stdout.columns || 80;
|
|
5
|
+
const modalHeight = Math.min(CODE_EDITOR_MODAL_HEIGHT, termRows - 2);
|
|
6
|
+
const modalWidth = Math.min(CODE_EDITOR_MODAL_WIDTH, termCols - 2);
|
|
7
|
+
const editorVisibleLines = Math.max(3, modalHeight - 6);
|
|
8
|
+
return { modalWidth, modalHeight, editorVisibleLines };
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { COMMAND_TIER_ACTION, COMMAND_TIER_CONFIRM, COMMAND_TIER_GLOBAL, COMMAND_CATEGORY_GLOBAL, COMMAND_CATEGORY_FILTERS, COMMAND_CATEGORY_LOOP, COMMAND_CATEGORY_TASK, COMMAND_CATEGORY_PROJECT, } from '
|
|
2
|
-
import { t } from '
|
|
1
|
+
import { COMMAND_TIER_ACTION, COMMAND_TIER_CONFIRM, COMMAND_TIER_GLOBAL, COMMAND_CATEGORY_GLOBAL, COMMAND_CATEGORY_FILTERS, COMMAND_CATEGORY_LOOP, COMMAND_CATEGORY_TASK, COMMAND_CATEGORY_PROJECT, } from '../../shared/config/constants.js';
|
|
2
|
+
import { t } from '../../shared/i18n/index.js';
|
|
3
3
|
function globalCommands() {
|
|
4
4
|
return [
|
|
5
5
|
{ label: t('cmd.help'), value: 'help', hint: '', tier: COMMAND_TIER_GLOBAL, category: COMMAND_CATEGORY_GLOBAL, shortcut: 'ctrl+p' },
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { t } from "../../shared/i18n/index.js";
|
|
2
|
+
import { cycleSortMode, cycleStatusFilter } from "../../entities/loops/filters.js";
|
|
3
|
+
import { cycleProjectSortMode, cycleProjectHasLoopsFilter, cycleProjectIsSystemFilter } from "../../entities/projects/filters.js";
|
|
4
|
+
export function useCommandHandlers(context) {
|
|
5
|
+
const { activeTab, selected, selectedTask, selectedProjectEntity, tasks, projects, currentProjectId, setCloneMode, setEditTarget, setPendingTaskSelection, setEditTask, setEditProject, setActiveTab, setConfirmState, setCommandsBrowserOpen, setSearchValue, setSearchState, setFilters, setSort, setCurrentProjectId, setProjectFilters, setProjectSelectedIndex, setDebugMode, setExportModal, push, pop, refresh, refreshTasks, refreshProjects, pushToast, loopService, taskService, projectService, exportService, runAction, handleOpenRunLog, } = context;
|
|
6
|
+
const commandHandlers = {
|
|
7
|
+
edit: () => {
|
|
8
|
+
if (activeTab === "loops" && selected) {
|
|
9
|
+
setCloneMode(false);
|
|
10
|
+
setEditTarget(selected);
|
|
11
|
+
if (selected.taskId) {
|
|
12
|
+
const task = tasks.find((t) => t.id === selected.taskId);
|
|
13
|
+
setPendingTaskSelection(task ? { id: task.id, name: task.name } : null);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
setPendingTaskSelection(null);
|
|
17
|
+
}
|
|
18
|
+
push("create");
|
|
19
|
+
}
|
|
20
|
+
else if (activeTab === "tasks" && selectedTask) {
|
|
21
|
+
setEditTask(selectedTask);
|
|
22
|
+
push("task-edit");
|
|
23
|
+
}
|
|
24
|
+
else if (activeTab === "projects" && selectedProjectEntity && !selectedProjectEntity.isSystem) {
|
|
25
|
+
setEditProject(selectedProjectEntity);
|
|
26
|
+
push("project-edit");
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
clone: () => {
|
|
30
|
+
if (activeTab === "loops" && selected) {
|
|
31
|
+
setCloneMode(true);
|
|
32
|
+
setEditTarget(selected);
|
|
33
|
+
push("create");
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
delete: () => {
|
|
37
|
+
if (activeTab === "loops" && selected) {
|
|
38
|
+
setConfirmState({
|
|
39
|
+
prompt: t("confirm.deleteLoop", { name: selected.description || selected.id }),
|
|
40
|
+
onConfirm: () => { void loopService.delete(selected.id).then(() => { void refresh(); }); },
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
else if (activeTab === "tasks" && selectedTask) {
|
|
44
|
+
setConfirmState({
|
|
45
|
+
prompt: t("confirm.deleteTask", { id: selectedTask.id }),
|
|
46
|
+
onConfirm: () => { void taskService.delete(selectedTask.id).then(() => { void refreshTasks(); }); },
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else if (activeTab === "projects" && selectedProjectEntity && !selectedProjectEntity.isSystem) {
|
|
50
|
+
setConfirmState({
|
|
51
|
+
prompt: t("confirm.deleteProject", { name: selectedProjectEntity.name }),
|
|
52
|
+
onConfirm: async () => {
|
|
53
|
+
try {
|
|
54
|
+
await projectService.delete(selectedProjectEntity.id);
|
|
55
|
+
pushToast("success", t("project.toastDeleted", { name: selectedProjectEntity.name }));
|
|
56
|
+
setProjectSelectedIndex(0);
|
|
57
|
+
void refreshProjects();
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
pushToast("error", e.message);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
pause: () => {
|
|
67
|
+
if (activeTab === "loops" && selected) {
|
|
68
|
+
void runAction(t("board.toastPaused", { desc: selected.description }), () => loopService.pause(selected.id))();
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
play: () => {
|
|
72
|
+
if (activeTab === "loops" && selected) {
|
|
73
|
+
const isPaused = selected.status === "paused";
|
|
74
|
+
const toastKey = isPaused ? "board.toastResumed" : "board.toastPlayed";
|
|
75
|
+
const fn = isPaused ? () => loopService.resume(selected.id) : () => loopService.play(selected.id);
|
|
76
|
+
void runAction(t(toastKey, { desc: selected.description }), fn)();
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
stop: () => {
|
|
80
|
+
if (activeTab === "loops" && selected) {
|
|
81
|
+
setConfirmState({
|
|
82
|
+
prompt: t("confirm.stopLoop", { name: selected.description || selected.id }),
|
|
83
|
+
onConfirm: () => { void loopService.stop(selected.id).then(() => { void refresh(); }); },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
trigger: () => {
|
|
88
|
+
if (activeTab === "loops" && selected) {
|
|
89
|
+
void runAction(t("board.toastTriggered", { desc: selected.description }), () => loopService.trigger(selected.id))();
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"new-loop": () => { setEditTarget(null); push("create"); },
|
|
93
|
+
"new-task": () => { setEditTask(null); push("task-create"); },
|
|
94
|
+
"new-project": () => { setEditProject(null); setActiveTab("projects"); push("project-create"); },
|
|
95
|
+
"project-filter-loops": () => { setProjectFilters((prev) => ({ ...prev, hasLoops: cycleProjectHasLoopsFilter(prev.hasLoops) })); },
|
|
96
|
+
"project-filter-type": () => { setProjectFilters((prev) => ({ ...prev, isSystem: cycleProjectIsSystemFilter(prev.isSystem) })); },
|
|
97
|
+
"project-sort": () => { setProjectFilters((prev) => ({ ...prev, sort: cycleProjectSortMode(prev.sort) })); },
|
|
98
|
+
"all-commands": () => { setCommandsBrowserOpen(true); },
|
|
99
|
+
help: () => { setCommandsBrowserOpen(true); },
|
|
100
|
+
search: () => { setSearchValue(""); setSearchState({ active: true }); },
|
|
101
|
+
"filter-status": () => { setFilters((prev) => ({ ...prev, status: cycleStatusFilter(prev.status) })); },
|
|
102
|
+
sort: () => { setSort((prev) => cycleSortMode(prev)); },
|
|
103
|
+
"filter-project": () => {
|
|
104
|
+
const ids = ["all", ...projects.map((p) => p.id)];
|
|
105
|
+
const idx = ids.indexOf(currentProjectId);
|
|
106
|
+
const nextId = ids[(idx + 1) % ids.length] ?? "all";
|
|
107
|
+
setCurrentProjectId(nextId);
|
|
108
|
+
},
|
|
109
|
+
debug: () => { setDebugMode((prev) => !prev); },
|
|
110
|
+
logs: () => {
|
|
111
|
+
if (activeTab === "loops" && selected) {
|
|
112
|
+
const runs = selected.runHistory;
|
|
113
|
+
if (runs && runs.length > 0) {
|
|
114
|
+
handleOpenRunLog(runs[runs.length - 1]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
select: () => {
|
|
119
|
+
if (selectedTask) {
|
|
120
|
+
setPendingTaskSelection({ id: selectedTask.id, name: selectedTask.name });
|
|
121
|
+
pop();
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
api: () => {
|
|
125
|
+
const port = process.env.LOOP_CLI_HTTP_PORT ?? "8845";
|
|
126
|
+
const baseUrl = `http://127.0.0.1:${port}`;
|
|
127
|
+
pushToast("info", `API: ${baseUrl} | Swagger: ${baseUrl}/api/docs | OpenAPI: ${baseUrl}/api/openapi.json`);
|
|
128
|
+
},
|
|
129
|
+
status: () => { pushToast("info", `Command "status" coming soon`); },
|
|
130
|
+
export: () => {
|
|
131
|
+
exportService.exportConfig()
|
|
132
|
+
.then(({ json, filePath }) => setExportModal({ json, filePath, error: null }))
|
|
133
|
+
.catch((e) => setExportModal({ json: "", filePath: null, error: e instanceof Error ? e.message : String(e) }));
|
|
134
|
+
},
|
|
135
|
+
import: () => { pushToast("info", `Command "import" coming soon`); },
|
|
136
|
+
};
|
|
137
|
+
function handleCommand(value) {
|
|
138
|
+
const handler = commandHandlers[value];
|
|
139
|
+
if (handler) {
|
|
140
|
+
handler();
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
pushToast("error", `Unknown command: ${value}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return { handlers: commandHandlers, handleCommand };
|
|
147
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { copyToClipboard } from "../../shared/clipboard.js";
|
|
3
|
+
import { commandLine } from "../../shared/ui/format.js";
|
|
4
|
+
import { t } from "../../shared/i18n/index.js";
|
|
5
|
+
export function useContextualActions(context) {
|
|
6
|
+
const { activeTab, focusedPanel, selected, selectedTask, selectedProjectEntity, tasks, push, setCloneMode, setEditTarget, setPendingTaskSelection, handleCommand, handleOpenRunLog, pushToast, isBoardView, view, logModalRun, commandsBrowserOpen, confirmState, searchState, setChordState, chordState, } = context;
|
|
7
|
+
const handleContextualCopy = useCallback(() => {
|
|
8
|
+
const copyHandlers = {
|
|
9
|
+
loops: () => {
|
|
10
|
+
if (!selected)
|
|
11
|
+
return;
|
|
12
|
+
const text = selected.commandRaw
|
|
13
|
+
? selected.commandRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ")
|
|
14
|
+
: commandLine(selected.command, selected.commandArgs);
|
|
15
|
+
copyToClipboard(text);
|
|
16
|
+
pushToast("info", t("board.toastTextCopied"));
|
|
17
|
+
},
|
|
18
|
+
tasks: () => {
|
|
19
|
+
if (!selectedTask)
|
|
20
|
+
return;
|
|
21
|
+
const text = selectedTask.commandRaw
|
|
22
|
+
? selectedTask.commandRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ")
|
|
23
|
+
: commandLine(selectedTask.command, selectedTask.commandArgs);
|
|
24
|
+
copyToClipboard(text);
|
|
25
|
+
pushToast("info", t("board.toastTextCopied"));
|
|
26
|
+
},
|
|
27
|
+
projects: () => {
|
|
28
|
+
if (!selectedProjectEntity)
|
|
29
|
+
return;
|
|
30
|
+
copyToClipboard(selectedProjectEntity.name);
|
|
31
|
+
pushToast("info", t("board.toastTextCopied"));
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const handler = copyHandlers[activeTab];
|
|
35
|
+
if (handler)
|
|
36
|
+
handler();
|
|
37
|
+
}, [activeTab, selected, selectedTask, selectedProjectEntity, pushToast]);
|
|
38
|
+
const triggerContextualAction = useCallback(() => {
|
|
39
|
+
if (!isBoardView(view) || logModalRun || commandsBrowserOpen || confirmState || searchState?.active)
|
|
40
|
+
return;
|
|
41
|
+
if (chordState)
|
|
42
|
+
setChordState(null);
|
|
43
|
+
const editSelectedLoop = () => {
|
|
44
|
+
if (!selected)
|
|
45
|
+
return;
|
|
46
|
+
setCloneMode(false);
|
|
47
|
+
setEditTarget(selected);
|
|
48
|
+
const task = selected.taskId ? tasks.find((t) => t.id === selected.taskId) : null;
|
|
49
|
+
setPendingTaskSelection(task ? { id: task.id, name: task.name } : null);
|
|
50
|
+
push("create");
|
|
51
|
+
};
|
|
52
|
+
const handlers = {
|
|
53
|
+
"tasks:": () => { if (selectedTask)
|
|
54
|
+
handleCommand("edit"); },
|
|
55
|
+
"projects:": () => { if (selectedProjectEntity)
|
|
56
|
+
handleCommand("edit"); },
|
|
57
|
+
"loops:right": () => {
|
|
58
|
+
if (!selected)
|
|
59
|
+
return;
|
|
60
|
+
const runs = selected.runHistory;
|
|
61
|
+
if (runs && runs.length > 0)
|
|
62
|
+
handleOpenRunLog(runs[runs.length - 1]);
|
|
63
|
+
else
|
|
64
|
+
editSelectedLoop();
|
|
65
|
+
},
|
|
66
|
+
"loops:left": editSelectedLoop,
|
|
67
|
+
};
|
|
68
|
+
const handlerKey = activeTab !== "loops" ? `${activeTab}:` : `loops:${focusedPanel}`;
|
|
69
|
+
handlers[handlerKey]?.();
|
|
70
|
+
}, [activeTab, focusedPanel, view, logModalRun, commandsBrowserOpen, confirmState, searchState,
|
|
71
|
+
chordState, setChordState, selected, selectedTask, selectedProjectEntity, tasks, push,
|
|
72
|
+
setCloneMode, setEditTarget, setPendingTaskSelection, handleCommand, handleOpenRunLog,
|
|
73
|
+
isBoardView]);
|
|
74
|
+
return { handleContextualCopy, triggerContextualAction };
|
|
75
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { useInput } from "ink";
|
|
2
|
+
import { MAX_ENTRIES } from "../../shared/ui/DebugPanel.js";
|
|
3
|
+
const FORM_VIEWS = ["create", "task-create", "task-edit", "project-create", "project-edit"];
|
|
4
|
+
function isBoardView(view) {
|
|
5
|
+
return view === "board";
|
|
6
|
+
}
|
|
7
|
+
export function useGlobalShortcuts(context) {
|
|
8
|
+
const { activeTab, focusedPanel, setFocusedPanel, setActiveTab, view, handleCommand, triggerContextualAction, popLayer, anyModalOpen, debugMode, setDebugEntries, inputOwner, confirmState, searchState, logModalRun, commandsBrowserOpen, exportModal, contextHelpOpen, setContextHelpOpen, onQuit, exit, setConfirmState, setLogModalRun, setLogModalLoopId, setCommandsBrowserOpen, chordState, setChordState, } = context;
|
|
9
|
+
useInput((input, key) => {
|
|
10
|
+
if (key.ctrl && input === "c") {
|
|
11
|
+
if (!logModalRun && !confirmState && !commandsBrowserOpen && !exportModal) {
|
|
12
|
+
setConfirmState({
|
|
13
|
+
prompt: "",
|
|
14
|
+
onConfirm: () => { onQuit(); exit(); },
|
|
15
|
+
});
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (debugMode) {
|
|
20
|
+
const entry = {
|
|
21
|
+
id: Date.now(),
|
|
22
|
+
input,
|
|
23
|
+
len: input.length,
|
|
24
|
+
ctrl: key.ctrl,
|
|
25
|
+
return: key.return,
|
|
26
|
+
shift: key.shift,
|
|
27
|
+
meta: key.meta,
|
|
28
|
+
tab: key.tab,
|
|
29
|
+
upArrow: key.upArrow,
|
|
30
|
+
downArrow: key.downArrow,
|
|
31
|
+
leftArrow: key.leftArrow,
|
|
32
|
+
rightArrow: key.rightArrow,
|
|
33
|
+
escape: key.escape,
|
|
34
|
+
codes: Array.from(input).map((c) => c.charCodeAt(0)).join(","),
|
|
35
|
+
};
|
|
36
|
+
setDebugEntries((prev) => [entry, ...prev].slice(0, MAX_ENTRIES));
|
|
37
|
+
}
|
|
38
|
+
const isMultiCharEnter = input.length > 1 && (input.includes("\r") || input.includes("\n"));
|
|
39
|
+
const isCtrlEnter = (key.ctrl && key.return) || input === "\x0e" || isMultiCharEnter;
|
|
40
|
+
if (isCtrlEnter && isBoardView(view) && !logModalRun && !commandsBrowserOpen && !confirmState && !searchState?.active) {
|
|
41
|
+
triggerContextualAction();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const canShortcut = key.ctrl && isBoardView(view) && !logModalRun && !commandsBrowserOpen && !confirmState && !searchState?.active && !exportModal;
|
|
45
|
+
if (canShortcut) {
|
|
46
|
+
const globalShortcuts = {
|
|
47
|
+
p: () => { setCommandsBrowserOpen(true); },
|
|
48
|
+
b: () => handleCommand("debug"),
|
|
49
|
+
g: () => handleCommand("api"),
|
|
50
|
+
x: () => handleCommand("export"),
|
|
51
|
+
i: () => handleCommand("import"),
|
|
52
|
+
y: () => handleCommand("status"),
|
|
53
|
+
};
|
|
54
|
+
const filterShortcuts = {
|
|
55
|
+
s: () => handleCommand("search"),
|
|
56
|
+
t: () => handleCommand("filter-status"),
|
|
57
|
+
o: () => handleCommand("sort"),
|
|
58
|
+
p: () => handleCommand("filter-project"),
|
|
59
|
+
};
|
|
60
|
+
const actionShortcuts = {
|
|
61
|
+
n: () => handleCommand(activeTab === "loops" ? "new-loop" : activeTab === "tasks" ? "new-task" : "new-project"),
|
|
62
|
+
e: () => handleCommand("edit"),
|
|
63
|
+
d: () => handleCommand("delete"),
|
|
64
|
+
...(activeTab === "loops" ? {
|
|
65
|
+
p: () => handleCommand("pause"),
|
|
66
|
+
r: () => handleCommand("play"),
|
|
67
|
+
s: () => handleCommand("stop"),
|
|
68
|
+
t: () => handleCommand("trigger"),
|
|
69
|
+
c: () => handleCommand("clone"),
|
|
70
|
+
o: () => handleCommand("logs"),
|
|
71
|
+
} : {}),
|
|
72
|
+
};
|
|
73
|
+
if (chordState === "ctrl+f" && filterShortcuts[input]) {
|
|
74
|
+
filterShortcuts[input]();
|
|
75
|
+
setChordState(null);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (chordState === "ctrl+a" && actionShortcuts[input]) {
|
|
79
|
+
actionShortcuts[input]();
|
|
80
|
+
setChordState(null);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (chordState) {
|
|
84
|
+
setChordState(null);
|
|
85
|
+
}
|
|
86
|
+
if (input === "f") {
|
|
87
|
+
setChordState("ctrl+f");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (input === "a") {
|
|
91
|
+
setChordState("ctrl+a");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const globalHandler = globalShortcuts[input];
|
|
95
|
+
if (globalHandler) {
|
|
96
|
+
globalHandler();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (confirmState && !key.escape)
|
|
101
|
+
return;
|
|
102
|
+
if (searchState?.active && !key.escape)
|
|
103
|
+
return;
|
|
104
|
+
if (key.escape) {
|
|
105
|
+
popLayer();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (logModalRun) {
|
|
109
|
+
if (input === "q") {
|
|
110
|
+
setLogModalRun(null);
|
|
111
|
+
setLogModalLoopId(null);
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (commandsBrowserOpen)
|
|
116
|
+
return;
|
|
117
|
+
if (contextHelpOpen) {
|
|
118
|
+
setContextHelpOpen(false);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (logModalRun)
|
|
122
|
+
return;
|
|
123
|
+
if (FORM_VIEWS.includes(view))
|
|
124
|
+
return;
|
|
125
|
+
if (isBoardView(view)) {
|
|
126
|
+
if (key.ctrl && key.rightArrow) {
|
|
127
|
+
setActiveTab((prev) => prev === "loops" ? "tasks" : prev === "tasks" ? "projects" : "loops");
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (key.ctrl && key.leftArrow) {
|
|
131
|
+
setActiveTab((prev) => prev === "loops" ? "projects" : prev === "tasks" ? "loops" : "tasks");
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (key.tab) {
|
|
135
|
+
setFocusedPanel((prev) => prev === "left" ? "right" : "left");
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (input === "1") {
|
|
139
|
+
setActiveTab("loops");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (input === "2") {
|
|
143
|
+
setActiveTab("tasks");
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (input === "3") {
|
|
147
|
+
setActiveTab("projects");
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CreateView } from "../../widgets/loop-form/CreateForm.js";
|
|
3
|
+
import { TaskForm } from "../../widgets/task-form/TaskForm.js";
|
|
4
|
+
import { ProjectFormView } from "../../widgets/project-form/ProjectForm.js";
|
|
5
|
+
const TASK_FORM_VIEWS = new Set(["task-create", "task-edit"]);
|
|
6
|
+
function createInitialValues(editTarget, currentProjectId) {
|
|
7
|
+
if (!editTarget) {
|
|
8
|
+
return {
|
|
9
|
+
interval: "30m",
|
|
10
|
+
taskMode: "inline",
|
|
11
|
+
command: "",
|
|
12
|
+
cwd: process.cwd(),
|
|
13
|
+
taskId: "",
|
|
14
|
+
description: "",
|
|
15
|
+
runNow: "y",
|
|
16
|
+
maxRuns: "",
|
|
17
|
+
project: currentProjectId,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
interval: editTarget.intervalHuman ?? "30m",
|
|
22
|
+
taskMode: editTarget.taskId ? "existing" : "inline",
|
|
23
|
+
command: editTarget.commandRaw ?? [editTarget.command, ...editTarget.commandArgs].join(" "),
|
|
24
|
+
cwd: editTarget.cwd ?? "",
|
|
25
|
+
taskId: editTarget.taskId ?? "",
|
|
26
|
+
description: editTarget.description,
|
|
27
|
+
runNow: "y",
|
|
28
|
+
maxRuns: editTarget.maxRuns?.toString() ?? "",
|
|
29
|
+
project: editTarget.projectId ?? "default",
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function FormRouter(props) {
|
|
33
|
+
const { view, editTarget, cloneMode, editTask, editProject, pendingTaskSelection, tasks, projects, currentProjectId, cancelCreate, onCreateDone, handleChooseTask, cancelTask, onTaskDone, cancelProject, onProjectDone } = props;
|
|
34
|
+
if (view === "create") {
|
|
35
|
+
return (_jsx(CreateView, { mode: editTarget && !cloneMode ? "edit" : "create", editId: editTarget && !cloneMode ? editTarget.id : null, initial: createInitialValues(editTarget, currentProjectId), selectedTaskId: pendingTaskSelection?.id ?? null, selectedTaskName: pendingTaskSelection?.name ?? null, tasks: tasks, projects: projects, currentProjectId: currentProjectId, onCancel: cancelCreate, onDone: onCreateDone, onChooseTask: handleChooseTask }));
|
|
36
|
+
}
|
|
37
|
+
if (TASK_FORM_VIEWS.has(view)) {
|
|
38
|
+
return (_jsx(TaskForm, { mode: view === "task-edit" ? "edit" : "create", editTask: editTask, onCancel: cancelTask, onDone: onTaskDone }));
|
|
39
|
+
}
|
|
40
|
+
if (view === "project-create" || view === "project-edit") {
|
|
41
|
+
return (_jsx(ProjectFormView, { mode: view === "project-edit" ? "edit" : "create", editProject: view === "project-edit" ? editProject : null, onCancel: cancelProject, onDone: onProjectDone }));
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
|
-
import { darkTheme as theme } from "
|
|
4
|
-
import { Modal } from "
|
|
5
|
-
import { t } from "../../i18n/index.js";
|
|
3
|
+
import { darkTheme as theme } from "../../shared/ui/theme.js";
|
|
4
|
+
import { Modal } from "../../shared/ui/Modal.js";
|
|
5
|
+
import { t } from "../../shared/i18n/index.js";
|
|
6
6
|
export function ContextHelpModal(props) {
|
|
7
7
|
return (_jsxs(Modal, { title: t("context.helpTitle"), onClose: props.onClose, width: 64, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: theme.text.primary, children: t("context.helpRules") }) }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: theme.accent.brand, children: t("context.helpTemplates") }) }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: theme.semantic.warning, children: t("context.helpCaveat") }) }), _jsx(Box, { children: _jsx(Text, { color: theme.text.secondary, children: t("context.helpJqTip") }) })] }));
|
|
8
8
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { darkTheme as theme } from "
|
|
5
|
-
import { t } from "../../i18n/index.js";
|
|
6
|
-
import { EXPORT_MAX_PREVIEW_LINES } from "../../config/constants.js";
|
|
4
|
+
import { darkTheme as theme } from "../../shared/ui/theme.js";
|
|
5
|
+
import { t } from "../../shared/i18n/index.js";
|
|
6
|
+
import { EXPORT_MAX_PREVIEW_LINES } from "../../shared/config/constants.js";
|
|
7
7
|
import { copyToClipboard } from "../../shared/clipboard.js";
|
|
8
8
|
const VISIBLE_LINES = 20;
|
|
9
9
|
export function ExportModal(props) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text, useInput } from "ink";
|
|
3
|
-
import { darkTheme as theme } from "
|
|
4
|
-
import { Modal } from "
|
|
5
|
-
import { t } from "../../i18n/index.js";
|
|
3
|
+
import { darkTheme as theme } from "../../shared/ui/theme.js";
|
|
4
|
+
import { Modal } from "../../shared/ui/Modal.js";
|
|
5
|
+
import { t } from "../../shared/i18n/index.js";
|
|
6
6
|
export function HelpGuideModal(props) {
|
|
7
7
|
useInput((_input, key) => {
|
|
8
8
|
if (key.escape || _input === "q") {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
|
-
import { darkTheme as theme } from "
|
|
4
|
-
import { Modal } from "
|
|
5
|
-
import { t } from "../../i18n/index.js";
|
|
3
|
+
import { darkTheme as theme } from "../../shared/ui/theme.js";
|
|
4
|
+
import { Modal } from "../../shared/ui/Modal.js";
|
|
5
|
+
import { t } from "../../shared/i18n/index.js";
|
|
6
6
|
function helpEntries(view) {
|
|
7
7
|
switch (view) {
|
|
8
8
|
case "board":
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LogModal } from "../../widgets/log-modal/LogModal.js";
|
|
3
|
+
import { CommandsBrowserModal } from "../../widgets/commands-browser/CommandsBrowserModal.js";
|
|
4
|
+
import { ContextHelpModal } from "./ContextHelpModal.js";
|
|
5
|
+
import { ExportModal } from "./ExportModal.js";
|
|
6
|
+
import { ToastStack } from "../../shared/ui/Toast.js";
|
|
7
|
+
export function OverlayStack(props) {
|
|
8
|
+
return (_jsxs(_Fragment, { children: [props.commandsBrowserOpen ? (_jsx(CommandsBrowserModal, { context: props.commandContext, onClose: props.onCommandsBrowserClose, onExecute: props.onCommandsBrowserExecute })) : null, props.contextHelpOpen ? _jsx(ContextHelpModal, { onClose: props.onContextHelpClose }) : null, props.exportModal ? (_jsx(ExportModal, { json: props.exportModal.json, filePath: props.exportModal.filePath, error: props.exportModal.error, onClose: props.onExportModalClose, onCopy: props.onExportCopy })) : null, props.logModalRun ? (_jsx(LogModal, { loopId: props.logModalLoopId, run: props.logModalRun, logLines: props.logModalLines, loading: props.logModalLoading, onClose: props.onLogModalClose, onCopy: props.onLogCopy })) : null, _jsx(ToastStack, { toasts: props.toasts })] }));
|
|
9
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { darkTheme as theme } from "
|
|
5
|
-
import { t } from "../../i18n/index.js";
|
|
4
|
+
import { darkTheme as theme } from "../../shared/ui/theme.js";
|
|
5
|
+
import { t } from "../../shared/i18n/index.js";
|
|
6
6
|
export function ProjectsModal(props) {
|
|
7
7
|
const { projects, loops, currentProjectId, onSelect, onClose } = props;
|
|
8
8
|
const [selectedIndex, setSelectedIndex] = React.useState(() => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useMemo, useCallback } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { darkTheme as theme } from "
|
|
5
|
-
import { t } from "../../i18n/index.js";
|
|
4
|
+
import { darkTheme as theme } from "../../shared/ui/theme.js";
|
|
5
|
+
import { t } from "../../shared/i18n/index.js";
|
|
6
6
|
const MAX_VISIBLE = 10;
|
|
7
7
|
export function TaskPickerModal(props) {
|
|
8
8
|
const [query, setQuery] = useState("");
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { darkTheme as theme } from "
|
|
5
|
-
import {
|
|
4
|
+
import { darkTheme as theme } from "../../shared/ui/theme.js";
|
|
5
|
+
import { useInject } from "../../shared/hooks/useInject.js";
|
|
6
|
+
import { TYPES } from "../../shared/services/types.js";
|
|
6
7
|
import { parseDuration } from "../../duration.js";
|
|
7
8
|
const EXAMPLES = [
|
|
8
9
|
{ label: "Run tests every 30m", interval: "30m", command: "npm", args: ["test"] },
|
|
@@ -10,6 +11,7 @@ const EXAMPLES = [
|
|
|
10
11
|
{ label: "Sync deps every hour", interval: "1h", command: "npm", args: ["outdated"] },
|
|
11
12
|
];
|
|
12
13
|
export function WelcomeScreen(props) {
|
|
14
|
+
const loopService = useInject(TYPES.LoopService);
|
|
13
15
|
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
14
16
|
const [creating, setCreating] = React.useState(null);
|
|
15
17
|
const items = [...EXAMPLES.map((e) => e.label), "Create empty loop"];
|
|
@@ -45,7 +47,7 @@ export function WelcomeScreen(props) {
|
|
|
45
47
|
projectId: "default",
|
|
46
48
|
offset: null,
|
|
47
49
|
};
|
|
48
|
-
|
|
50
|
+
loopService.create(options, example.interval)
|
|
49
51
|
.then(() => props.onRefresh())
|
|
50
52
|
.then(() => props.onCreateLoop())
|
|
51
53
|
.catch(() => setCreating(null));
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { t } from "../../shared/i18n/index.js";
|
|
3
|
+
import { resolveInputOwner } from "../../shared/ui/state.js";
|
|
4
|
+
export function useOverlayStack(context) {
|
|
5
|
+
const { confirmState, setConfirmState, searchState, setSearchState, setSearchValue, logModalRun, setLogModalRun, logModalLoopId, setLogModalLoopId, commandsBrowserOpen, setCommandsBrowserOpen, exportModal, setExportModal, contextHelpOpen, setContextHelpOpen, view, pop, onQuit, exit, commandBarHasText, commandBarDropdownOpen, } = context;
|
|
6
|
+
const popLayer = () => {
|
|
7
|
+
if (confirmState) {
|
|
8
|
+
setConfirmState(null);
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (searchState?.active) {
|
|
12
|
+
setSearchState(null);
|
|
13
|
+
setSearchValue("");
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (logModalRun) {
|
|
17
|
+
setLogModalRun(null);
|
|
18
|
+
setLogModalLoopId(null);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
if (commandsBrowserOpen) {
|
|
22
|
+
setCommandsBrowserOpen(false);
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
if (exportModal) {
|
|
26
|
+
setExportModal(null);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
if (contextHelpOpen) {
|
|
30
|
+
setContextHelpOpen(false);
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
if (view !== "board") {
|
|
34
|
+
pop();
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
setConfirmState({
|
|
38
|
+
prompt: t("confirm.quit"),
|
|
39
|
+
onConfirm: () => { onQuit(); exit(); },
|
|
40
|
+
});
|
|
41
|
+
return true;
|
|
42
|
+
};
|
|
43
|
+
const anyModalOpen = !!(logModalRun || commandsBrowserOpen || exportModal);
|
|
44
|
+
const commandInputDisabled = anyModalOpen;
|
|
45
|
+
const inputOwner = useMemo(() => resolveInputOwner({
|
|
46
|
+
modalOpen: !!(logModalRun || commandsBrowserOpen || exportModal || contextHelpOpen || confirmState || searchState?.active),
|
|
47
|
+
commandBarHasText,
|
|
48
|
+
commandBarDropdownOpen,
|
|
49
|
+
}), [logModalRun, commandsBrowserOpen, exportModal, contextHelpOpen, confirmState, searchState?.active, commandBarHasText, commandBarDropdownOpen]);
|
|
50
|
+
return { popLayer, anyModalOpen, commandInputDisabled, inputOwner };
|
|
51
|
+
}
|