Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(web): 处理中保持补全方式菜单关闭

longmeidaodbd0313f7a6b
diff --git a/frontend/src/react/library-processing/processing-actions.tsx b/frontend/src/react/library-processing/processing-actions.tsx
index 36c75eddc..5513b0382 100644
--- a/frontend/src/react/library-processing/processing-actions.tsx
+++ b/frontend/src/react/library-processing/processing-actions.tsx
@@ -39,7 +39,7 @@ export function ProcessingActions({ busy, scan = false, onRun }: {
</Button>
<Button ref={trigger} iconOnly leadingIcon={RiArrowDownSLine}
aria-label={scan ? '更多扫描与采集方式' : '更多资料与预览补全方式'}
- aria-haspopup="dialog" aria-expanded={open} {...busyProps(busy)} onClick={() => setOpen(!open)} />
+ aria-haspopup="dialog" aria-expanded={open} {...busyProps(busy)} onClick={() => { if (!busy) setOpen(!open) }} />
</span>
<Popover triggerRef={trigger} isOpen={open} onOpenChange={setOpen} placement="bottom end" offset={4}
className={MENU_POPOVER_SURFACE}>
diff --git a/frontend/test/react/library-completion.test.tsx b/frontend/test/react/library-completion.test.tsx
index d1dabfd0a..dc6d712f5 100644
--- a/frontend/test/react/library-completion.test.tsx
+++ b/frontend/test/react/library-completion.test.tsx
@@ -72,15 +72,22 @@ it('启动等待期间不重复提交,结束后刷新馆藏并给出封面与
const primary = buttonNamed('补全资料与预览', host)!;
await click(primary);
expect(primary.getAttribute('aria-busy')).toBe('true');
+ const more = host.querySelector<HTMLButtonElement>('[aria-haspopup="dialog"]')!;
+ await click(more);
+ expect(more.getAttribute('aria-expanded')).toBe('false');
await click(primary);
expect(posts).toHaveLength(1);
await response.release({ status: 'running', job_id: 'complete-one' });
expect(host.textContent).toContain('生成视频预览');
+ await click(more);
+ expect(more.getAttribute('aria-expanded')).toBe('false');
await act(async () => queryClient.setQueryData(LIBRARY_PROCESSING_KEY,
{ status: 'complete', job_id: 'complete-one', covers: 1, previews: 2 }));
expect(host.textContent).toContain('取得 1 张封面,生成 2 部视频预览');
expect(queryClient.getQueryState(['catalog-grid', 'catalog', 'sample', 1])?.isInvalidated).toBe(true);
expect(onComplete).toHaveBeenCalledTimes(1);
+ await click(more);
+ expect(more.getAttribute('aria-expanded')).toBe('true');
});
it('启动失败保留入口与处理详情,不显示完成回执', async () => {
diff --git a/web/dist/peach-app.js b/web/dist/peach-app.js
index 7f864468b..10098c078 100644
--- a/web/dist/peach-app.js
+++ b/web/dist/peach-app.js
@@ -47929,7 +47929,9 @@ function wF({ busy: e, scan: t = !1, onRun: n }) {
"aria-haspopup": "dialog",
"aria-expanded": i,
...J(e),
- onClick: () => a(!i)
+ onClick: () => {
+ e || a(!i);
+ }
})]
}), /* @__PURE__ */ (0, C.jsx)(wM, {
triggerRef: r,