Skip to content

armgit / peach

Public Imported from GitHub
0

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

fix(ui): 统一配置字段组间距与底部操作

longmeidao619d01b63ab8
diff --git a/frontend/src/islands/access-settings.tsx b/frontend/src/islands/access-settings.tsx
index 0f1f30fd4..9e3634904 100644
--- a/frontend/src/islands/access-settings.tsx
+++ b/frontend/src/islands/access-settings.tsx
@@ -62,8 +62,10 @@ export function AccessSettings({ initial, receipt }: { initial: AccessState; rec
};
return <form class="configfieldset" onSubmit={submit} aria-labelledby="accessTitle" noValidate ref={form}>
<div class="geist-fieldset-content">
+ <div class="configfieldset-heading">
<div dangerouslySetInnerHTML={{ __html: fieldsetTitle('accessTitle', '访问密码') }} />
<p class="confighelp">{state.mode === 'open' ? '未设置密码,能连接到 Peach 的设备可直接访问。' : state.mode === 'legacy' ? '当前使用系统生成的访问口令。你可以设置自己的密码,或关闭登录要求。' : state.mode === 'locked' ? '访问设置无法读取,请在本机检查配置文件。' : '已设置密码。新设备需要登录,保持登录时间在登录页选择。'}</p>
+ </div>
{state.mode === 'password' ? <PasswordField id="access-current" label="当前访问密码" value={current} onInput={setCurrent} error={fields.current_password} current /> : null}
{!disable && state.mode !== 'locked' ? <>
<PasswordField id="access-password" label={state.mode === 'password' ? '新访问密码' : '设置访问密码'} value={password} onInput={setPassword} error={fields.password} help="至少 8 个字符。保存后其他设备需要重新登录。" />
diff --git a/frontend/src/islands/configuration.tsx b/frontend/src/islands/configuration.tsx
index 6c225a63e..64b5d8da6 100644
--- a/frontend/src/islands/configuration.tsx
+++ b/frontend/src/islands/configuration.tsx
@@ -116,6 +116,7 @@ function MountStatus({ data }: { data: ConfigurationData }) {
<Html html={fieldsetTitle('configMountsTitle', '挂载状态')} />
<dl class="configfacts">{sources.map((row) => <><dt><span aria-hidden="true" dangerouslySetInnerHTML={{__html:selectOptionIconHtml(MEDIA_SOURCE_ICONS[row.location])}} />{({local: '本地磁盘', '115': 'CloudDrive · 115', pikpak: 'CloudDrive · PikPak'} as Record<string, string>)[row.location] || row.location}</dt><dd>{row.path || '未配置挂载点'} <span class={`configstatus ${row.online === true ? 'online' : row.online === false ? 'offline' : 'unknown'}`}>{row.online === true ? '在线' : row.online === false ? '离线' : '未检测'}</span></dd></>)}</dl>
{error ? <p class="configbad" role="alert">{error}</p> : null}
+ </div><div class="geist-fieldset-footer" data-geist-fieldset-footer>
<button type="button" class="geist-button" onClick={(event) => refresh(event.currentTarget)}>刷新挂载状态</button>
</div></section>;
}
diff --git a/frontend/test/access-settings.test.tsx b/frontend/test/access-settings.test.tsx
index 5f7fe574f..8d4f7a718 100644
--- a/frontend/test/access-settings.test.tsx
+++ b/frontend/test/access-settings.test.tsx
@@ -40,6 +40,8 @@ it('长度提示紧贴字段且提交不合法内容时变为字段错误', asyn
const host = document.createElement('div'); document.body.append(host);
const fetcher = vi.fn(); vi.stubGlobal('fetch', fetcher);
render(<AccessSettings initial={{ mode: 'open', revision: 'one' }} receipt={vi.fn()} />, host);
+ expect(host.querySelector('.configfieldset-heading #accessTitle')).not.toBeNull();
+ expect(host.querySelector('.configfieldset-heading > .confighelp')?.textContent).toContain('未设置密码');
const field = host.querySelector<HTMLInputElement>('#access-password')!;
expect(field.nextElementSibling?.textContent).toContain('至少 8 个字符');
host.querySelector('form')!.dispatchEvent(new Event('submit', { cancelable: true })); await settle();
diff --git a/frontend/test/configuration.test.tsx b/frontend/test/configuration.test.tsx
index 7f1f9cfb6..ba1bafae3 100644
--- a/frontend/test/configuration.test.tsx
+++ b/frontend/test/configuration.test.tsx
@@ -64,6 +64,7 @@ it('缺失依赖提供带图标的新窗口下载链接且已安装依赖不提
expect(link?.querySelector('use')?.getAttribute('href')).toBe('#i-external-link');
}
expect(el.textContent).not.toContain('下载 WinFsp');
+ expect(el.querySelector('[aria-labelledby="configMountsTitle"] > .geist-fieldset-footer button')?.textContent).toBe('刷新挂载状态');
});
describe('配置页取数', () => {
diff --git a/web/css/23-configuration.css b/web/css/23-configuration.css
index 4162d85a2..cf0be4f74 100644
--- a/web/css/23-configuration.css
+++ b/web/css/23-configuration.css
@@ -6,8 +6,10 @@
.configpage .geist-button{min-height:var(--control-h)}
.configfieldset{display:flex;flex-direction:column;min-width:0;margin:0;padding:0;overflow:hidden;
border:1px solid var(--line);border-radius:var(--control-radius);background:var(--ground)}
-.configfieldset>.geist-fieldset-content{flex:1;min-height:0;padding:20px;display:grid;gap:24px}
+.configfieldset>.geist-fieldset-content{flex:1;min-height:0;padding:20px;display:grid;gap:20px}
.configfieldset .geist-fieldset-title{margin:0}
+.configfieldset-heading{display:grid;gap:8px}
+.configfieldset-heading>.confighelp{margin:0}
.configfieldset>.geist-fieldset-footer{box-sizing:border-box;min-height:var(--fieldset-bar-h);
margin:0;padding:8px 16px 8px 20px;display:flex;align-items:center;justify-content:flex-end;gap:8px;
border-top:1px solid var(--line);background:var(--surface)}
diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.js
index e5d54a178..a9afd2ac3 100644
--- a/web/dist/peach-ui.js
+++ b/web/dist/peach-ui.js
@@ -532,10 +532,12 @@ function qe({ initial: e, receipt: t }) {
children: [/* @__PURE__ */ W("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: n("accessTitle", "访问密码") } }),
- /* @__PURE__ */ W("p", {
- class: "confighelp",
- children: r.mode === "open" ? "未设置密码,能连接到 Peach 的设备可直接访问。" : r.mode === "legacy" ? "当前使用系统生成的访问口令。你可以设置自己的密码,或关闭登录要求。" : r.mode === "locked" ? "访问设置无法读取,请在本机检查配置文件。" : "已设置密码。新设备需要登录,保持登录时间在登录页选择。"
+ /* @__PURE__ */ W("div", {
+ class: "configfieldset-heading",
+ children: [/* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: n("accessTitle", "访问密码") } }), /* @__PURE__ */ W("p", {
+ class: "confighelp",
+ children: r.mode === "open" ? "未设置密码,能连接到 Peach 的设备可直接访问。" : r.mode === "legacy" ? "当前使用系统生成的访问口令。你可以设置自己的密码,或关闭登录要求。" : r.mode === "locked" ? "访问设置无法读取,请在本机检查配置文件。" : "已设置密码。新设备需要登录,保持登录时间在登录页选择。"
+ })]
}),
r.mode === "password" ? /* @__PURE__ */ W(Ke, {
id: "access-current",
@@ -644,7 +646,7 @@ function et({ data: t }) {
return r ? /* @__PURE__ */ W("section", {
class: "configfieldset",
"aria-labelledby": "configMountsTitle",
- children: /* @__PURE__ */ W("div", {
+ children: [/* @__PURE__ */ W("div", {
class: "geist-fieldset-content",
children: [
/* @__PURE__ */ W(G, { html: n("configMountsTitle", "挂载状态") }),
@@ -670,15 +672,18 @@ function et({ data: t }) {
class: "configbad",
role: "alert",
children: s
- }) : null,
- /* @__PURE__ */ W("button", {
- type: "button",
- class: "geist-button",
- onClick: (e) => u(e.currentTarget),
- children: "刷新挂载状态"
- })
+ }) : null
]
- })
+ }), /* @__PURE__ */ W("div", {
+ class: "geist-fieldset-footer",
+ "data-geist-fieldset-footer": !0,
+ children: /* @__PURE__ */ W("button", {
+ type: "button",
+ class: "geist-button",
+ onClick: (e) => u(e.currentTarget),
+ children: "刷新挂载状态"
+ })
+ })]
}) : null;
}
function tt({ value: t, label: n, onChange: r }) {