Skip to content

armgit / peach

Public Imported from GitHub
0

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

fix(web): 移除文件夹那颗键接进唯一的危险档

longmeidao3dc592a48a16
diff --git a/frontend/src/islands/configuration.tsx b/frontend/src/islands/configuration.tsx
index 696b44a39..ce1882228 100644
--- a/frontend/src/islands/configuration.tsx
+++ b/frontend/src/islands/configuration.tsx
@@ -285,7 +285,7 @@ function ConfigurationForm({ data, receipt }: { data: ConfigurationData; receipt
<svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-folder-search" /></svg>
</button>
{dirs.length > 1 ? (
- <button type="button" class="geist-button configrm" aria-label="移除这个文件夹" onClick={() => remove(index)}>
+ <button type="button" class="geist-button configrm danger" aria-label="移除这个文件夹" onClick={() => remove(index)}>
<svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-x" /></svg>
</button>
) : null}
diff --git a/tests/test_frontend_build.py b/tests/test_frontend_build.py
index a9c355be0..6e0486625 100644
--- a/tests/test_frontend_build.py
+++ b/tests/test_frontend_build.py
@@ -201,7 +201,7 @@ class ConfigurationIslandContractTests(unittest.TestCase):
self.assertIn("PICK_FOLDER_URL = '/api/pick-folder'", self.source)
pick = self.source.index('class="geist-button configpick"')
self.assertLess(self.source.index('class="geist-input"'), pick)
- self.assertLess(pick, self.source.index('class="geist-button configrm"'))
+ self.assertLess(pick, self.source.index('class="geist-button configrm danger"'))
def test_validation_reasons_come_from_the_server(self):
"""字段级原因读 400 的 `errors`,前端不复制一份路径与端口的判定。"""
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 3112951ae..b0669aa03 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -6367,6 +6367,24 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("const paint=(id,now)=>{if(stopped||id!==run)return;")
self.assertPageLacks("scheduled=false")
+ def test_the_folder_row_takes_its_red_from_the_single_danger_tier(self):
+ """「移除这个文件夹」的红只有 01-base 那一份,静止与悬停必须是两个值。
+
+ 这颗键曾在页面 CSS 末尾被追加过一条静止态实底红,却没有同步同文件里的悬停规则:
+ 两条渲染出来是同一块 `--drop` 加白字,鼠标压上去一点变化都没有。同一颗键的两个
+ 状态分写在两处、值又相同,是这类缺陷的固定形状——所以红收回 `.danger`,页面只
+ 留几何。`border-color` 在 `border:0` 之后也是死声明,一并收掉。
+ """
+ # 标记本身在 island 包里,由 test_frontend_build 的岛屿产物断言守;这里只管样式。
+ self.assertPageContains(".configrm.geist-button,.configpick.geist-button"
+ "{width:var(--control-h);height:var(--control-h);flex:none;padding:0}")
+ self.assertPageContains(".configpick.geist-button{color:var(--muted)}")
+ css = stylesheet_source()
+ for stale in (".configrm.geist-button{color:var(--drop)}",
+ ".configrm.geist-button:hover:not(:disabled){",
+ ".configrm.geist-button:not(:disabled){"):
+ self.assertNotIn(stale, css, "移除键的红不在页面里自己写第二份")
+
def test_the_whole_detail_box_takes_one_ambient_tone(self):
"""右侧详情栏和「接着看」是同一格详情的两块,底色必须同源。
@@ -7574,7 +7592,9 @@ class WebUiSourceTests(unittest.TestCase):
只描红边、红字的话,静止态和悬停态在暗色底上几乎一样亮,按下去之前看不出这是
不可逆动作。Geist 的 error Button 就是实心红填充(实测 `rgb(217,48,54)` 底、白字),
静止态即红;Peach 按用户 2026-09-06 的取舍跟它走,悬停只把同一块红压深一档。
- 纯图标删除键不在此列——它们靠图标本身说明动作,实底红会在一行图标里炸出一块。
+ 挤在一行图标里的删除键(`.frowicon` 那一类)不在此列:一块实底红在图标行里会炸出
+ 一块。判据是这一行里还有几颗销毁键,不是键上有没有文字——配置页「移除这个文件夹」
+ 同样只有一枚叉,可它旁边只有一颗「选择文件夹」,所以它走实底红。
"""
self.assertPageContains("button.danger:not(.frowicon),.resourcedanger{")
self.assertPageContains("background:var(--drop);color:#fff;box-shadow:none}")
diff --git a/web/css/23-configuration.css b/web/css/23-configuration.css
index d0325dbfa..227081ea5 100644
--- a/web/css/23-configuration.css
+++ b/web/css/23-configuration.css
@@ -51,10 +51,13 @@
.configdir .geist-input{flex:1 1 auto;width:auto;min-width:0}
.configdir > input.geist-input{flex:1 1 0;width:0}
.configdir:first-child{margin-top:0}.configdir .configbad{flex-basis:100%;margin:0}
-.configrm.geist-button,.configpick.geist-button{width:var(--control-h);height:var(--control-h);flex:none;padding:0;color:var(--muted)}
+/* 移除是这一行唯一的销毁键,走 01-base 那一份危险档:静止就是实底红,悬停把同一块红
+ 压深一档。它和 `.frowicon` 那种挤在一行图标里的删除键不是一件事——那里一块实底红会
+ 在图标行里炸出一块,这一行里它旁边只有一颗「选择文件夹」。红由 `.danger` 给,页面
+ 不再自己写第二份:此前静止态和悬停态各写一条、值又一样,悬停等于没有反馈。 */
+.configrm.geist-button,.configpick.geist-button{width:var(--control-h);height:var(--control-h);flex:none;padding:0}
+.configpick.geist-button{color:var(--muted)}
.configpick.geist-button:hover:not(:disabled){color:var(--ink)}
-.configrm.geist-button{color:var(--drop)}
-.configrm.geist-button:hover:not(:disabled){color:white;background:var(--drop);border-color:var(--drop)}
.configstatus{display:inline-block;margin-inline-start:8px;font-size:var(--fs-sm)}
.configstatus.online{color:var(--success)}.configstatus.offline{color:var(--drop)}.configstatus.unknown{color:var(--muted)}
.configrm svg,.configpick svg{width:16px;height:16px;stroke:currentColor;fill:none}
@@ -86,5 +89,3 @@
.configfacts dt .gselectmark{vertical-align:-3px;margin-inline-end:8px}
@media(max-width:560px){.configfacts{grid-template-columns:minmax(0,1fr)}.configfacts dd{margin-top:-6px}}
@media(max-width:560px){.configpage{--control-h:44px}.configfieldset>.geist-fieldset-footer{flex-wrap:wrap}.configsource .geist-input{font-size:var(--fs-lg)}}
-
-.configrm.geist-button:not(:disabled){color:#fff;background:var(--drop);border-color:var(--drop)}
diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.js
index 9d17729b6..2089dac2c 100644
--- a/web/dist/peach-ui.js
+++ b/web/dist/peach-ui.js
@@ -1433,7 +1433,7 @@ function bt({ data: e, receipt: t }) {
}),
r.length > 1 ? /* @__PURE__ */ J("button", {
type: "button",
- class: "geist-button configrm",
+ class: "geist-button configrm danger",
"aria-label": "移除这个文件夹",
onClick: () => ee(n),
children: /* @__PURE__ */ J("svg", {