loop-task 2.0.1 → 2.0.3
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/i18n/en.json +6 -6
- package/dist/tui/{app.js → App.js} +1 -1
- package/dist/tui/components/CommandInput.js +16 -38
- package/dist/tui/components/CreateForm.js +2 -2
- package/dist/tui/components/WizardForm.js +18 -4
- package/dist/tui/index.js +5 -3
- package/package.json +2 -2
- package/dist/board/App.js +0 -405
- package/dist/board/board-log.js +0 -18
- package/dist/board/components/ActionButtons.js +0 -46
- package/dist/board/components/BoardButton.js +0 -58
- package/dist/board/components/ConfirmModal.js +0 -36
- package/dist/board/components/ContextHelpModal.js +0 -22
- package/dist/board/components/CreateForm.js +0 -271
- package/dist/board/components/CreateProjectModal.js +0 -97
- package/dist/board/components/DeleteProjectConfirm.js +0 -53
- package/dist/board/components/DetailView.js +0 -25
- package/dist/board/components/EditProjectModal.js +0 -99
- package/dist/board/components/FilterBar.js +0 -17
- package/dist/board/components/Footer.js +0 -52
- package/dist/board/components/Header.js +0 -46
- package/dist/board/components/HelpModal.js +0 -65
- package/dist/board/components/Inspector.js +0 -12
- package/dist/board/components/LogModal.js +0 -82
- package/dist/board/components/Navigator.js +0 -84
- package/dist/board/components/ProjectsModal.js +0 -70
- package/dist/board/components/ProjectsPage.js +0 -134
- package/dist/board/components/RunHistory.js +0 -83
- package/dist/board/components/SearchBox.js +0 -10
- package/dist/board/components/SearchSelect.js +0 -132
- package/dist/board/components/TaskBrowser.js +0 -95
- package/dist/board/components/TaskFilterBar.js +0 -6
- package/dist/board/components/TaskForm.js +0 -155
- package/dist/board/components/Timeline.js +0 -5
- package/dist/board/daemon.js +0 -117
- package/dist/board/focus-context.js +0 -98
- package/dist/board/hooks/useBoardKeybindings.js +0 -344
- package/dist/board/hooks/useBreakpoint.js +0 -6
- package/dist/board/hooks/useHoverState.js +0 -11
- package/dist/board/hooks/useInputShortcuts.js +0 -61
- package/dist/board/hooks/useLogStream.js +0 -32
- package/dist/board/hooks/useLoopPolling.js +0 -28
- package/dist/board/hooks/useTabNav.js +0 -60
- package/dist/board/hooks/useTaskKeybindings.js +0 -120
- package/dist/board/index.js +0 -32
- package/dist/board/router.js +0 -16
- package/dist/board/state.js +0 -99
- package/dist/board/toast.js +0 -65
- package/dist/board/types.js +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/client/commands.d.ts +0 -11
- package/dist/client/commands.d.ts.map +0 -1
- package/dist/client/commands.js.map +0 -1
- package/dist/client/ipc.d.ts +0 -5
- package/dist/client/ipc.d.ts.map +0 -1
- package/dist/client/ipc.js.map +0 -1
- package/dist/daemon/index.d.ts +0 -2
- package/dist/daemon/index.d.ts.map +0 -1
- package/dist/daemon/index.js.map +0 -1
- package/dist/daemon/manager.d.ts +0 -17
- package/dist/daemon/manager.d.ts.map +0 -1
- package/dist/daemon/manager.js.map +0 -1
- package/dist/daemon/server.d.ts +0 -15
- package/dist/daemon/server.d.ts.map +0 -1
- package/dist/daemon/server.js.map +0 -1
- package/dist/daemon/spawner.d.ts +0 -3
- package/dist/daemon/spawner.d.ts.map +0 -1
- package/dist/daemon/spawner.js.map +0 -1
- package/dist/daemon/state.d.ts +0 -15
- package/dist/daemon/state.d.ts.map +0 -1
- package/dist/daemon/state.js.map +0 -1
- package/dist/duration.d.ts +0 -3
- package/dist/duration.d.ts.map +0 -1
- package/dist/duration.js.map +0 -1
- package/dist/logger.d.ts +0 -11
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js.map +0 -1
- package/dist/loop-config.d.ts +0 -13
- package/dist/loop-config.d.ts.map +0 -1
- package/dist/loop-config.js.map +0 -1
- package/dist/loop.d.ts +0 -46
- package/dist/loop.d.ts.map +0 -1
- package/dist/loop.js +0 -363
- package/dist/loop.js.map +0 -1
- package/dist/open-board.d.ts +0 -2
- package/dist/open-board.d.ts.map +0 -1
- package/dist/open-board.js +0 -19
- package/dist/open-board.js.map +0 -1
- package/dist/tui/app.d.ts +0 -57
- package/dist/tui/app.d.ts.map +0 -1
- package/dist/tui/app.js.map +0 -1
- package/dist/tui/components/ActionButtons.js +0 -49
- package/dist/tui/components/CommandBuilderField.js +0 -143
- package/dist/tui/components/CommandEditorModal.js +0 -159
- package/dist/tui/components/ConfirmModal.js +0 -9
- package/dist/tui/components/FilterBar.js +0 -13
- package/dist/tui/components/FocusableSearchSelect.js +0 -82
- package/dist/tui/components/Footer.js +0 -42
- package/dist/tui/components/PatchEditForm.js +0 -78
- package/dist/tui/components/SearchSelect.js +0 -67
- package/dist/tui/components/TaskFilterBar.js +0 -9
- package/dist/tui/create-loop.d.ts +0 -3
- package/dist/tui/create-loop.d.ts.map +0 -1
- package/dist/tui/create-loop.js +0 -90
- package/dist/tui/create-loop.js.map +0 -1
- package/dist/tui/dashboard.d.ts +0 -2
- package/dist/tui/dashboard.d.ts.map +0 -1
- package/dist/tui/dashboard.js +0 -45
- package/dist/tui/dashboard.js.map +0 -1
- package/dist/tui/events.d.ts +0 -3
- package/dist/tui/events.d.ts.map +0 -1
- package/dist/tui/events.js +0 -244
- package/dist/tui/events.js.map +0 -1
- package/dist/tui/popup.d.ts +0 -3
- package/dist/tui/popup.d.ts.map +0 -1
- package/dist/tui/popup.js +0 -58
- package/dist/tui/popup.js.map +0 -1
- package/dist/tui/render.d.ts +0 -9
- package/dist/tui/render.d.ts.map +0 -1
- package/dist/tui/render.js +0 -305
- package/dist/tui/render.js.map +0 -1
- package/dist/types.d.ts +0 -94
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef } from "react";
|
|
3
|
-
import { useTabNav } from "../hooks/useTabNav.js";
|
|
4
|
-
import { useKeyboard, useTerminalDimensions } from "@opentui/react";
|
|
5
|
-
import { t } from "../../i18n/index.js";
|
|
6
|
-
import { updateProject } from "../daemon.js";
|
|
7
|
-
import { PROJECT_COLORS, PROJECT_COLOR_KEYS } from "../../config/constants.js";
|
|
8
|
-
export function EditProjectModal(props) {
|
|
9
|
-
const { project, onDone, onCancel } = props;
|
|
10
|
-
const { width } = useTerminalDimensions();
|
|
11
|
-
const [name, setName] = useState(project.name);
|
|
12
|
-
const [selectedColorKey, setSelectedColorKey] = useState(() => {
|
|
13
|
-
const found = PROJECT_COLOR_KEYS.find((k) => PROJECT_COLORS[k] === project.color);
|
|
14
|
-
return found ?? PROJECT_COLOR_KEYS[0] ?? "white";
|
|
15
|
-
});
|
|
16
|
-
const [error, setError] = useState("");
|
|
17
|
-
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
18
|
-
const { focusedItem: focusField, setFocusIndex } = useTabNav(["name", "color", "save", "cancel"]);
|
|
19
|
-
const focusFieldRef = useRef(focusField);
|
|
20
|
-
focusFieldRef.current = focusField;
|
|
21
|
-
useKeyboard((key) => {
|
|
22
|
-
if (key.name === "escape") {
|
|
23
|
-
onCancel();
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (key.name === "return" || key.name === "enter") {
|
|
27
|
-
if (focusFieldRef.current === "cancel") {
|
|
28
|
-
onCancel();
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
void submit();
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (focusFieldRef.current === "color") {
|
|
35
|
-
if (key.name === "left" || key.name === "right") {
|
|
36
|
-
const idx = PROJECT_COLOR_KEYS.indexOf(selectedColorKey);
|
|
37
|
-
const dir = key.name === "left" ? -1 : 1;
|
|
38
|
-
setSelectedColorKey(PROJECT_COLOR_KEYS[(idx + dir + PROJECT_COLOR_KEYS.length) % PROJECT_COLOR_KEYS.length] ?? selectedColorKey);
|
|
39
|
-
key.preventDefault();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
async function submit() {
|
|
45
|
-
if (isSubmitting)
|
|
46
|
-
return;
|
|
47
|
-
if (!name.trim()) {
|
|
48
|
-
setError(t("project.error.nameEmpty"));
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
setIsSubmitting(true);
|
|
53
|
-
setError("");
|
|
54
|
-
const color = PROJECT_COLORS[selectedColorKey] ?? project.color;
|
|
55
|
-
await updateProject(project.id, name.trim(), color);
|
|
56
|
-
onDone();
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
60
|
-
}
|
|
61
|
-
finally {
|
|
62
|
-
setIsSubmitting(false);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return (_jsx("box", { style: {
|
|
66
|
-
position: "absolute",
|
|
67
|
-
top: 0,
|
|
68
|
-
left: 0,
|
|
69
|
-
width: "100%",
|
|
70
|
-
height: "100%",
|
|
71
|
-
justifyContent: "center",
|
|
72
|
-
alignItems: "center",
|
|
73
|
-
zIndex: 100,
|
|
74
|
-
}, children: _jsxs("box", { title: t("project.editTitle"), border: true, style: {
|
|
75
|
-
flexDirection: "column",
|
|
76
|
-
padding: 1,
|
|
77
|
-
minWidth: Math.min(44, width - 4),
|
|
78
|
-
backgroundColor: "#111827",
|
|
79
|
-
}, children: [_jsx("text", { fg: focusField === "name" ? "#38bdf8" : "#e5e7eb", children: t("project.labelName") }), _jsx("text", { fg: "#6b7280", children: t("project.hintName") }), _jsx("box", { border: true, borderColor: focusField === "name" ? "#38bdf8" : undefined, style: { height: 3, backgroundColor: "#0b0b0b", marginBottom: 1 }, children: _jsx("input", { focused: focusField === "name", value: name, placeholder: project.name, onInput: (value) => setName(value) }) }), _jsx("text", { fg: focusField === "color" ? "#38bdf8" : "#e5e7eb", children: t("project.labelColor") }), _jsx("text", { fg: "#6b7280", children: t("project.hintColor") }), _jsx("box", { border: true, borderColor: focusField === "color" ? "#38bdf8" : undefined, style: { height: 3, flexDirection: "row", backgroundColor: "#0b0b0b", alignItems: "center", marginBottom: 1 }, children: PROJECT_COLOR_KEYS.map((colorKey) => {
|
|
80
|
-
const isActive = selectedColorKey === colorKey;
|
|
81
|
-
return (_jsx("box", { onMouseDown: () => { setFocusIndex(1); setSelectedColorKey(colorKey); }, style: {
|
|
82
|
-
backgroundColor: isActive ? "#1e3a8a" : undefined,
|
|
83
|
-
paddingLeft: 1,
|
|
84
|
-
paddingRight: 1,
|
|
85
|
-
marginRight: 1,
|
|
86
|
-
}, children: _jsxs("text", { children: [_jsx("span", { fg: PROJECT_COLORS[colorKey] ?? "#ffffff", children: "\u25CF" }), ` ${colorKey}`] }) }, colorKey));
|
|
87
|
-
}) }), error ? _jsx("text", { fg: "#f87171", children: error }) : null, _jsxs("box", { style: { flexDirection: "row", marginTop: 1 }, children: [_jsx("box", { border: true, borderColor: focusField === "save" ? "#38bdf8" : undefined, onMouseDown: () => void submit(), style: {
|
|
88
|
-
width: 12,
|
|
89
|
-
justifyContent: "center",
|
|
90
|
-
alignItems: "center",
|
|
91
|
-
marginRight: 1,
|
|
92
|
-
backgroundColor: focusField === "save" ? "#1e3a8a" : "#0b0b0b",
|
|
93
|
-
}, children: _jsx("text", { fg: "#e5e7eb", children: _jsx("strong", { children: isSubmitting ? t("board.saving") : t("board.save") }) }) }), _jsx("box", { border: true, borderColor: focusField === "cancel" ? "#38bdf8" : undefined, onMouseDown: onCancel, style: {
|
|
94
|
-
width: 12,
|
|
95
|
-
justifyContent: "center",
|
|
96
|
-
alignItems: "center",
|
|
97
|
-
backgroundColor: focusField === "cancel" ? "#1e3a8a" : "#0b0b0b",
|
|
98
|
-
}, children: _jsx("text", { fg: "#e5e7eb", children: _jsx("strong", { children: t("board.cancel") }) }) })] })] }) }));
|
|
99
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { t } from "../../i18n/index.js";
|
|
3
|
-
import { useHoverState } from "../hooks/useHoverState.js";
|
|
4
|
-
import { HOVER_BG } from "../../config/constants.js";
|
|
5
|
-
import { SearchBox } from "./SearchBox.js";
|
|
6
|
-
export function FilterBar(props) {
|
|
7
|
-
const { filters, sort, searchActive, focusedPanel, onStatusCycle, onSortCycle, onSelectProject, currentProjectName, onQueryChange, onSearchActivate, onSearchDismiss } = props;
|
|
8
|
-
const statusDisplay = filters.status === "waiting" ? "waiting" : filters.status;
|
|
9
|
-
return (_jsxs("box", { style: { flexDirection: "row", height: 3, paddingLeft: 1, paddingRight: 1, backgroundColor: "#0b0b0b" }, children: [_jsx(SearchBox, { query: filters.query, searchActive: searchActive, focused: focusedPanel === "search", onQueryChange: onQueryChange, onActivate: onSearchActivate, onDismiss: onSearchDismiss }), onSelectProject ? (_jsx(ClickableBadge, { title: t("project.filterTitle"), text: currentProjectName ?? "Default", textColor: "#f59e0b", focused: focusedPanel === "project-filter", onMouseDown: onSelectProject, marginRight: 1 })) : null, _jsx(ClickableBadge, { title: t("board.statusFilterTitle"), text: statusDisplay, textColor: "#38bdf8", focused: focusedPanel === "status", onMouseDown: onStatusCycle, marginRight: 1 }), _jsx(ClickableBadge, { title: t("board.sortTitle"), text: sort, textColor: "#a3e635", focused: focusedPanel === "sort", onMouseDown: onSortCycle })] }));
|
|
10
|
-
}
|
|
11
|
-
function ClickableBadge(props) {
|
|
12
|
-
const { isHovered, hoverProps } = useHoverState();
|
|
13
|
-
const bg = props.focused ? "#1e2a4a" : isHovered ? HOVER_BG : "#0b0b0b";
|
|
14
|
-
const borderColor = props.focused ? "#38bdf8" : undefined;
|
|
15
|
-
const titleProp = props.title ? { title: props.title } : {};
|
|
16
|
-
return (_jsx("box", { ...titleProp, border: true, borderColor: borderColor, onMouseDown: props.onMouseDown, style: { flexGrow: 1, height: 3, marginRight: props.marginRight, paddingLeft: 1, backgroundColor: bg }, ...hoverProps, children: _jsx("text", { fg: props.textColor, children: props.text }) }));
|
|
17
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { t } from "../../i18n/index.js";
|
|
3
|
-
import { ENTITY_COLORS } from "../../config/constants.js";
|
|
4
|
-
export function Footer(props) {
|
|
5
|
-
const { mode } = props;
|
|
6
|
-
const badge = {
|
|
7
|
-
normal: { label: t("board.badgeNormal"), bg: ENTITY_COLORS.loop },
|
|
8
|
-
search: { label: t("board.badgeSearch"), bg: "#38bdf8" },
|
|
9
|
-
create: { label: t("board.badgeCreate"), bg: ENTITY_COLORS.loop },
|
|
10
|
-
task: { label: t("board.badgeTask"), bg: ENTITY_COLORS.task },
|
|
11
|
-
help: { label: t("board.badgeHelp"), bg: "#facc15" },
|
|
12
|
-
confirm: { label: t("board.badgeConfirm"), bg: "#f87171" },
|
|
13
|
-
projects: { label: t("project.projectsLabel"), bg: ENTITY_COLORS.project },
|
|
14
|
-
};
|
|
15
|
-
const hints = {
|
|
16
|
-
normal: [
|
|
17
|
-
["←/→", t("board.hintSwitchPanel")],
|
|
18
|
-
["/", t("board.hintSearch")],
|
|
19
|
-
["h", t("board.hintHelp")],
|
|
20
|
-
["esc", t("board.hintQuit")],
|
|
21
|
-
],
|
|
22
|
-
search: [
|
|
23
|
-
[t("board.hintKeyEnter"), t("board.hintApply")],
|
|
24
|
-
[t("board.hintKeyEsc"), t("board.hintCancel")],
|
|
25
|
-
],
|
|
26
|
-
create: [
|
|
27
|
-
[t("board.hintKeyTab"), t("board.hintNextField")],
|
|
28
|
-
[t("board.hintKeyEnter"), t("board.hintCreate")],
|
|
29
|
-
[t("board.hintKeyEsc"), t("board.hintCancel")],
|
|
30
|
-
],
|
|
31
|
-
task: [
|
|
32
|
-
[t("board.hintKeyTab"), t("board.hintNextField")],
|
|
33
|
-
[t("board.hintKeyEnter"), t("board.hintCreate")],
|
|
34
|
-
[t("board.hintKeyEsc"), t("board.hintCancel")],
|
|
35
|
-
],
|
|
36
|
-
help: [[t("board.hintKeyHelpEsc"), t("board.hintBack")]],
|
|
37
|
-
confirm: [
|
|
38
|
-
[t("board.hintKeyArrows"), t("board.hintChoose")],
|
|
39
|
-
[t("board.hintKeyEnter"), t("board.hintConfirm")],
|
|
40
|
-
[t("board.hintKeyYN"), t("board.hintYesNo")],
|
|
41
|
-
[t("board.hintKeyEsc"), t("board.hintCancel")],
|
|
42
|
-
],
|
|
43
|
-
projects: [
|
|
44
|
-
["n", t("project.keyNewHint")],
|
|
45
|
-
["e", t("project.keyEditHint")],
|
|
46
|
-
["d", t("project.keyDeleteHint")],
|
|
47
|
-
[t("board.hintKeyEsc"), t("board.hintBack")],
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
const current = badge[mode];
|
|
51
|
-
return (_jsxs("box", { style: { flexDirection: "row", height: 1 }, children: [_jsx("box", { style: { backgroundColor: current.bg, paddingLeft: 1, paddingRight: 1 }, children: _jsx("text", { fg: "#0b0b0b", children: _jsx("strong", { children: current.label }) }) }), _jsx("box", { style: { flexGrow: 1, paddingLeft: 1, flexDirection: "row" }, children: _jsx("text", { children: hints[mode].map(([k, a], i) => (_jsxs("span", { children: [i > 0 ? _jsx("span", { fg: "#374151", children: " " }) : null, _jsx("span", { fg: "#38bdf8", children: k }), _jsxs("span", { fg: "#6b7280", children: [":", a] })] }, k))) }) })] }));
|
|
52
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useTerminalDimensions } from "@opentui/react";
|
|
3
|
-
import { HEADER_COMPACT_WIDTH, ENTITY_COLORS } from "../../config/constants.js";
|
|
4
|
-
import { t } from "../../i18n/index.js";
|
|
5
|
-
import { useHoverState } from "../hooks/useHoverState.js";
|
|
6
|
-
import { HOVER_BG } from "../../config/constants.js";
|
|
7
|
-
function ActionButton(props) {
|
|
8
|
-
const { isHovered, hoverProps } = useHoverState();
|
|
9
|
-
const bg = props.focused ? "#1e2a4a" : isHovered ? HOVER_BG : undefined;
|
|
10
|
-
return (_jsx("box", { onMouseDown: props.onMouseDown, style: { flexGrow: 0, paddingLeft: 1, paddingRight: 1, marginLeft: 1, backgroundColor: bg }, ...hoverProps, children: _jsx("text", { fg: props.textColor, children: props.label }) }));
|
|
11
|
-
}
|
|
12
|
-
export function Header(props) {
|
|
13
|
-
const { daemonStatus, counts, view, focusedPanel, onViewLoops, onViewTasks, onViewProjects, onAddLoop, onAddTask, onAddProject } = props;
|
|
14
|
-
const { width } = useTerminalDimensions();
|
|
15
|
-
const compact = width < HEADER_COMPACT_WIDTH;
|
|
16
|
-
const color = daemonStatus === "connected"
|
|
17
|
-
? "#4ade80"
|
|
18
|
-
: daemonStatus === "error"
|
|
19
|
-
? "#f87171"
|
|
20
|
-
: "#facc15";
|
|
21
|
-
const symbol = daemonStatus === "connected" ? "✓" : daemonStatus === "error" ? "✗" : "…";
|
|
22
|
-
let buttons;
|
|
23
|
-
if (view === "projects") {
|
|
24
|
-
buttons = [
|
|
25
|
-
{ label: t("board.viewLoopsLabel"), color: ENTITY_COLORS.loop, panel: "header-tasks", action: onViewLoops },
|
|
26
|
-
{ label: t("board.viewTasksLabel"), color: ENTITY_COLORS.task, panel: "header-projects", action: onViewTasks },
|
|
27
|
-
{ label: t("project.newProjectLabel"), color: ENTITY_COLORS.project, panel: "header-new", action: onAddProject },
|
|
28
|
-
];
|
|
29
|
-
}
|
|
30
|
-
else if (view === "task-list") {
|
|
31
|
-
buttons = [
|
|
32
|
-
{ label: t("project.manageLabel"), color: ENTITY_COLORS.project, panel: "header-tasks", action: onViewProjects },
|
|
33
|
-
{ label: t("board.viewLoopsLabel"), color: ENTITY_COLORS.loop, panel: "header-projects", action: onViewLoops },
|
|
34
|
-
{ label: t("board.taskActionNew"), color: ENTITY_COLORS.task, panel: "header-new", action: onAddTask },
|
|
35
|
-
];
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
// board (default)
|
|
39
|
-
buttons = [
|
|
40
|
-
{ label: t("project.manageLabel"), color: ENTITY_COLORS.project, panel: "header-tasks", action: onViewProjects },
|
|
41
|
-
{ label: t("board.viewTasksLabel"), color: ENTITY_COLORS.task, panel: "header-projects", action: onViewTasks },
|
|
42
|
-
{ label: t("board.newLoopLabel"), color: ENTITY_COLORS.loop, panel: "header-new", action: onAddLoop },
|
|
43
|
-
];
|
|
44
|
-
}
|
|
45
|
-
return (_jsxs("box", { style: { flexDirection: "column" }, children: [_jsx("box", { style: { flexDirection: "row", paddingLeft: 1, paddingRight: 1 }, children: _jsxs("text", { children: [_jsx("strong", { fg: "#a3e635", children: t("board.appName") }), compact ? null : _jsx("span", { fg: "#6b7280", children: t("board.appTagline") })] }) }), _jsxs("box", { style: { flexDirection: "row", paddingLeft: 1, paddingRight: 1, alignItems: "center" }, children: [_jsx("box", { style: { flexGrow: 1 }, children: _jsxs("text", { children: [_jsx("span", { fg: "#6b7280", children: t("board.daemonLabel") }), _jsxs("span", { fg: color, children: [symbol, " ", daemonStatus] }), compact ? null : (_jsxs(_Fragment, { children: [_jsx("span", { fg: "#6b7280", children: t("board.loopsLabel") }), _jsx("span", { fg: "#e5e7eb", children: counts.total }), _jsx("span", { fg: "#6b7280", children: t("board.runningLabel") }), _jsx("span", { fg: "#4ade80", children: counts.running }), _jsx("span", { fg: "#6b7280", children: t("board.waitingLabel") }), _jsx("span", { fg: "#38bdf8", children: counts.waiting }), _jsx("span", { fg: "#6b7280", children: t("board.pausedLabel") }), _jsx("span", { fg: "#facc15", children: counts.paused }), _jsx("span", { fg: "#6b7280", children: t("board.idleLabel") }), _jsx("span", { fg: "#fb923c", children: counts.idle })] }))] }) }), buttons.map((btn) => btn.action ? (_jsx(ActionButton, { label: btn.label, textColor: btn.color, focused: focusedPanel === btn.panel, onMouseDown: btn.action }, btn.panel)) : null)] }), _jsx("box", { style: { height: 1, paddingLeft: 1, paddingRight: 1 }, children: _jsx("text", { fg: "#374151", children: "─".repeat(Math.max(0, width - 2)) }) })] }));
|
|
46
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useTerminalDimensions } from "@opentui/react";
|
|
3
|
-
import { t } from "../../i18n/index.js";
|
|
4
|
-
export function HelpModal(props) {
|
|
5
|
-
const { view } = props;
|
|
6
|
-
const { width } = useTerminalDimensions();
|
|
7
|
-
const loopRows = [
|
|
8
|
-
["tab", "switch panels"],
|
|
9
|
-
["up/down", "navigate list items"],
|
|
10
|
-
["enter", t("board.helpEdit")],
|
|
11
|
-
["e", "edit loop"],
|
|
12
|
-
["d/del", "delete loop"],
|
|
13
|
-
["c", "clone loop"],
|
|
14
|
-
["f", "force run"],
|
|
15
|
-
["p", "pause/play (contextual)"],
|
|
16
|
-
["s", "stop loop (resets schedule)"],
|
|
17
|
-
["n", t("board.helpCreate")],
|
|
18
|
-
["t", t("board.helpCreateTask")],
|
|
19
|
-
["o", t("board.helpCycleSort")],
|
|
20
|
-
["x", "cycle status filter"],
|
|
21
|
-
["r", "project filter"],
|
|
22
|
-
["/", t("board.helpSearch")],
|
|
23
|
-
["h", t("board.helpToggleHelp")],
|
|
24
|
-
["esc", t("board.helpQuit")],
|
|
25
|
-
];
|
|
26
|
-
const taskRows = [
|
|
27
|
-
["tab", "switch panels"],
|
|
28
|
-
["up/down", "navigate tasks"],
|
|
29
|
-
["enter", "focus actions panel"],
|
|
30
|
-
["e", "edit task"],
|
|
31
|
-
["d/del", "delete task"],
|
|
32
|
-
["s", "select task (when creating/editing a loop)"],
|
|
33
|
-
["n", t("board.helpCreateTask")],
|
|
34
|
-
["/", t("board.helpSearch")],
|
|
35
|
-
["h", t("board.helpToggleHelp")],
|
|
36
|
-
["esc", t("board.helpQuit")],
|
|
37
|
-
];
|
|
38
|
-
const projectRows = [
|
|
39
|
-
["tab", "switch panel (list/actions)"],
|
|
40
|
-
["up/down", "navigate projects"],
|
|
41
|
-
["enter", "focus actions"],
|
|
42
|
-
["n", "new project"],
|
|
43
|
-
["e", "edit project"],
|
|
44
|
-
["d", "delete project"],
|
|
45
|
-
["h", t("board.helpToggleHelp")],
|
|
46
|
-
["esc", t("board.helpQuit")],
|
|
47
|
-
];
|
|
48
|
-
const rows = view === "task-list" ? taskRows : view === "projects" ? projectRows : loopRows;
|
|
49
|
-
const title = view === "task-list" ? "Task List Shortcuts" : view === "projects" ? "Projects Shortcuts" : t("board.helpTitle");
|
|
50
|
-
return (_jsx("box", { style: {
|
|
51
|
-
position: "absolute",
|
|
52
|
-
top: 0,
|
|
53
|
-
left: 0,
|
|
54
|
-
width: "100%",
|
|
55
|
-
height: "100%",
|
|
56
|
-
justifyContent: "center",
|
|
57
|
-
alignItems: "center",
|
|
58
|
-
zIndex: 90,
|
|
59
|
-
}, children: _jsx("box", { title: title, border: true, style: {
|
|
60
|
-
flexDirection: "column",
|
|
61
|
-
padding: 1,
|
|
62
|
-
minWidth: Math.min(52, width - 4),
|
|
63
|
-
backgroundColor: "#111827",
|
|
64
|
-
}, children: rows.map(([keys, desc]) => (_jsxs("text", { children: [_jsx("span", { fg: "#38bdf8", children: keys.padEnd(16) }), desc] }, keys))) }) }));
|
|
65
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { t } from "../../i18n/index.js";
|
|
3
|
-
import { commandLine, describeLoop, statusColor, statusLabel, timeAgo } from "../format.js";
|
|
4
|
-
export function Inspector(props) {
|
|
5
|
-
const { loop } = props;
|
|
6
|
-
if (!loop) {
|
|
7
|
-
return (_jsx("box", { title: t("board.inspectorTitle"), border: true, style: { backgroundColor: "#0b0b0b" }, children: _jsx("text", { fg: "#9ca3af", children: t("board.inspectorEmpty") }) }));
|
|
8
|
-
}
|
|
9
|
-
const cmd = commandLine(loop.command, loop.commandArgs);
|
|
10
|
-
const maxRuns = loop.maxRuns !== null ? String(loop.maxRuns) : t("board.unlimited");
|
|
11
|
-
return (_jsxs("box", { title: t("board.inspectorTitle"), border: true, style: { flexDirection: "column", backgroundColor: "#0b0b0b" }, children: [_jsxs("text", { children: [_jsx("strong", { children: t("board.fieldId") }), " ", loop.id] }), _jsxs("text", { children: [_jsx("strong", { children: t("board.fieldDesc") }), " ", describeLoop(loop)] }), _jsxs("text", { children: [_jsx("strong", { children: t("board.fieldCommand") }), " ", cmd] }), _jsxs("text", { children: [_jsx("strong", { children: t("board.fieldTask") }), " ", loop.taskId] }), _jsxs("text", { children: [_jsx("strong", { children: t("board.fieldDir") }), " ", loop.cwd || t("board.inherit")] }), _jsxs("text", { children: [_jsx("strong", { children: t("board.fieldInterval") }), " ", loop.intervalHuman] }), _jsxs("text", { children: [_jsx("strong", { children: t("board.fieldStatus") }), " ", _jsx("span", { fg: statusColor(loop.status), children: statusLabel(loop.status) })] }), _jsxs("text", { children: [_jsx("strong", { children: t("board.fieldRuns") }), " ", loop.runCount, " / ", maxRuns] }), _jsxs("text", { children: [_jsx("strong", { children: t("board.fieldLastRun") }), " ", timeAgo(loop.lastRunAt)] }), _jsxs("text", { children: [_jsx("strong", { children: t("board.fieldLastExit") }), " ", loop.lastExitCode !== null ? String(loop.lastExitCode) : t("format.dash")] }), _jsxs("text", { children: [_jsx("strong", { children: t("board.fieldNextRun") }), " ", loop.nextRunAt ? timeAgo(loop.nextRunAt) : t("format.dash")] }), _jsxs("text", { children: [_jsx("strong", { children: t("board.fieldPid") }), " ", loop.pid] })] }));
|
|
12
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { useKeyboard, useTerminalDimensions } from "@opentui/react";
|
|
4
|
-
import { t } from "../../i18n/index.js";
|
|
5
|
-
import { formatRunDuration, formatRunTime } from "../format.js";
|
|
6
|
-
import { streamRunLog } from "../daemon.js";
|
|
7
|
-
import { LOG_LINES_MAX } from "../../config/constants.js";
|
|
8
|
-
import { copyToClipboard } from "../../shared/clipboard.js";
|
|
9
|
-
function colorizeLine(line) {
|
|
10
|
-
if (/^\[Run #/.test(line)) {
|
|
11
|
-
return _jsx("text", { fg: "#38bdf8", children: _jsx("strong", { children: line }) });
|
|
12
|
-
}
|
|
13
|
-
if (/^--- Chain:/.test(line)) {
|
|
14
|
-
return _jsx("text", { fg: "#a78bfa", children: _jsx("strong", { children: line }) });
|
|
15
|
-
}
|
|
16
|
-
if (/^\[exit 0/.test(line)) {
|
|
17
|
-
return _jsx("text", { fg: "#4ade80", children: line });
|
|
18
|
-
}
|
|
19
|
-
if (/^\[exit /.test(line)) {
|
|
20
|
-
return _jsx("text", { fg: "#f87171", children: line });
|
|
21
|
-
}
|
|
22
|
-
if (/^\[error\]/.test(line)) {
|
|
23
|
-
return _jsx("text", { fg: "#f87171", children: line });
|
|
24
|
-
}
|
|
25
|
-
return _jsx("text", { fg: "#e5e7eb", children: line });
|
|
26
|
-
}
|
|
27
|
-
export function LogModal(props) {
|
|
28
|
-
const { loopId, run, logLines: staticLines, loading } = props;
|
|
29
|
-
const { width, height } = useTerminalDimensions();
|
|
30
|
-
const isRunning = run.status === "running";
|
|
31
|
-
const [streamLines, setStreamLines] = useState([]);
|
|
32
|
-
const socketRef = useRef(null);
|
|
33
|
-
const scrollRef = useRef(null);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!isRunning || !loopId)
|
|
36
|
-
return;
|
|
37
|
-
setStreamLines([t("board.logWaiting")]);
|
|
38
|
-
const socket = streamRunLog(loopId, run.runNumber, (line) => setStreamLines((prev) => {
|
|
39
|
-
const next = prev[0] === t("board.logWaiting") ? [] : prev;
|
|
40
|
-
return [...next, line].slice(-LOG_LINES_MAX);
|
|
41
|
-
}), () => { }, () => { });
|
|
42
|
-
socketRef.current = socket;
|
|
43
|
-
return () => {
|
|
44
|
-
socket.destroy();
|
|
45
|
-
if (socketRef.current === socket) {
|
|
46
|
-
socketRef.current = null;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}, [isRunning, loopId, run.runNumber]);
|
|
50
|
-
const logLines = isRunning ? streamLines : staticLines;
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (logLines.length > 0) {
|
|
53
|
-
scrollRef.current?.scrollChildIntoView(`log-line-${logLines.length - 1}`);
|
|
54
|
-
}
|
|
55
|
-
}, [logLines]);
|
|
56
|
-
useKeyboard((key) => {
|
|
57
|
-
if (key.ctrl && key.name === "c") {
|
|
58
|
-
const all = logLines.join("\n");
|
|
59
|
-
copyToClipboard(all);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
const success = isRunning ? true : run.exitCode === 0;
|
|
63
|
-
const icon = isRunning ? "⟳" : success ? "✓" : "✗";
|
|
64
|
-
const iconColor = isRunning ? "#facc15" : success ? "#4ade80" : "#f87171";
|
|
65
|
-
const chainLabel = run.chainName ? ` → ${run.chainName}` : "";
|
|
66
|
-
return (_jsx("box", { style: {
|
|
67
|
-
position: "absolute",
|
|
68
|
-
top: 0,
|
|
69
|
-
left: 0,
|
|
70
|
-
width: "100%",
|
|
71
|
-
height: "100%",
|
|
72
|
-
justifyContent: "center",
|
|
73
|
-
alignItems: "center",
|
|
74
|
-
zIndex: 100,
|
|
75
|
-
}, children: _jsxs("box", { title: `${t("board.logModalTitle", { icon, time: formatRunTime(run.startedAt) })}${chainLabel}`, border: true, style: {
|
|
76
|
-
flexDirection: "column",
|
|
77
|
-
minWidth: Math.min(60, width - 4),
|
|
78
|
-
width: Math.min(width - 4, 100),
|
|
79
|
-
height: Math.min(height - 4, 30),
|
|
80
|
-
backgroundColor: "#111827",
|
|
81
|
-
}, children: [_jsx("scrollbox", { ref: scrollRef, style: { flexGrow: 1, backgroundColor: "#0b0b0b" }, children: loading && !isRunning ? (_jsx("text", { fg: "#9ca3af", children: t("board.logModalLoading") })) : logLines.length === 0 ? (_jsx("text", { fg: "#9ca3af", children: t("board.logModalEmpty") })) : (logLines.map((line, i) => (_jsx("box", { id: `log-line-${i}`, children: colorizeLine(line) }, i)))) }), _jsxs("box", { style: { flexDirection: "row", justifyContent: "space-between", backgroundColor: "#111827" }, children: [_jsxs("text", { children: [_jsx("span", { fg: iconColor, children: icon }), " ", isRunning ? (_jsx("span", { fg: "#facc15", children: t("board.logModalRunning") })) : (_jsxs(_Fragment, { children: [_jsx("span", { fg: "#9ca3af", children: formatRunDuration(run.duration) }), " ", _jsxs("span", { fg: success ? "#4ade80" : "#f87171", children: ["exit ", run.exitCode] })] }))] }), _jsx("text", { fg: "#6b7280", children: t("board.logModalEscClose") })] })] }) }));
|
|
82
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { useTerminalDimensions } from "@opentui/react";
|
|
4
|
-
import { t } from "../../i18n/index.js";
|
|
5
|
-
import { describeLoop, sinceLabel, statusColor, statusLabel, timingLabel, truncate } from "../format.js";
|
|
6
|
-
import { useHoverState } from "../hooks/useHoverState.js";
|
|
7
|
-
import { HOVER_BG, ENTITY_COLORS } from "../../config/constants.js";
|
|
8
|
-
function fit(text, width) {
|
|
9
|
-
if (width <= 0)
|
|
10
|
-
return "";
|
|
11
|
-
if (text.length <= width)
|
|
12
|
-
return text.padEnd(width);
|
|
13
|
-
return truncate(text, width);
|
|
14
|
-
}
|
|
15
|
-
export function Navigator(props) {
|
|
16
|
-
const { visible, total, selectedIndex, filters, sort, breakpoint, focused, projects, onSelect, onActivate } = props;
|
|
17
|
-
const { width, height } = useTerminalDimensions();
|
|
18
|
-
const scrollRef = useRef(null);
|
|
19
|
-
const [, setTick] = useState(0);
|
|
20
|
-
const panelWidth = width * (breakpoint === "narrow" ? 1 : 0.605) - 4;
|
|
21
|
-
const panelHeight = height - (breakpoint === "narrow" ? 10 : 7);
|
|
22
|
-
const statusW = 8;
|
|
23
|
-
const exitW = 2;
|
|
24
|
-
const runsW = 5;
|
|
25
|
-
const skpW = 4;
|
|
26
|
-
const bulletW = 2;
|
|
27
|
-
const nonVar = 2 + 1 + statusW + 1 + 1 + 1 + exitW + 1 + 1 + runsW + 1 + skpW;
|
|
28
|
-
const avail = Math.floor(panelWidth) - nonVar - bulletW;
|
|
29
|
-
const descW = Math.min(32, Math.max(10, Math.round(avail * 0.38)));
|
|
30
|
-
const timingW = Math.min(16, Math.max(6, Math.round(avail * 0.25)));
|
|
31
|
-
const sinceW = Math.max(8, avail - descW - timingW);
|
|
32
|
-
const header = " " +
|
|
33
|
-
fit("", bulletW) +
|
|
34
|
-
fit(t("board.headerDescription"), descW) +
|
|
35
|
-
" " +
|
|
36
|
-
fit(t("board.headerStatus"), statusW) +
|
|
37
|
-
" " +
|
|
38
|
-
fit(t("board.headerSince"), sinceW) +
|
|
39
|
-
" " +
|
|
40
|
-
fit(t("board.headerTiming"), timingW) +
|
|
41
|
-
" " +
|
|
42
|
-
fit("EX", exitW) +
|
|
43
|
-
" " +
|
|
44
|
-
"#" + fit(t("board.headerRuns"), runsW) +
|
|
45
|
-
" " +
|
|
46
|
-
fit(t("board.headerSkipped"), skpW);
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
const id = `nav-row-${selectedIndex}`;
|
|
49
|
-
scrollRef.current?.scrollChildIntoView(id);
|
|
50
|
-
}, [selectedIndex]);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
const timer = setInterval(() => {
|
|
53
|
-
setTick((tick) => tick + 1);
|
|
54
|
-
}, 1000);
|
|
55
|
-
return () => clearInterval(timer);
|
|
56
|
-
}, []);
|
|
57
|
-
return (_jsxs("box", { title: t("board.navigatorTitle", { visible: visible.length, total, sort, status: filters.status }), border: true, borderColor: focused ? ENTITY_COLORS.loop : "#1e3a4a", style: { width: breakpoint === "narrow" ? "100%" : "60.5%", flexShrink: 0, flexDirection: "column", backgroundColor: "#0b0b0b", overflow: "hidden" }, children: [_jsx("text", { fg: "#6b7280", style: { height: 1, overflow: "hidden" }, children: header }), visible.length === 0 ? (_jsx("text", { fg: "#9ca3af", children: t("board.noMatch") })) : (_jsx("scrollbox", { ref: scrollRef, style: { flexGrow: 1, maxHeight: panelHeight, backgroundColor: "#0b0b0b" }, children: visible.map((loop, index) => {
|
|
58
|
-
const isSelected = index === selectedIndex;
|
|
59
|
-
const exit = loop.lastExitCode === null ? "-" : String(loop.lastExitCode);
|
|
60
|
-
const proj = projects?.find((p) => p.id === (loop.projectId ?? "default"));
|
|
61
|
-
const bulletColor = proj?.color ?? "#ffffff";
|
|
62
|
-
return (_jsx(NavigatorRow, { id: `nav-row-${index}`, loop: loop, index: index, isSelected: isSelected, focused: focused, exit: exit, statusW: statusW, sinceW: sinceW, descW: descW, timingW: timingW, exitW: exitW, runsW: runsW, skpW: skpW, bulletColor: bulletColor, onSelect: onSelect, onActivate: onActivate }, loop.id));
|
|
63
|
-
}) }))] }));
|
|
64
|
-
}
|
|
65
|
-
function NavigatorRow(props) {
|
|
66
|
-
const { id, loop, index, isSelected, focused, exit, statusW, sinceW, descW, timingW, exitW, runsW, skpW, bulletColor, onSelect, onActivate } = props;
|
|
67
|
-
const { isHovered, hoverProps } = useHoverState();
|
|
68
|
-
const bg = isSelected ? (focused ? "#1e3a8a" : "#1e2a4a") : isHovered ? HOVER_BG : undefined;
|
|
69
|
-
const lastClickRef = useRef(0);
|
|
70
|
-
function handleClick() {
|
|
71
|
-
const now = Date.now();
|
|
72
|
-
if (now - lastClickRef.current < 400) {
|
|
73
|
-
onActivate(index);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
onSelect(index);
|
|
77
|
-
}
|
|
78
|
-
lastClickRef.current = now;
|
|
79
|
-
}
|
|
80
|
-
const descText = fit(truncate(describeLoop(loop), descW), descW);
|
|
81
|
-
const afterDesc = ` ${fit(statusLabel(loop.status), statusW)} ${fit(sinceLabel(loop), sinceW)} ${fit(timingLabel(loop), timingW)} ${fit(exit, exitW)} #${String(loop.runCount).padStart(runsW)} ${fit(loop.skippedCount > 0 ? String(loop.skippedCount) : "-", skpW)}`;
|
|
82
|
-
const statusFg = statusColor(loop.status);
|
|
83
|
-
return (_jsx("box", { id: id, onMouseDown: handleClick, backgroundColor: bg, style: { height: 1, overflow: "hidden" }, ...hoverProps, children: _jsxs("text", { fg: "#e5e7eb", children: [isSelected ? "› " : " ", _jsx("span", { fg: bulletColor, children: "● " }), descText, " ", _jsx("span", { fg: statusFg, children: afterDesc.slice(1, 1 + statusW) }), afterDesc.slice(1 + statusW)] }) }));
|
|
84
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { useKeyboard, useTerminalDimensions } from "@opentui/react";
|
|
4
|
-
import { t } from "../../i18n/index.js";
|
|
5
|
-
const ALL_ID = "all";
|
|
6
|
-
export function ProjectsModal(props) {
|
|
7
|
-
const { projects, loops, currentProjectId, onSelect, onClose } = props;
|
|
8
|
-
const { width } = useTerminalDimensions();
|
|
9
|
-
const [query, setQuery] = useState("");
|
|
10
|
-
// "Show All" synthetic entry always first, then real projects sorted alphabetically
|
|
11
|
-
const sorted = [...projects].sort((a, b) => a.name.localeCompare(b.name));
|
|
12
|
-
const allEntry = { id: ALL_ID, name: t("project.showAll"), color: "#6b7280", isSystem: false, isDefault: false, createdAt: "" };
|
|
13
|
-
const entries = [allEntry, ...sorted];
|
|
14
|
-
const filtered = query
|
|
15
|
-
? entries.filter((p) => p.id === ALL_ID || p.name.toLowerCase().startsWith(query.toLowerCase()))
|
|
16
|
-
: entries;
|
|
17
|
-
const initialIndex = Math.max(0, filtered.findIndex((p) => p.id === currentProjectId));
|
|
18
|
-
const [selectedIndex, setSelectedIndex] = useState(initialIndex);
|
|
19
|
-
const clampedIndex = Math.min(selectedIndex, Math.max(0, filtered.length - 1));
|
|
20
|
-
useKeyboard((key) => {
|
|
21
|
-
if (key.name === "up") {
|
|
22
|
-
setSelectedIndex((i) => Math.max(0, i - 1));
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (key.name === "down") {
|
|
26
|
-
setSelectedIndex((i) => Math.min(filtered.length - 1, i + 1));
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (key.name === "return" || key.name === "enter") {
|
|
30
|
-
const entry = filtered[clampedIndex];
|
|
31
|
-
if (entry)
|
|
32
|
-
onSelect(entry.id);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (key.name === "escape") {
|
|
36
|
-
onClose();
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (key.name === "backspace") {
|
|
40
|
-
setQuery((q) => q.slice(0, -1));
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta) {
|
|
44
|
-
setQuery((q) => q + key.sequence);
|
|
45
|
-
setSelectedIndex(0);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
return (_jsx("box", { style: {
|
|
49
|
-
position: "absolute",
|
|
50
|
-
top: 0,
|
|
51
|
-
left: 0,
|
|
52
|
-
width: "100%",
|
|
53
|
-
height: "100%",
|
|
54
|
-
justifyContent: "center",
|
|
55
|
-
alignItems: "center",
|
|
56
|
-
zIndex: 100,
|
|
57
|
-
}, children: _jsxs("box", { title: t("project.selectProject"), border: true, style: {
|
|
58
|
-
flexDirection: "column",
|
|
59
|
-
padding: 1,
|
|
60
|
-
minWidth: Math.min(50, width - 4),
|
|
61
|
-
backgroundColor: "#111827",
|
|
62
|
-
}, children: [_jsx("box", { border: true, style: { height: 3, marginBottom: 1, backgroundColor: "#0b0b0b" }, children: _jsxs("text", { fg: query ? "#e5e7eb" : "#6b7280", children: [query || "type to filter...", "\u258E"] }) }), filtered.length === 0 ? (_jsx("text", { fg: "#9ca3af", children: "No projects match" })) : (filtered.map((entry, index) => {
|
|
63
|
-
const isSelected = index === clampedIndex;
|
|
64
|
-
const bg = isSelected ? "#1e3a8a" : undefined;
|
|
65
|
-
const loopCount = entry.id === ALL_ID
|
|
66
|
-
? loops.length
|
|
67
|
-
: loops.filter((l) => (l.projectId ?? "default") === entry.id).length;
|
|
68
|
-
return (_jsx("box", { backgroundColor: bg, onMouseDown: () => onSelect(entry.id), style: { height: 1 }, children: _jsxs("text", { children: [isSelected ? "› " : " ", _jsx("span", { fg: entry.color, children: "\u25CF" }), ` ${entry.name} `, _jsx("span", { fg: "#6b7280", children: `(${loopCount})` })] }) }, entry.id));
|
|
69
|
-
}))] }) }));
|
|
70
|
-
}
|