Skip to content

armgit / peach

Public Imported from GitHub
0

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

fix(web): 统一浏览器添加字段的标签间距

longmeidaofdb8878f1d76
diff --git a/frontend/e2e/jav-browser-settings.test.ts b/frontend/e2e/jav-browser-settings.test.ts
index 7c49f51fc..ea8f6586b 100644
--- a/frontend/e2e/jav-browser-settings.test.ts
+++ b/frontend/e2e/jav-browser-settings.test.ts
@@ -71,6 +71,18 @@ describe('浏览器添加 JAV 设置', () => {
assert.equal(await status.innerText(), '已启用');
assert.equal(await status.locator('span[aria-hidden="true"]').count(), 1);
assert.notEqual(await statusColor(), disabledColor);
+ const channelLabelBox = await region.getByText('浏览器添加的下载渠道', { exact: true }).boundingBox();
+ const channelFieldBox = await channel.boundingBox();
+ assert.ok(channelLabelBox && channelFieldBox);
+ const channelGap = channelFieldBox.y - channelLabelBox.y - channelLabelBox.height;
+ const inputGaps = await region.locator('[data-input-size]').evaluateAll(fields => fields.map(field => {
+ const label = field.querySelector('label')!;
+ const control = label.nextElementSibling!;
+ return control.getBoundingClientRect().top - label.getBoundingClientRect().bottom;
+ }));
+ assert.equal(inputGaps.length, 2);
+ assert.ok(inputGaps.every(gap => Math.abs(gap - channelGap) <= 0.5),
+ JSON.stringify({ channelGap, inputGaps }));
assert.equal(await token.inputValue(), 'test-issued-token-1');
assert.equal(await token.getAttribute('type'), 'password');
assert.equal(await region.getByRole('link', { name: '安装 Peach 用户脚本' }).getAttribute('href'),
diff --git a/frontend/src/react/settings/jav-browser-settings.tsx b/frontend/src/react/settings/jav-browser-settings.tsx
index 3adb26385..6b44fdc4e 100644
--- a/frontend/src/react/settings/jav-browser-settings.tsx
+++ b/frontend/src/react/settings/jav-browser-settings.tsx
@@ -42,7 +42,7 @@ function BrowserForm({ initial, receipt }: { initial: State; receipt(message: st
return <Section title="浏览器添加 JAV">
<Stack>
<div><ExternalLink href="/integrations/peach-jav.user.js">安装 Peach 用户脚本</ExternalLink></div>
- <div><FieldLabel>浏览器添加的下载渠道</FieldLabel>
+ <div className="flex flex-col gap-1"><FieldLabel>浏览器添加的下载渠道</FieldLabel>
<Select aria-label="浏览器添加的下载渠道" selectedKey={provider}
onSelectionChange={key => setProvider(String(key))} isDisabled={Boolean(action.busy)}>
{state.providers.map(item => <SelectItem key={item.key} id={item.key} textValue={item.label}>
diff --git a/web/dist/peach-app.js b/web/dist/peach-app.js
index 7231a41b8..6e10e6586 100644
--- a/web/dist/peach-app.js
+++ b/web/dist/peach-app.js
@@ -71137,20 +71137,23 @@ function wPe({ initial: e, receipt: t }) {
href: "/integrations/peach-jav.user.js",
children: "安装 Peach 用户脚本"
}) }),
- /* @__PURE__ */ (0, C.jsxs)("div", { children: [/* @__PURE__ */ (0, C.jsx)(PA, { children: "浏览器添加的下载渠道" }), /* @__PURE__ */ (0, C.jsx)(NF, {
- "aria-label": "浏览器添加的下载渠道",
- selectedKey: i,
- onSelectionChange: (e) => a(String(e)),
- isDisabled: !!c.busy,
- children: n.providers.map((e) => /* @__PURE__ */ (0, C.jsx)(PF, {
- id: e.key,
- textValue: e.label,
- children: /* @__PURE__ */ (0, C.jsx)($A, {
- source: e.key,
- label: e.label
- })
- }, e.key))
- })] }),
+ /* @__PURE__ */ (0, C.jsxs)("div", {
+ className: "flex flex-col gap-1",
+ children: [/* @__PURE__ */ (0, C.jsx)(PA, { children: "浏览器添加的下载渠道" }), /* @__PURE__ */ (0, C.jsx)(NF, {
+ "aria-label": "浏览器添加的下载渠道",
+ selectedKey: i,
+ onSelectionChange: (e) => a(String(e)),
+ isDisabled: !!c.busy,
+ children: n.providers.map((e) => /* @__PURE__ */ (0, C.jsx)(PF, {
+ id: e.key,
+ textValue: e.label,
+ children: /* @__PURE__ */ (0, C.jsx)($A, {
+ source: e.key,
+ label: e.label
+ })
+ }, e.key))
+ })]
+ }),
u ? null : /* @__PURE__ */ (0, C.jsx)(MA, { children: "请先保存所选网盘的账号和目标目录。" }),
/* @__PURE__ */ (0, C.jsx)(bP, {
label: "Peach 地址",