@kabmo-labs/kabmo 0.28.0 → 0.29.0
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/bunfig.toml +6 -0
- package/dist/client/index.html +2 -2
- package/dist/client/index.js +481 -472
- package/dist/client/static/js/{index-xzvyrxya.js → index-43z47ngg.js} +1193 -1049
- package/dist/client/static/js/index-naa91727.css +1 -0
- package/dist/client/static/{manifest-q6h8k9e0.webmanifest → manifest-vdvdqpre.webmanifest} +1 -0
- package/package.json +3 -2
- package/public/manifest.webmanifest +1 -0
- package/src/client/components/common/ComposerTextarea.test.tsx +109 -0
- package/src/client/components/common/ComposerTextarea.tsx +6 -0
- package/src/client/components/common/ReloadPageButton.test.tsx +14 -0
- package/src/client/components/common/ReloadPageButton.tsx +11 -2
- package/src/client/components/common/diagram-viewer/read-block.test.ts +71 -0
- package/src/client/components/common/diagram-viewer/read-block.ts +40 -16
- package/src/client/components/common/file-icon/index.tsx +7 -1
- package/src/client/components/common/harness-glyph/brands.ts +7 -1
- package/src/client/components/common/image-viewer/index.tsx +37 -165
- package/src/client/components/common/picker-search/index.tsx +70 -0
- package/src/client/components/common/search-select/index.tsx +2 -7
- package/src/client/components/common/zoom-pan-stage/index.tsx +258 -0
- package/src/client/components/common/zoom-pan-stage/zoom-pan-stage.test.tsx +87 -0
- package/src/client/components/layout/session-sidebar/ClassicView.tsx +1 -1
- package/src/client/components/layout/session-sidebar/SessionListNotice.tsx +7 -3
- package/src/client/components/layout/session-sidebar/about-modal/HarnessRow.tsx +4 -1
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.tsx +12 -1
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.test.tsx +82 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.tsx +23 -3
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +1 -0
- package/src/client/components/layout/session-sidebar/modern/index.tsx +1 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskList.tsx +6 -4
- package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +8 -0
- package/src/client/components/mobile/mobile-right-sidebar/EditorSurface.tsx +25 -0
- package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +1 -1
- package/src/client/components/settings/Sidebar.tsx +6 -8
- package/src/client/components/settings/categories/HarnessSettings.tsx +4 -2
- package/src/client/components/settings/categories/PanelPluginSettings.tsx +2 -2
- package/src/client/components/settings/categories/PluginSettings.tsx +1 -1
- package/src/client/components/settings/categories/harness-settings/ConfigForm.tsx +3 -6
- package/src/client/components/settings/categories/panel-plugins/GitFreshness.test.tsx +36 -0
- package/src/client/components/settings/categories/panel-plugins/Section.tsx +1 -3
- package/src/client/components/settings/categories/panel-plugins/Toolbar.tsx +18 -4
- package/src/client/components/settings/categories/plugin-settings/MarketplacePane.tsx +64 -61
- package/src/client/components/settings/categories/plugin-settings/SidebarList.tsx +15 -4
- package/src/client/components/settings/groups.test.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/IrcNotice.test.tsx +55 -0
- package/src/client/components/workspace/chat-timeline/IrcNotice.tsx +71 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +4 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +19 -0
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +8 -3
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.search.test.tsx +72 -0
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +42 -15
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.test.tsx +28 -0
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +28 -10
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +47 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +55 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +3 -2
- package/src/client/components/workspace/editor/FilePane.tsx +32 -0
- package/src/client/components/workspace/editor/Toolbar.tsx +4 -0
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +1 -0
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +5 -2
- package/src/client/components/workspace/editor/viewers/CsvGrid.tsx +52 -5
- package/src/client/components/workspace/editor/viewers/DataGrid.tsx +227 -41
- package/src/client/components/workspace/editor/viewers/DrawioView.tsx +93 -0
- package/src/client/components/workspace/editor/viewers/GridRow.tsx +91 -0
- package/src/client/components/workspace/editor/viewers/GridToolbar.tsx +53 -0
- package/src/client/components/workspace/editor/viewers/SheetView.tsx +152 -57
- package/src/client/components/workspace/editor/viewers/dispatch.tsx +42 -9
- package/src/client/components/workspace/editor/viewers/drawio-pages.test.ts +80 -0
- package/src/client/components/workspace/editor/viewers/drawio-pages.ts +63 -0
- package/src/client/components/workspace/editor/viewers/grid.test.ts +296 -0
- package/src/client/components/workspace/editor/viewers/use-cell-edit.ts +64 -0
- package/src/client/components/workspace/editor/viewers/use-grid-interaction.ts +216 -0
- package/src/client/components/workspace/editor/viewers/viewers.test.ts +47 -2
- package/src/client/components/workspace/editor/viewers/workbook.ts +149 -0
- package/src/client/components/workspace/file-explorer/ArchiveModals.tsx +262 -0
- package/src/client/components/workspace/file-explorer/ContextMenu.tsx +30 -6
- package/src/client/components/workspace/file-explorer/Modals.tsx +8 -3
- package/src/client/components/workspace/file-explorer/RootOverlays.tsx +60 -0
- package/src/client/components/workspace/file-explorer/RowLabel.tsx +6 -2
- package/src/client/components/workspace/file-explorer/TreeItem.tsx +39 -49
- package/src/client/components/workspace/file-explorer/TreeItemModals.tsx +80 -0
- package/src/client/components/workspace/file-explorer/index.tsx +53 -29
- package/src/client/components/workspace/file-explorer/selection.test.tsx +109 -0
- package/src/client/data/settings/omp-schema.json +169 -22
- package/src/client/glass.css +39 -14
- package/src/client/glass.test.ts +37 -0
- package/src/client/hooks/chat/composer/history.test.ts +267 -0
- package/src/client/hooks/chat/composer/history.ts +146 -0
- package/src/client/hooks/chat/timeline/ask-frames.test.ts +54 -0
- package/src/client/hooks/chat/timeline/ask-frames.ts +29 -1
- package/src/client/hooks/chat/timeline/timeline-rail.test.ts +34 -2
- package/src/client/hooks/chat/timeline/user-turns.ts +31 -2
- package/src/client/hooks/editor/file-editor-types.ts +15 -0
- package/src/client/hooks/editor/save-bytes.ts +79 -0
- package/src/client/hooks/editor/use-file-editor.test.ts +30 -0
- package/src/client/hooks/editor/use-file-editor.ts +53 -5
- package/src/client/hooks/editor/use-file-read.ts +21 -2
- package/src/client/hooks/editor/use-grid-selection.ts +160 -0
- package/src/client/hooks/models/use-harness-update.test.ts +35 -2
- package/src/client/hooks/models/use-harness-update.ts +49 -10
- package/src/client/hooks/workspace/diff-file.test.ts +72 -0
- package/src/client/hooks/workspace/diff-file.ts +12 -6
- package/src/client/hooks/workspace/file-archive.ts +220 -0
- package/src/client/hooks/workspace/file-clipboard.test.ts +4 -4
- package/src/client/hooks/workspace/file-clipboard.ts +37 -26
- package/src/client/hooks/workspace/file-selection.test.ts +67 -0
- package/src/client/hooks/workspace/file-selection.ts +156 -0
- package/src/client/hooks/workspace/file-tree-actions-clipboard.test.ts +5 -5
- package/src/client/hooks/workspace/file-tree-actions.ts +36 -8
- package/src/client/lib/editor/workbook-drafts.ts +42 -0
- package/src/client/lib/launch/file-handlers.ts +2 -2
- package/src/client/lib/scrollbar-activity.test.ts +21 -88
- package/src/client/lib/scrollbar-activity.ts +71 -73
- package/src/client/lib/scrollbar-events.ts +143 -0
- package/src/client/lib/scrollbar-input.test.ts +126 -0
- package/src/client/lib/scrollbar-probe.test-util.ts +107 -0
- package/src/client/tailwind.css +32 -1
- package/src/server/db.server.test.ts +50 -1
- package/src/server/db.server.ts +36 -3
- package/src/server/lib/chat/prompt-history.server.test.ts +92 -0
- package/src/server/lib/chat/prompt-history.server.ts +65 -0
- package/src/server/lib/chat/schema.server.ts +35 -0
- package/src/server/lib/db/schema.ts +3 -0
- package/src/server/lib/fs/archive.test.ts +139 -0
- package/src/server/lib/fs/archive.ts +259 -0
- package/src/server/lib/fs/git-diff.test.ts +26 -1
- package/src/server/lib/fs/git-diff.ts +43 -15
- package/src/server/lib/harness/launch-table.ts +19 -0
- package/src/server/lib/harness/provider-entry.ts +1 -1
- package/src/server/lib/harness/provider-file.server.ts +1 -1
- package/src/server/lib/harness/provider-sources.server.ts +2 -1
- package/src/server/lib/harness/provider-write.server.ts +2 -1
- package/src/server/lib/harness/update-job-store.ts +12 -0
- package/src/server/lib/harness/update-queue.server.ts +15 -10
- package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +5 -1
- package/src/server/lib/omp/rpc/frame-fold.test.ts +5 -1
- package/src/server/lib/omp/rpc/lifecycle.test.ts +4 -0
- package/src/server/lib/omp/session/auto-title.server.test.ts +4 -0
- package/src/server/lib/omp/session/delete.server.ts +1 -0
- package/src/server/lib/omp/session/goal-driver.test.ts +5 -1
- package/src/server/lib/omp/session/goal-settings.test.ts +5 -1
- package/src/server/lib/panels/auto-update.server.test.ts +5 -2
- package/src/server/lib/panels/git-update.server.test.ts +5 -2
- package/src/server/lib/panels/install.server.test.ts +5 -2
- package/src/server/lib/panels/remove.server.test.ts +5 -2
- package/src/server/routes/agent/command.ts +11 -0
- package/src/server/routes/agent/new.ts +5 -0
- package/src/server/routes/chat/index.ts +5 -0
- package/src/server/routes/chat/prompt-history.test.ts +67 -0
- package/src/server/routes/chat/prompt-history.ts +31 -0
- package/src/server/routes/chat/stream.test.ts +21 -0
- package/src/server/routes/chat/stream.ts +5 -0
- package/src/server/routes/fs/action-archive.test.ts +128 -0
- package/src/server/routes/fs/action-bulk.ts +106 -0
- package/src/server/routes/fs/action-save-bytes.test.ts +59 -0
- package/src/server/routes/fs/action-transfer.test.ts +26 -0
- package/src/server/routes/fs/action.ts +91 -11
- package/src/server/routes/fs/archive.ts +20 -0
- package/src/server/routes/fs/grant.test.ts +5 -2
- package/src/server/routes/fs/index.ts +2 -0
- package/src/server/routes/fs/scope.test.ts +6 -2
- package/src/server/routes/harness/import-action.ts +1 -1
- package/src/server/routes/harness/root.ts +6 -1
- package/src/server/routes/harness/summary.test.ts +50 -0
- package/src/server/routes/harness/update-status.ts +41 -2
- package/src/server/routes/harness/update.test.ts +56 -2
- package/src/server/routes/sessions/delete.test.ts +4 -0
- package/src/shared/lib/chat/ask-form/index.ts +39 -31
- package/src/shared/lib/chat/ask-form/labels.ts +46 -0
- package/src/shared/lib/chat/ask-form/tokens.ts +11 -2
- package/src/shared/lib/chat/ask-form.test.ts +57 -0
- package/src/shared/lib/chat/ask-questions.ts +31 -0
- package/src/shared/lib/chat/composer/history.test.ts +67 -0
- package/src/shared/lib/chat/composer/history.ts +61 -0
- package/src/shared/lib/chat/irc-notice.ts +42 -0
- package/src/shared/lib/chat/timeline/fork-anchor.test.ts +2 -0
- package/src/shared/lib/chat/todo/parser.ts +6 -4
- package/src/shared/lib/fs/archive.test.ts +101 -0
- package/src/shared/lib/fs/archive.ts +191 -0
- package/src/shared/lib/fs/clipboard.test.ts +32 -7
- package/src/shared/lib/fs/clipboard.ts +59 -14
- package/src/shared/lib/fs/csv.test.ts +50 -0
- package/src/shared/lib/fs/csv.ts +40 -0
- package/src/shared/lib/fs/document-kind.test.ts +13 -6
- package/src/shared/lib/fs/document-kind.ts +18 -6
- package/src/shared/lib/fs/file-kind-classify.test.ts +4 -0
- package/src/shared/lib/fs/file-kind.test.ts +2 -7
- package/src/shared/lib/fs/file-kind.ts +4 -2
- package/src/shared/lib/fs/grid-edit.test.ts +24 -0
- package/src/shared/lib/fs/grid-edit.ts +29 -0
- package/src/shared/lib/fs/grid-selection.test.ts +137 -0
- package/src/shared/lib/fs/grid-selection.ts +138 -0
- package/src/shared/lib/harness/brand-color.ts +5 -0
- package/src/shared/lib/harness/catalog.test.ts +22 -0
- package/src/shared/lib/harness/catalog.ts +12 -1
- package/src/shared/lib/harness/config-fields.test.ts +25 -0
- package/src/shared/lib/harness/config-fields.ts +33 -3
- package/src/shared/lib/harness/dialects.ts +1 -1
- package/src/shared/lib/harness/mcp-facts.ts +4 -0
- package/src/shared/lib/harness/provider-contracts.ts +109 -0
- package/src/shared/lib/harness/provider-facts.test.ts +2 -1
- package/src/shared/lib/harness/provider-facts.ts +24 -115
- package/src/shared/lib/harness/provider-lookup.ts +37 -0
- package/src/shared/lib/harness/providers.ts +2 -1
- package/src/shared/lib/harness/updates.ts +10 -0
- package/src/shared/lib/omp/session/mapper.test.ts +31 -0
- package/src/shared/lib/omp/session/mapper.ts +17 -0
- package/src/shared/lib/omp/session/messages-map-notice.test.ts +68 -0
- package/src/shared/lib/omp/session/messages-map.test.ts +1 -35
- package/src/shared/lib/omp/session/messages-map.ts +17 -0
- package/src/shared/lib/omp/session/wait.ts +10 -1
- package/src/shared/lib/settings/sections.ts +8 -4
- package/src/shared/lib/ui/picker-filter.test.ts +23 -0
- package/src/shared/lib/ui/picker-filter.ts +20 -0
- package/src/shared/types/chat.ts +4 -0
- package/src/shared/types/harness.ts +5 -1
- package/src/shared/types/omp/session.ts +18 -0
- package/src/shared/types/settings/state.ts +6 -6
- package/src/shared/types/todo.ts +3 -1
- package/src/test-support/file-actions.test-util.ts +4 -0
- package/src/test-support/file-archive.test-util.ts +41 -0
- package/src/test-support/file-clipboard.test-util.ts +9 -6
- package/src/test-support/harness-table.test-util.ts +2 -0
- package/src/test-support/preload.ts +46 -0
- package/dist/client/static/js/index-81f7berm.css +0 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The zoom/pan surface shared by every full-size picture in the editor.
|
|
8
|
+
*
|
|
9
|
+
* An image and a rendered diagram are the same interaction: a fixed-size
|
|
10
|
+
* drawing, a stage that fits it once, wheel zoom anchored at the pointer,
|
|
11
|
+
* drag to pan, double-click to toggle fit/100%, and a footer that names the
|
|
12
|
+
* size and offers the same three controls. Stating that once is the point —
|
|
13
|
+
* the image viewer and the drawio viewer used to be two copies of the same
|
|
14
|
+
* arithmetic, and a fit that disagreed between them is exactly the kind of
|
|
15
|
+
* defect a second copy produces.
|
|
16
|
+
*
|
|
17
|
+
* The content is measured, not declared: the caller renders whatever it has
|
|
18
|
+
* (an `<img>`, a column of SVG pages) and the stage reads its layout size. That
|
|
19
|
+
* is what lets a multi-page diagram fit as one document without the caller
|
|
20
|
+
* computing caption heights.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks';
|
|
24
|
+
import type { ComponentChildren, TargetedPointerEvent, TargetedWheelEvent } from 'preact';
|
|
25
|
+
|
|
26
|
+
const MIN_SCALE = 0.1;
|
|
27
|
+
const MAX_SCALE = 16;
|
|
28
|
+
/** Zoom step for the buttons and the +/- keys. */
|
|
29
|
+
const ZOOM_STEP = 1.4;
|
|
30
|
+
/** Wheel `deltaY` → scale exponent, so zooming feels the same on every device. */
|
|
31
|
+
const WHEEL_SENSITIVITY = 0.0015;
|
|
32
|
+
/** Pixels kept clear around a fitted drawing. */
|
|
33
|
+
const FIT_MARGIN = 48;
|
|
34
|
+
|
|
35
|
+
export interface ZoomPanStageProps {
|
|
36
|
+
/** Changes when the content's size may have changed, so the stage re-measures. */
|
|
37
|
+
measureKey: unknown;
|
|
38
|
+
/** Left slot of the footer; the measured size when omitted. */
|
|
39
|
+
caption?: string;
|
|
40
|
+
/** Rendered over the stage, unscaled — a loading spinner, a notice. */
|
|
41
|
+
overlay?: ComponentChildren;
|
|
42
|
+
className?: string;
|
|
43
|
+
children: ComponentChildren;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface Drag {
|
|
47
|
+
pointerId: number;
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface Size {
|
|
53
|
+
width: number;
|
|
54
|
+
height: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function ZoomPanStage({
|
|
58
|
+
measureKey,
|
|
59
|
+
caption,
|
|
60
|
+
overlay,
|
|
61
|
+
className = '',
|
|
62
|
+
children,
|
|
63
|
+
}: ZoomPanStageProps) {
|
|
64
|
+
const stageRef = useRef<HTMLDivElement>(null);
|
|
65
|
+
const contentRef = useRef<HTMLDivElement>(null);
|
|
66
|
+
const dragRef = useRef<Drag | null>(null);
|
|
67
|
+
|
|
68
|
+
const [size, setSize] = useState<Size | null>(null);
|
|
69
|
+
const [scale, setScale] = useState(1);
|
|
70
|
+
const [offset, setOffset] = useState({ x: 0, y: 0 });
|
|
71
|
+
const [dragging, setDragging] = useState(false);
|
|
72
|
+
/**
|
|
73
|
+
* Whether the user has moved the view themselves.
|
|
74
|
+
*
|
|
75
|
+
* A stage resize refits only while this is false: the editor panel is 320px
|
|
76
|
+
* when a file opens and full-screen a click later, and a fit computed against
|
|
77
|
+
* the narrow panel left the drawing at 40% in the wide one. Once the user has
|
|
78
|
+
* zoomed or panned, their view outranks the container's size.
|
|
79
|
+
*/
|
|
80
|
+
const userAdjustedRef = useRef(false);
|
|
81
|
+
|
|
82
|
+
/** The content's layout size; transforms do not affect `offsetWidth`. */
|
|
83
|
+
const measure = useCallback(() => {
|
|
84
|
+
const element = contentRef.current;
|
|
85
|
+
if (!element) return;
|
|
86
|
+
const width = element.offsetWidth;
|
|
87
|
+
const height = element.offsetHeight;
|
|
88
|
+
if (width <= 0 || height <= 0) return;
|
|
89
|
+
setSize((previous) =>
|
|
90
|
+
previous && previous.width === width && previous.height === height ? previous : { width, height },
|
|
91
|
+
);
|
|
92
|
+
}, []);
|
|
93
|
+
|
|
94
|
+
// A new drawing is a new view: the previous one's zoom and pan belong to
|
|
95
|
+
// nothing on screen, so the fit applies even when the new content is the same
|
|
96
|
+
// size as the old one (two 632×252 diagrams in one session).
|
|
97
|
+
useLayoutEffect(() => {
|
|
98
|
+
userAdjustedRef.current = false;
|
|
99
|
+
measure();
|
|
100
|
+
}, [measure, measureKey]);
|
|
101
|
+
|
|
102
|
+
// A late layout change (a font, a wrapped caption) is a new size to fit.
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (typeof ResizeObserver === 'undefined') return;
|
|
105
|
+
const element = contentRef.current;
|
|
106
|
+
if (!element) return;
|
|
107
|
+
const observer = new ResizeObserver(measure);
|
|
108
|
+
observer.observe(element);
|
|
109
|
+
return () => observer.disconnect();
|
|
110
|
+
}, [measure]);
|
|
111
|
+
|
|
112
|
+
/** Scale that fits the whole drawing without upscaling it past 1. */
|
|
113
|
+
const fitToView = useCallback(() => {
|
|
114
|
+
const stage = stageRef.current?.getBoundingClientRect();
|
|
115
|
+
if (!stage || !size) return;
|
|
116
|
+
const fit = Math.min(
|
|
117
|
+
1,
|
|
118
|
+
(stage.width - FIT_MARGIN) / size.width,
|
|
119
|
+
(stage.height - FIT_MARGIN) / size.height,
|
|
120
|
+
);
|
|
121
|
+
setScale(Math.max(MIN_SCALE, fit));
|
|
122
|
+
setOffset({ x: 0, y: 0 });
|
|
123
|
+
userAdjustedRef.current = false;
|
|
124
|
+
}, [size]);
|
|
125
|
+
|
|
126
|
+
// Fit once per size. Re-measuring on every render would fight an in-progress
|
|
127
|
+
// zoom, and only a size change invalidates the current fit.
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (size) fitToView();
|
|
130
|
+
}, [size, fitToView]);
|
|
131
|
+
|
|
132
|
+
const zoomBy = useCallback((factor: number) => {
|
|
133
|
+
userAdjustedRef.current = true;
|
|
134
|
+
setScale((current) => Math.min(MAX_SCALE, Math.max(MIN_SCALE, current * factor)));
|
|
135
|
+
}, []);
|
|
136
|
+
|
|
137
|
+
// The stage's own size is a fit input too: a panel that grows must re-fit a
|
|
138
|
+
// drawing that was fitted to the narrow one.
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (typeof ResizeObserver === 'undefined') return;
|
|
141
|
+
const stage = stageRef.current;
|
|
142
|
+
if (!stage) return;
|
|
143
|
+
const observer = new ResizeObserver(() => {
|
|
144
|
+
if (!userAdjustedRef.current) fitToView();
|
|
145
|
+
});
|
|
146
|
+
observer.observe(stage);
|
|
147
|
+
return () => observer.disconnect();
|
|
148
|
+
}, [fitToView]);
|
|
149
|
+
|
|
150
|
+
const handleWheel = useCallback(
|
|
151
|
+
(event: TargetedWheelEvent<HTMLDivElement>) => {
|
|
152
|
+
// Without this the editor panel scrolls while zooming.
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
zoomBy(Math.exp(-event.deltaY * WHEEL_SENSITIVITY));
|
|
155
|
+
},
|
|
156
|
+
[zoomBy],
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
const handlePointerDown = useCallback(
|
|
160
|
+
(event: TargetedPointerEvent<HTMLDivElement>) => {
|
|
161
|
+
if (event.button !== 0 || !size) return;
|
|
162
|
+
userAdjustedRef.current = true;
|
|
163
|
+
dragRef.current = { pointerId: event.pointerId, x: event.clientX, y: event.clientY };
|
|
164
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
165
|
+
setDragging(true);
|
|
166
|
+
},
|
|
167
|
+
[size],
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const handlePointerMove = useCallback((event: TargetedPointerEvent<HTMLDivElement>) => {
|
|
171
|
+
const drag = dragRef.current;
|
|
172
|
+
if (!drag || drag.pointerId !== event.pointerId) return;
|
|
173
|
+
const dx = event.clientX - drag.x;
|
|
174
|
+
const dy = event.clientY - drag.y;
|
|
175
|
+
drag.x = event.clientX;
|
|
176
|
+
drag.y = event.clientY;
|
|
177
|
+
setOffset((current) => ({ x: current.x + dx, y: current.y + dy }));
|
|
178
|
+
}, []);
|
|
179
|
+
|
|
180
|
+
const endDrag = useCallback((event: TargetedPointerEvent<HTMLDivElement>) => {
|
|
181
|
+
if (dragRef.current?.pointerId !== event.pointerId) return;
|
|
182
|
+
dragRef.current = null;
|
|
183
|
+
setDragging(false);
|
|
184
|
+
}, []);
|
|
185
|
+
|
|
186
|
+
const handleDoubleClick = useCallback(() => {
|
|
187
|
+
if (Math.abs(scale - 1) < 0.01) fitToView();
|
|
188
|
+
else {
|
|
189
|
+
setScale(1);
|
|
190
|
+
setOffset({ x: 0, y: 0 });
|
|
191
|
+
}
|
|
192
|
+
}, [scale, fitToView]);
|
|
193
|
+
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
const onKeyDown = (event: globalThis.KeyboardEvent) => {
|
|
196
|
+
if (event.key !== '+' && event.key !== '=' && event.key !== '-' && event.key !== '_' && event.key !== '0') return;
|
|
197
|
+
// The stage owns these keys only while it has focus; a window-level
|
|
198
|
+
// listener would steal `-`/`0` from the composer and the file search box.
|
|
199
|
+
const target = event.target as HTMLElement | null;
|
|
200
|
+
if (!target || !stageRef.current?.contains(target)) return;
|
|
201
|
+
event.preventDefault();
|
|
202
|
+
if (event.key === '0') fitToView();
|
|
203
|
+
else if (event.key === '+' || event.key === '=') zoomBy(ZOOM_STEP);
|
|
204
|
+
else zoomBy(1 / ZOOM_STEP);
|
|
205
|
+
};
|
|
206
|
+
window.addEventListener('keydown', onKeyDown);
|
|
207
|
+
return () => window.removeEventListener('keydown', onKeyDown);
|
|
208
|
+
}, [zoomBy, fitToView]);
|
|
209
|
+
|
|
210
|
+
const percent = Math.round(scale * 100);
|
|
211
|
+
const dimensions = size ? `${size.width} × ${size.height} px` : '';
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<div className={`relative flex h-full w-full flex-col bg-paper ${className}`}>
|
|
215
|
+
<div
|
|
216
|
+
ref={stageRef}
|
|
217
|
+
tabIndex={-1}
|
|
218
|
+
onWheel={handleWheel}
|
|
219
|
+
onPointerDown={handlePointerDown}
|
|
220
|
+
onPointerMove={handlePointerMove}
|
|
221
|
+
onPointerUp={endDrag}
|
|
222
|
+
onPointerCancel={endDrag}
|
|
223
|
+
onDblClick={handleDoubleClick}
|
|
224
|
+
className={`relative flex-1 overflow-hidden outline-none ${dragging ? 'cursor-grabbing' : 'cursor-grab'}`}
|
|
225
|
+
>
|
|
226
|
+
<div className="absolute inset-0 flex items-center justify-center">
|
|
227
|
+
<div
|
|
228
|
+
ref={contentRef}
|
|
229
|
+
className="shrink-0"
|
|
230
|
+
style={{
|
|
231
|
+
transform: `translate3d(${offset.x}px, ${offset.y}px, 0) scale(${scale})`,
|
|
232
|
+
visibility: size ? 'visible' : 'hidden',
|
|
233
|
+
}}
|
|
234
|
+
>
|
|
235
|
+
{children}
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
{overlay}
|
|
239
|
+
</div>
|
|
240
|
+
|
|
241
|
+
<div className="flex flex-shrink-0 items-center justify-between border-t border-ink/10 bg-canvas px-3 py-1.5 font-mono text-[10px] text-ink/50">
|
|
242
|
+
<span>{caption ?? dimensions}</span>
|
|
243
|
+
<div className="flex items-center gap-3">
|
|
244
|
+
<button type="button" onClick={() => zoomBy(1 / ZOOM_STEP)} className="hover:text-ink" title="Zoom out (-)">
|
|
245
|
+
−
|
|
246
|
+
</button>
|
|
247
|
+
<span className="w-10 text-center tabular-nums">{percent}%</span>
|
|
248
|
+
<button type="button" onClick={() => zoomBy(ZOOM_STEP)} className="hover:text-ink" title="Zoom in (+)">
|
|
249
|
+
+
|
|
250
|
+
</button>
|
|
251
|
+
<button type="button" onClick={fitToView} className="hover:text-ink" title="Fit to view (0)">
|
|
252
|
+
Fit
|
|
253
|
+
</button>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
);
|
|
258
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The shared zoom/pan surface.
|
|
8
|
+
*
|
|
9
|
+
* happy-dom has no layout engine, so `offsetWidth` is 0 and the stage never
|
|
10
|
+
* fits — which is exactly why these tests pin the parts that do not need a
|
|
11
|
+
* measurement: the footer's controls, the zoom arithmetic behind them, and the
|
|
12
|
+
* caption. The fit itself is exercised in the browser (the drawio smoke test).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
16
|
+
import { Window } from 'happy-dom';
|
|
17
|
+
import { h, render } from 'preact';
|
|
18
|
+
import { act } from 'preact/test-utils';
|
|
19
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
20
|
+
import type { ZoomPanStage as ZoomPanStageType } from '@/client/components/common/zoom-pan-stage';
|
|
21
|
+
|
|
22
|
+
let ZoomPanStage: typeof ZoomPanStageType;
|
|
23
|
+
let container: HTMLElement;
|
|
24
|
+
|
|
25
|
+
beforeAll(async () => {
|
|
26
|
+
const win = new Window({ url: 'http://localhost' });
|
|
27
|
+
installDomGlobals(win);
|
|
28
|
+
// Dynamic on purpose: the module must be evaluated AFTER the DOM globals
|
|
29
|
+
// exist, which is the same order `viewers.test.ts` uses.
|
|
30
|
+
({ ZoomPanStage } = await import('@/client/components/common/zoom-pan-stage'));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
afterAll(() => restoreDomGlobals());
|
|
34
|
+
|
|
35
|
+
afterEach(() => {
|
|
36
|
+
if (container) render(null, container);
|
|
37
|
+
container?.remove();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
async function mount(node: unknown) {
|
|
41
|
+
container = document.createElement('div');
|
|
42
|
+
document.body.appendChild(container);
|
|
43
|
+
await act(async () => {
|
|
44
|
+
render(node as never, container);
|
|
45
|
+
});
|
|
46
|
+
return container;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
describe('ZoomPanStage', () => {
|
|
50
|
+
test('offers the three controls and starts at 100%', async () => {
|
|
51
|
+
await mount(h(ZoomPanStage, { measureKey: 0, children: h('div', null, 'content') }));
|
|
52
|
+
expect(container.querySelector('button[title="Zoom in (+)"]')).not.toBeNull();
|
|
53
|
+
expect(container.querySelector('button[title="Zoom out (-)"]')).not.toBeNull();
|
|
54
|
+
expect(container.querySelector('button[title="Fit to view (0)"]')).not.toBeNull();
|
|
55
|
+
expect(container.querySelector('.tabular-nums')?.textContent).toBe('100%');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// The buttons and the +/- keys share one step, so a click must move the
|
|
59
|
+
// readout by exactly that factor.
|
|
60
|
+
test('zoom in and out move the readout by the step', async () => {
|
|
61
|
+
await mount(h(ZoomPanStage, { measureKey: 0, children: h('div', null, 'content') }));
|
|
62
|
+
await act(async () => {
|
|
63
|
+
(container.querySelector('button[title="Zoom in (+)"]') as HTMLButtonElement).click();
|
|
64
|
+
});
|
|
65
|
+
expect(container.querySelector('.tabular-nums')?.textContent).toBe('140%');
|
|
66
|
+
await act(async () => {
|
|
67
|
+
(container.querySelector('button[title="Zoom out (-)"]') as HTMLButtonElement).click();
|
|
68
|
+
});
|
|
69
|
+
expect(container.querySelector('.tabular-nums')?.textContent).toBe('100%');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('the caption replaces the measured size', async () => {
|
|
73
|
+
await mount(h(ZoomPanStage, { measureKey: 0, caption: '3 pages', children: h('div', null, 'content') }));
|
|
74
|
+
expect(container.textContent).toContain('3 pages');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('the overlay is drawn over the stage, unscaled', async () => {
|
|
78
|
+
await mount(
|
|
79
|
+
h(ZoomPanStage, {
|
|
80
|
+
measureKey: 0,
|
|
81
|
+
overlay: h('span', { class: 'overlay-marker' }, 'loading'),
|
|
82
|
+
children: h('div', null, 'content'),
|
|
83
|
+
}),
|
|
84
|
+
);
|
|
85
|
+
expect(container.querySelector('.overlay-marker')).not.toBeNull();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -25,9 +25,11 @@ interface SessionListNoticeProps {
|
|
|
25
25
|
touch?: boolean;
|
|
26
26
|
/** The user's own retry — the same `refreshNow` the toolbar's button calls. */
|
|
27
27
|
onRetry: () => void;
|
|
28
|
+
/** That retry is in flight, so the glyph spins instead of looking inert. */
|
|
29
|
+
refreshing?: boolean;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
export function SessionListNotice({ touch = false, onRetry }: SessionListNoticeProps) {
|
|
32
|
+
export function SessionListNotice({ touch = false, onRetry, refreshing = false }: SessionListNoticeProps) {
|
|
31
33
|
return (
|
|
32
34
|
<div
|
|
33
35
|
role="alert"
|
|
@@ -44,11 +46,13 @@ export function SessionListNotice({ touch = false, onRetry }: SessionListNoticeP
|
|
|
44
46
|
<button
|
|
45
47
|
type="button"
|
|
46
48
|
onClick={onRetry}
|
|
47
|
-
|
|
49
|
+
disabled={refreshing}
|
|
50
|
+
aria-busy={refreshing}
|
|
51
|
+
className={`mt-1 inline-flex items-center gap-1.5 rounded-md border border-ink/20 bg-paper px-2.5 font-medium text-ink transition-colors hover:bg-ink/5 disabled:opacity-60 ${
|
|
48
52
|
touch ? 'h-11 text-sm' : 'h-7 text-xs'
|
|
49
53
|
}`}
|
|
50
54
|
>
|
|
51
|
-
<RefreshCw size={13} aria-hidden="true" />
|
|
55
|
+
<RefreshCw size={13} className={refreshing ? 'animate-spin' : undefined} aria-hidden="true" />
|
|
52
56
|
Try again
|
|
53
57
|
</button>
|
|
54
58
|
</div>
|
|
@@ -37,6 +37,8 @@ export interface HarnessRowProps {
|
|
|
37
37
|
/** Starts this harness's update. */
|
|
38
38
|
onUpdate: () => void;
|
|
39
39
|
onOpenLog?: () => void;
|
|
40
|
+
/** Drops this row's settled record, once its result has been read. */
|
|
41
|
+
onDismiss?: () => void;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/** The state mark. Shape carries the state, so tone is reinforcement only. */
|
|
@@ -80,7 +82,7 @@ function StateMark({ state }: { state: HarnessState }) {
|
|
|
80
82
|
const COLUMNS = 'grid grid-cols-[minmax(0,1fr)_7rem_1.75rem] items-start gap-x-2 md:grid-cols-[minmax(0,1fr)_9.5rem_1.75rem]';
|
|
81
83
|
|
|
82
84
|
export function HarnessRow({
|
|
83
|
-
entry, version, job, problem, onOpenHarness, onUpdate, onOpenLog,
|
|
85
|
+
entry, version, job, problem, onOpenHarness, onUpdate, onOpenLog, onDismiss,
|
|
84
86
|
}: HarnessRowProps) {
|
|
85
87
|
const status = harnessStatus(entry);
|
|
86
88
|
// Three states, three answers: a worker is installing this one, this one is
|
|
@@ -254,6 +256,7 @@ export function HarnessRow({
|
|
|
254
256
|
progress={progress}
|
|
255
257
|
message={job?.message ?? null}
|
|
256
258
|
onOpenLog={onOpenLog}
|
|
259
|
+
onDismiss={onDismiss}
|
|
257
260
|
/>
|
|
258
261
|
)}
|
|
259
262
|
</div>
|
|
@@ -62,11 +62,13 @@ interface HarnessTableProps {
|
|
|
62
62
|
* a waiting run and an installing one at the same time; the row names its own.
|
|
63
63
|
*/
|
|
64
64
|
onOpenLog?: (harness: string) => void;
|
|
65
|
+
/** Drops one harness's settled record; resolves to a refusal, or null. */
|
|
66
|
+
onDismiss?: (harness: string) => Promise<string | null>;
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
export function HarnessTable({
|
|
68
70
|
harnesses, versions, loading = false, onOpenHarness, onUpdate, jobs = [],
|
|
69
|
-
onOpenLog,
|
|
71
|
+
onOpenLog, onDismiss,
|
|
70
72
|
}: HarnessTableProps) {
|
|
71
73
|
const [problem, setProblem] = useState<{ id: string; message: string } | null>(null);
|
|
72
74
|
|
|
@@ -85,6 +87,14 @@ export function HarnessTable({
|
|
|
85
87
|
setProblem(message ? { id, message } : null);
|
|
86
88
|
};
|
|
87
89
|
|
|
90
|
+
// A refusal from a dismissal is shown under the same row, for the same reason
|
|
91
|
+
// a refused press is: the reader pressed something on THAT line.
|
|
92
|
+
const runDismiss = async (id: string) => {
|
|
93
|
+
if (!onDismiss) return;
|
|
94
|
+
const message = await onDismiss(id);
|
|
95
|
+
setProblem(message ? { id, message } : null);
|
|
96
|
+
};
|
|
97
|
+
|
|
88
98
|
return (
|
|
89
99
|
<section className="text-left" aria-labelledby="agents-heading">
|
|
90
100
|
<div className="mb-1.5 flex items-baseline justify-between gap-2 border-b border-ink/10 pb-1.5">
|
|
@@ -137,6 +147,7 @@ export function HarnessTable({
|
|
|
137
147
|
onOpenHarness={() => onOpenHarness(entry.id)}
|
|
138
148
|
onUpdate={() => void runUpdate(entry.id)}
|
|
139
149
|
onOpenLog={onOpenLog ? () => onOpenLog(entry.id) : undefined}
|
|
150
|
+
onDismiss={onDismiss ? () => void runDismiss(entry.id) : undefined}
|
|
140
151
|
/>
|
|
141
152
|
))}
|
|
142
153
|
</div>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The line under an updating harness row.
|
|
8
|
+
*
|
|
9
|
+
* The state it must not blur is the dismissal: a settled record is history and
|
|
10
|
+
* carries an X, while a run that is installing (or waiting its turn) must not —
|
|
11
|
+
* deleting a live record would hide the spinner and let a second install start.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
15
|
+
import { Window } from 'happy-dom';
|
|
16
|
+
import { h, render } from 'preact';
|
|
17
|
+
import { act } from 'preact/test-utils';
|
|
18
|
+
|
|
19
|
+
import { UpdateLogLine, type UpdateLogLineProps } from '@/client/components/layout/session-sidebar/about-modal/UpdateLogLine';
|
|
20
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
21
|
+
|
|
22
|
+
let container: HTMLElement;
|
|
23
|
+
|
|
24
|
+
function mount(props: UpdateLogLineProps): HTMLElement {
|
|
25
|
+
container = document.createElement('div');
|
|
26
|
+
document.body.appendChild(container);
|
|
27
|
+
act(() => render(h(UpdateLogLine, props), container));
|
|
28
|
+
return container;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const dismissControl = (el: HTMLElement): HTMLButtonElement | null =>
|
|
32
|
+
el.querySelector<HTMLButtonElement>('button[aria-label="Dismiss update result"]');
|
|
33
|
+
|
|
34
|
+
beforeAll(() => {
|
|
35
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
afterEach(() => {
|
|
39
|
+
if (container) render(null, container);
|
|
40
|
+
container?.remove();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
afterAll(() => {
|
|
44
|
+
restoreDomGlobals();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('UpdateLogLine', () => {
|
|
48
|
+
test('a settled result states the message and offers the way out', () => {
|
|
49
|
+
const el = mount({
|
|
50
|
+
running: false,
|
|
51
|
+
progress: null,
|
|
52
|
+
message: 'claude updated (adapter) — it now reports 0.106.0',
|
|
53
|
+
onDismiss: () => {},
|
|
54
|
+
});
|
|
55
|
+
expect(el.textContent).toContain('it now reports 0.106.0');
|
|
56
|
+
expect(dismissControl(el)).not.toBeNull();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('the dismiss control asks for that harness\'s record to be dropped', () => {
|
|
60
|
+
let dismissed = 0;
|
|
61
|
+
const el = mount({
|
|
62
|
+
running: false,
|
|
63
|
+
progress: null,
|
|
64
|
+
message: 'claude updated (adapter)',
|
|
65
|
+
onDismiss: () => {
|
|
66
|
+
dismissed += 1;
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
act(() => dismissControl(el)!.click());
|
|
70
|
+
expect(dismissed).toBe(1);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('an installing or queued run has no dismiss control', () => {
|
|
74
|
+
const installing = mount({ running: true, progress: 'adapter', message: null, onDismiss: () => {} });
|
|
75
|
+
expect(installing.textContent).toContain('Installing adapter…');
|
|
76
|
+
expect(dismissControl(installing)).toBeNull();
|
|
77
|
+
|
|
78
|
+
const queued = mount({ running: false, queued: true, progress: null, message: null, onDismiss: () => {} });
|
|
79
|
+
expect(queued.textContent).toContain('Queued');
|
|
80
|
+
expect(dismissControl(queued)).toBeNull();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -19,10 +19,15 @@
|
|
|
19
19
|
* for, because the queue is invisible otherwise.
|
|
20
20
|
*
|
|
21
21
|
* After the run settles the line stays, showing what happened and keeping
|
|
22
|
-
* `View log` available: the failure case is exactly when the output matters
|
|
23
|
-
*
|
|
22
|
+
* `View log` available: the failure case is exactly when the output matters. A
|
|
23
|
+
* settled line also carries the dismiss control — the record is history, and
|
|
24
|
+
* without a way out "claude updated (adapter) — it now reports 0.106.0" stayed
|
|
25
|
+
* on the row forever. A running or queued line has no dismiss: deleting a live
|
|
26
|
+
* record would hide the spinner and let a second install start.
|
|
24
27
|
*/
|
|
25
28
|
|
|
29
|
+
import { X } from 'lucide-preact';
|
|
30
|
+
|
|
26
31
|
export interface UpdateLogLineProps {
|
|
27
32
|
/** Is the worker still installing? */
|
|
28
33
|
running: boolean;
|
|
@@ -33,9 +38,12 @@ export interface UpdateLogLineProps {
|
|
|
33
38
|
/** The finished run's sentence, once it has one. */
|
|
34
39
|
message: string | null;
|
|
35
40
|
onOpenLog?: () => void;
|
|
41
|
+
/** Drops the settled record. Absent while the run is still moving. */
|
|
42
|
+
onDismiss?: () => void;
|
|
36
43
|
}
|
|
37
44
|
|
|
38
|
-
export function UpdateLogLine({ running, queued = false, progress, message, onOpenLog }: UpdateLogLineProps) {
|
|
45
|
+
export function UpdateLogLine({ running, queued = false, progress, message, onOpenLog, onDismiss }: UpdateLogLineProps) {
|
|
46
|
+
const settled = !running && !queued;
|
|
39
47
|
return (
|
|
40
48
|
<span className="col-span-3 flex items-center gap-2 pb-1 text-[10px] text-ink/60">
|
|
41
49
|
{running
|
|
@@ -51,6 +59,18 @@ export function UpdateLogLine({ running, queued = false, progress, message, onOp
|
|
|
51
59
|
>
|
|
52
60
|
View log
|
|
53
61
|
</button>
|
|
62
|
+
{settled && onDismiss && (
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
data-update-dismiss
|
|
66
|
+
onClick={onDismiss}
|
|
67
|
+
aria-label="Dismiss update result"
|
|
68
|
+
title="Dismiss"
|
|
69
|
+
className="ml-auto shrink-0 cursor-pointer rounded p-0.5 text-ink/40 transition-colors hover:bg-ink/5 hover:text-ink"
|
|
70
|
+
>
|
|
71
|
+
<X size={10} className="stroke-[2.5]" />
|
|
72
|
+
</button>
|
|
73
|
+
)}
|
|
54
74
|
</span>
|
|
55
75
|
);
|
|
56
76
|
}
|
|
@@ -180,6 +180,7 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
180
180
|
onUpdate={update.start}
|
|
181
181
|
jobs={update.jobs}
|
|
182
182
|
onOpenLog={setLogHarness}
|
|
183
|
+
onDismiss={update.dismiss}
|
|
183
184
|
onOpenHarness={(id) => {
|
|
184
185
|
onClose();
|
|
185
186
|
// The settings modal is the frame that owns harness pages; the
|
|
@@ -112,7 +112,7 @@ export function ModernSidebarView({
|
|
|
112
112
|
|
|
113
113
|
<div className="mt-1 flex-1 scrollbar-overlay-container px-2 pb-3">
|
|
114
114
|
{failed ? (
|
|
115
|
-
<SessionListNotice touch={touch} onRetry={onRefresh} />
|
|
115
|
+
<SessionListNotice touch={touch} onRetry={onRefresh} refreshing={refreshing} />
|
|
116
116
|
) : initializing ? (
|
|
117
117
|
<ModernSidebarSkeleton touch={touch} />
|
|
118
118
|
) : visible.length === 0 ? (
|
|
@@ -21,9 +21,8 @@ import {
|
|
|
21
21
|
Clock,
|
|
22
22
|
Loader2,
|
|
23
23
|
Pause,
|
|
24
|
+
Pencil,
|
|
24
25
|
Play,
|
|
25
|
-
RefreshCw,
|
|
26
|
-
RotateCw,
|
|
27
26
|
Trash2,
|
|
28
27
|
} from 'lucide-preact';
|
|
29
28
|
import { describeSchedule, formatDuration } from '@/shared/lib/schedule/parse';
|
|
@@ -163,7 +162,10 @@ export function TaskList({
|
|
|
163
162
|
onClick={() => onToggleEnabled(task)}
|
|
164
163
|
className="p-1.5 rounded hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors disabled:opacity-40"
|
|
165
164
|
>
|
|
166
|
-
|
|
165
|
+
{/* A pause/resume toggle, so it draws the transport glyph it
|
|
166
|
+
means — a `RefreshCw` here read as "refresh this task", a
|
|
167
|
+
different action from the one the button performs. */}
|
|
168
|
+
{task.enabled ? <Pause size={13} /> : <Play size={13} />}
|
|
167
169
|
</button>
|
|
168
170
|
<button
|
|
169
171
|
type="button"
|
|
@@ -173,7 +175,7 @@ export function TaskList({
|
|
|
173
175
|
onClick={() => onEdit(task)}
|
|
174
176
|
className="p-1.5 rounded hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors disabled:opacity-40"
|
|
175
177
|
>
|
|
176
|
-
<
|
|
178
|
+
<Pencil size={13} />
|
|
177
179
|
</button>
|
|
178
180
|
<button
|
|
179
181
|
type="button"
|
|
@@ -105,6 +105,14 @@ describe('SessionListNotice', () => {
|
|
|
105
105
|
expect(retried).toBe(1);
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
+
test('the retry spins while the list is being re-read', () => {
|
|
109
|
+
render(h(SessionListNotice, { onRetry: () => {}, refreshing: true }), container);
|
|
110
|
+
const button = container.querySelector('button')!;
|
|
111
|
+
expect(button.querySelector('svg')?.getAttribute('class')).toContain('animate-spin');
|
|
112
|
+
// A second press while the first read is in flight would race it.
|
|
113
|
+
expect(button.hasAttribute('disabled')).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
|
|
108
116
|
test('the phone variant keeps a 44px target', () => {
|
|
109
117
|
render(h(SessionListNotice, { touch: true, onRetry: () => {} }), container);
|
|
110
118
|
expect(container.querySelector('button')!.className).toContain('h-11');
|