Skip to content

armgit / peach

Public Imported from GitHub
0

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

fix(web): 人物名册骨架页签用 sprite 里有的 user-round 字形

longmeidaoda278703917b
diff --git a/frontend/src/index-skeleton.ts b/frontend/src/index-skeleton.ts
index 55b3319f1..3f7998c0c 100644
--- a/frontend/src/index-skeleton.ts
+++ b/frontend/src/index-skeleton.ts
@@ -32,7 +32,7 @@ const PEOPLE_LAYOUTS =[['big', '大图 · 竖幅头像', 'maximize'], ['compact'
const COMPANY_LAYOUTS = [['big', '大图 · 完整标识', 'maximize'], ['compact', '紧凑 · 圆形标识', 'layout-grid']] as const;
const MAKER_INDEX_KINDS = [['studios', '厂牌', 'clapperboard'], ['agencies', '事务所', 'briefcase']] as const;
const INDEX_SCOPES = [['local', '本地', 'hard-drive'], ['online', '在线', 'rss']] as const;
-const PEOPLE_INDEX_TABS = [['performers', '艺人', 'user'], ['creators', '卖家', 'user'], ['online', '在线', 'rss']] as const;
+const PEOPLE_INDEX_TABS = [['performers', '艺人', 'user-round'], ['creators', '卖家', 'user-round'], ['online', '在线', 'rss']] as const;
const TAG_VIEWS = [['cloud', '标签云', 'tags'], ['alphabet', '字母表', 'text-aa']] as const;
/** 存着的版式偏好,认不出的回到大图。 */
diff --git a/frontend/test/index-skeleton.test.ts b/frontend/test/index-skeleton.test.ts
new file mode 100644
index 000000000..46e4ec68d
--- /dev/null
+++ b/frontend/test/index-skeleton.test.ts
@@ -0,0 +1,28 @@
+/* 索引五页的进页骨架。
+ *
+ * 骨架里的字形走壳 `index.html` 那张 sprite(`<use href="#i-…">`),写了表里没有的名字不会报错,
+ * 只是那一格空着:页签上「艺人」「卖家」写成 `user` 时,骨架里只剩「在线」带图标。 */
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
+
+import { expect, it } from 'vitest';
+
+import { indexParams, indexPlaceholderHtml, type IndexPageKind } from '../src/index-skeleton';
+
+const sprite = new Set(
+ [...readFileSync(resolve(__dirname, '../../web/index.html'), 'utf8').matchAll(/<symbol id="i-([^"]+)"/g)]
+ .map((match) => match[1]));
+
+const PAGES: [IndexPageKind, string][] = [
+ ['performers', ''], ['performers', '?scope=online'], ['creators', ''],
+ ['studios', ''], ['agencies', ''], ['tags', ''], ['tags', '?scope=online&view=cloud'],
+];
+
+it.each(PAGES)('%s%s 骨架里的每个字形都在 sprite 里', (kind, search) => {
+ for (const layout of ['big', 'compact'] as const) {
+ const html = indexPlaceholderHtml(indexParams(kind, search), layout);
+ const used = [...html.matchAll(/href="#i-([^"]+)"/g)].map((match) => match[1]);
+ expect(used.length).toBeGreaterThan(0);
+ expect(used.filter((name) => !sprite.has(name))).toEqual([]);
+ }
+});
diff --git a/web/dist/peach-react.js b/web/dist/peach-react.js
index 39f37045c..796af9eb1 100644
--- a/web/dist/peach-react.js
+++ b/web/dist/peach-react.js
@@ -82761,12 +82761,12 @@ var YQe = {
[
"performers",
"艺人",
- "user"
+ "user-round"
],
[
"creators",
"卖家",
- "user"
+ "user-round"
],
[
"online",
diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.js
index 812dfefd7..1a093bc18 100644
--- a/web/dist/peach-ui.js
+++ b/web/dist/peach-ui.js
@@ -4635,12 +4635,12 @@ var gs = {
[
"performers",
"艺人",
- "user"
+ "user-round"
],
[
"creators",
"卖家",
- "user"
+ "user-round"
],
[
"online",