Skip to content

Commit 26a7fda

Browse files
author
roberttwang
committed
fix(sop): narrow the default review artifact drawer
1 parent 71f2f1b commit 26a7fda

5 files changed

Lines changed: 20 additions & 6 deletions

File tree

‎chatbot/src/ArtifactPanel.jsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export default function ArtifactPanel({
170170
open = true,
171171
view = "artifacts",
172172
filesOnly = false,
173+
layoutOptions,
173174
onViewChange = () => {},
174175
workspaceChanges = null,
175176
workspaceRunId = "",
@@ -239,6 +240,7 @@ export default function ArtifactPanel({
239240
(browsing && workspaceRunId ? "agent-browser" : null) ||
240241
(coding && workspaceRunId ? "workspace-ide" : null),
241242
open,
243+
layoutOptions,
242244
);
243245
useEffect(
244246
() => setNodeId(selected?.kind === "run" ? selected.nodeId || null : null),

‎chatbot/src/SopRunReview.jsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import { SopNodeDetail, SopNodeList } from "./SopRunPanel";
55
import { defaultReviewNode, runPath } from "./sop-review.js";
66
import { readThemePreference, resolveTheme, THEME_KEY } from "./theme.js";
77

8+
const artifactLayout = {
9+
defaultWidth: 340,
10+
storageKey: "agentflow.runReviewArtifactPanelWidth",
11+
};
12+
813
export default function SopRunReview({ search = location.search }) {
914
const params = new URLSearchParams(search);
1015
const runId = params.get("runId");
@@ -131,6 +136,7 @@ export default function SopRunReview({ search = location.search }) {
131136
<ArtifactPanel
132137
{...panel}
133138
filesOnly
139+
layoutOptions={artifactLayout}
134140
runs={[]}
135141
chat={{ projectId: run.executionContext?.projectId }}
136142
/>

‎chatbot/src/useArtifactPanelLayout.js‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { useLayoutEffect, useRef, useState } from "react";
22
import "./artifact-layout.css";
33

4-
const storageKey = "agentflow.artifactPanelWidth";
5-
const defaultWidth = 440;
64
const sashWidth = 4;
75
const snapDistance = 16;
86
export const ARTIFACT_COMPACT_WIDTH = 800;
97

10-
function readWidth() {
8+
function readWidth(storageKey, defaultWidth) {
119
try {
1210
const saved = localStorage.getItem(storageKey);
1311
const width = Number(saved);
@@ -41,8 +39,14 @@ function capturePassage(shell) {
4139
// Pane sizing and keyboard behavior adapted from Grasp (MIT).
4240
// See artifact-preview.css for the upstream license.
4341
/** Grasp's 440px pane, 4px sash and 800px conversation breakpoint. */
44-
export function useArtifactPanelLayout(root, onClose, nodeId = null, open = true) {
45-
const [layout, setLayout] = useState(readWidth);
42+
export function useArtifactPanelLayout(
43+
root,
44+
onClose,
45+
nodeId = null,
46+
open = true,
47+
{ defaultWidth = 440, storageKey = "agentflow.artifactPanelWidth" } = {},
48+
) {
49+
const [layout, setLayout] = useState(() => readWidth(storageKey, defaultWidth));
4650
const [available, setAvailable] = useState(0);
4751
const [dragging, setDragging] = useState(false);
4852
const shell = useRef(null);

‎design.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
| 二级侧栏 | 桌面默认宽 304px;工作台与设置保持一致,工作台保留拖动及宽度记忆 |
3030
| 侧栏卡片 | 上下留白 14px、圆角 16px、细边框;标题与列表共用完整卡片背景 |
3131
| 首页内容 | 输入区最大宽 768px,品牌组合与输入区对齐,短屏允许纵向滚动 |
32-
| 产物抽屉 | 默认宽 440px,分隔拖动条 4px;窄工作区使用覆盖面板 |
32+
| 产物抽屉 | Chatbot 默认宽 440px,会话审阅默认宽 340px,各自记忆拖动宽度。分隔拖动条 4px,窄工作区使用覆盖面板 |
3333
| 模型菜单 | 宽 240px、圆角 12px、最大高 420px,与触发器间隔 6px |
3434

3535
基础颜色由 CSS 变量管理,组件不依赖截图里的固定背景色。

‎e2e/ui/02-interactions.spec.mjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ test('run detail: tabs render and a waiting approval is approved from the UI', a
121121
await expect(page.locator('#runReviewFrame')).not.toHaveAttribute('title', /./);
122122
const review = page.frameLocator('#runReviewFrame');
123123
await expect(review.getByRole('region', { name: '人工审核' })).toBeVisible();
124+
await expect(review.getByRole('separator', { name: '调整产物侧栏宽度' }))
125+
.toHaveAttribute('aria-valuenow', '340');
124126
const artifacts = review.getByRole('complementary', { name: '会话产物' });
125127
const evidence = artifacts.getByRole('button', { name: /result\.md.*上游待审/ });
126128
await evidence.click();

0 commit comments

Comments
 (0)