Peach: Local-first video metadata scraper and media manager.
fix(ui): 媒体库图标选择器只放图标,一行七个
longmeidaoa5ea2cd48caa
diff --git a/frontend/src/library-icon-picker.tsx b/frontend/src/library-icon-picker.tsxindex e621f5467..2b34a8dfb 100644--- a/frontend/src/library-icon-picker.tsx+++ b/frontend/src/library-icon-picker.tsx@@ -19,8 +19,9 @@ export function LibraryIconPicker({value,label,onChange}:{value:string;label:strreturn <div class="board-icon-picker"><button ref={trigger} type="button" class="geist-button board-icon-trigger" aria-label={label} aria-haspopup="dialog" onClick={open}>{glyph(value)}<span>{LIBRARY_ICON_CHOICES.find(([key])=>key===value)?.[1]||'自动识别'}</span></button><dialog ref={popup} class="board-icon-popover" aria-label={`${label}候选`} onCancel={()=>setDraft(value)} onClick={event=>{if(event.target===popup.current){popup.current?.close();setDraft(value)}}}>+ {/* 格子里只放图标:名字走 title 与 aria-label。21 个候选带着字要排六行,面板比触发它的设置卡还高。 */}<div class="board-icon-panel"><h3>选择媒体库图标</h3><div role="radiogroup" aria-label="候选图标" class="board-icon-grid">- {LIBRARY_ICON_CHOICES.map(([key,name])=><label title={name} class={draft===key?'selected':''}><input type="radio" name={`${label}-icon`} aria-label={name} value={key} checked={draft===key} onChange={()=>setDraft(key)}/>{glyph(key)}<small>{name}</small></label>)}+ {LIBRARY_ICON_CHOICES.map(([key,name])=><label title={name} class={draft===key?'selected':''}><input type="radio" name={`${label}-icon`} aria-label={name} value={key} checked={draft===key} onChange={()=>setDraft(key)}/>{glyph(key)}</label>)}</div></div><footer><button type="button" class="geist-button" onClick={()=>{setDraft(value);popup.current!.close()}}>取消</button><button type="button" class="geist-button primary" disabled={draft===value} onClick={()=>{onChange(draft);popup.current!.close()}}>应用</button></footer></dialog>diff --git a/frontend/test/library-icon-picker.test.tsx b/frontend/test/library-icon-picker.test.tsxindex c6b6d8b0b..db369757f 100644--- a/frontend/test/library-icon-picker.test.tsx+++ b/frontend/test/library-icon-picker.test.tsx@@ -10,6 +10,9 @@ it('候选图标不包含网盘,取消保持原值,应用才提交草稿',asawait act(async()=>render(h(LibraryIconPicker,{label:'媒体库图标',value:'heart',onChange:change}),root));const dialog=root.querySelector('dialog')!;dialog.showModal=()=>dialog.setAttribute('open','');dialog.close=()=>dialog.removeAttribute('open');await act(async()=>root.querySelector<HTMLButtonElement>('.board-icon-trigger')!.click());+ // 格子只有图标,名字留在 title 与 aria-label 上。+ expect(root.querySelector('.board-icon-grid small')).toBeNull();+ expect(root.querySelector<HTMLLabelElement>('.board-icon-grid label[title=樱桃]')!.querySelector('input')!.getAttribute('aria-label')).toBe('樱桃');await act(async()=>root.querySelector<HTMLInputElement>('input[value=cherry]')!.click());expect(change).not.toHaveBeenCalled();await act(async()=>root.querySelector<HTMLButtonElement>('footer button')!.click());diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex b6401f24a..d40c951a0 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -5362,6 +5362,21 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("plus.onclick=()=>{presentMenu(picker);")self.assertPageLacks("$('#searchMenu').hidden=true")+ def test_the_library_icon_picker_is_a_grid_of_glyphs(self):+ """媒体库图标选择器的格子只放图标,一行七个,21 个候选三行排完。++ 每格 40px、图标 22px;名字留在 title 与 aria-label 上。带着字排四列要六行,+ 面板比触发它的设置卡还高,用户回执「不需要图标下面的文字」「高度太长了」。+ """+ board = (Path(__file__).resolve().parents[1] / "web/board.css").read_text(encoding="utf-8")+ self.assertIn(".board-icon-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}", board)+ self.assertIn(".board-icon-grid label{position:relative;display:grid;place-items:center;height:40px;border-radius:8px;cursor:pointer}", board)+ self.assertIn(".board-icon-grid svg{width:22px;height:22px}", board)+ self.assertNotIn(".board-icon-grid small", board)+ picker = (Path(__file__).resolve().parents[1] / "frontend/src/library-icon-picker.tsx").read_text(encoding="utf-8")+ self.assertNotIn("<small>{name}</small>", picker)+ self.assertIn("<label title={name} class={draft===key?'selected':''}>", picker)+def test_toasts_leave_like_a_boardui_notification(self):"""Board 层的 Toast 退场按 Notification 的 exit:180ms ease-out,下沉 8px、缩到 .96、模糊 3px。高度收成 0 留着,栈里上面那条才是滑下来而不是跳下来。"""diff --git a/web/board.css b/web/board.cssindex c5dacd198..030820349 100644--- a/web/board.css+++ b/web/board.css@@ -594,7 +594,7 @@ body [data-board-tabs] button[aria-selected=true],body .managebar [data-board-ta.splitbutton.board-button-group>.splittoggle::before{width:1px;left:0;top:6px;bottom:6px;background:var(--color-border-button-default)}body [data-cleanup-empty][hidden]{display:none}dialog.board-icon-popover{position:fixed;inset:auto;margin:0;width:min(360px,calc(100vw - 16px));max-height:calc(100dvh - 16px);box-sizing:border-box;padding:8px;border:0;border-radius:24px;background:var(--color-background-secondary-default);color:var(--ink);box-shadow:0 12px 40px #00000024;overflow:auto}-.board-icon-popover::backdrop{background:transparent}.board-icon-panel{padding:16px;border-radius:20px;background:var(--color-background-primary-default);box-shadow:0 1px 2px #0000000d}.board-icon-panel h3{font:var(--board-body-medium);margin:0 0 16px}.board-icon-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}.board-icon-grid label{position:relative;display:grid;justify-items:center;gap:4px;padding:8px 2px;border-radius:8px;cursor:pointer}.board-icon-grid label:hover{background:var(--color-background-primary-hover)}.board-icon-grid label.selected{background:var(--picked);color:var(--tungsten)}.board-icon-grid input{position:absolute;opacity:0;width:1px;height:1px}.board-icon-grid label:focus-within{outline:2px solid var(--tungsten)}.board-icon-grid svg{width:24px;height:24px}.board-icon-grid small{font-size:10px;white-space:nowrap}.board-icon-popover footer{display:flex;justify-content:flex-end;gap:8px;padding:12px 8px 4px}+.board-icon-popover::backdrop{background:transparent}.board-icon-panel{padding:12px;border-radius:20px;background:var(--color-background-primary-default);box-shadow:0 1px 2px #0000000d}.board-icon-panel h3{font:var(--board-body-medium);margin:0 0 10px;padding:0 4px}.board-icon-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}.board-icon-grid label{position:relative;display:grid;place-items:center;height:40px;border-radius:8px;cursor:pointer}.board-icon-grid label:hover{background:var(--color-background-primary-hover)}.board-icon-grid label.selected{background:var(--picked);color:var(--tungsten)}.board-icon-grid input{position:absolute;opacity:0;width:1px;height:1px}.board-icon-grid label:focus-within{outline:2px solid var(--tungsten)}.board-icon-grid svg{width:22px;height:22px}.board-icon-popover footer{display:flex;justify-content:flex-end;gap:8px;padding:8px 4px 0}.reviewitem .reviewstage[data-framed]{padding:0;border:0;background:transparent;box-shadow:none}.reviewitem .reviewtags{min-height:28px;align-content:start}.reviewitem .reviewempty{min-height:160px;max-height:190px;border-radius:12px;background:var(--color-background-secondary-default)}.reviewitem .reviewstage{flex:0 0 auto}.reviewitem .reviewevidence{border:0;padding:12px 0 0}.reviewitem .reviewactions{border:0;border-radius:0 0 16px 16px;background:var(--color-background-secondary-default);margin-top:auto}.reviewitem{content-visibility:auto;contain-intrinsic-size:auto var(--review-fieldset-height)}body .reviewactions button,body .junkactions button:not(.danger){height:36px;border:1px solid var(--color-border-button-default);border-radius:10px;padding:8px 12px;background:var(--color-background-primary-default);color:var(--ink);box-shadow:0 1px 2px #0000000d;font:var(--board-body-medium)}diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.jsindex 1f0c7ed72..efbd62403 100644--- a/web/dist/peach-ui.js+++ b/web/dist/peach-ui.js@@ -2457,18 +2457,14 @@ function Pn({ value: e, label: t, onChange: n }) {children: Nn.map(([e, n]) => /* @__PURE__ */ J("label", {title: n,class: r === e ? "selected" : "",- children: [- /* @__PURE__ */ J("input", {- type: "radio",- name: `${t}-icon`,- "aria-label": n,- value: e,- checked: r === e,- onChange: () => i(e)- }),- s(e),- /* @__PURE__ */ J("small", { children: n })- ]+ children: [/* @__PURE__ */ J("input", {+ type: "radio",+ name: `${t}-icon`,+ "aria-label": n,+ value: e,+ checked: r === e,+ onChange: () => i(e)+ }), s(e)]}))})]}), /* @__PURE__ */ J("footer", { children: [/* @__PURE__ */ J("button", {