feat(web): 用户工作台 - 产品化壳层、内容库布局与积分入口

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ddCat
2026-09-16 22:59:45 +08:00
parent fc5548836f
commit 54f51c44ed
46 changed files with 5355 additions and 944 deletions

View File

@@ -1,18 +1,16 @@
import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { getWorkspaceAntThemeConfig } from "../src/lib/app-theme";
describe("asset library header buttons", () => {
test("only restyles header buttons in light mode and uses outline tokens", () => {
test("user pages share control geometry without a light-only outline override", () => {
const css = readFileSync(resolve(import.meta.dir, "../src/styles/globals.css"), "utf8");
const headerButtonRule = css.match(/html:not\(\.dark\) \.library-page \.app-page-header \.ant-btn,[\s\S]*?transition: all 180ms ease-out !important;\s*}/)?.[0] || "";
const headerButtonHoverRule = css.match(/html:not\(\.dark\) \.library-page \.app-page-header \.ant-btn:hover,[\s\S]*?transform: translateY\(-1px\);\s*}/)?.[0] || "";
expect(headerButtonRule).toContain("html:not(.dark) .canvas-library-page .app-page-header .ant-btn");
expect(headerButtonRule).toContain("background: transparent !important;");
expect(headerButtonRule).toContain("color: var(--foreground) !important;");
expect(headerButtonHoverRule).toContain("background: var(--btn-outline-hover-bg) !important;");
expect(headerButtonHoverRule).toContain("color: var(--foreground) !important;");
expect(css).not.toContain("\n .library-page .app-page-header .ant-btn,\n");
const theme = getWorkspaceAntThemeConfig();
expect(theme.token?.controlHeight).toBe(38);
expect(theme.components?.Button?.borderRadius).toBe(theme.token?.borderRadius);
expect(theme.components?.Button?.defaultBorderColor).toBe("transparent");
expect(css).not.toContain("html:not(.dark) .library-page .app-page-header .ant-btn");
expect(css).not.toContain("html .assets-library-page .app-page-header .assets-header-action-buttons .ant-btn");
});
});