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

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

View File

@@ -13,19 +13,19 @@ const VALID_THEMES: ThemeName[] = ["light", "dark"];
export const useThemeStore = create<ThemeStore>()(
persist(
(set) => ({
theme: "dark",
theme: "light",
// 写入前校验:非法 theme 直接忽略,防止 syncRemoteUserData 等路径绕过 merge 写入坏值
setTheme: (next) => set((state) => (VALID_THEMES.includes(next) ? { theme: next } : state)),
}),
{
name: "infinite-canvas:theme_store",
// 持久化恢复校验:旧版本/坏 session 写入的非法值回退到 dark,
// 持久化恢复校验:旧版本/坏 session 写入的非法值回退到 light,
// 避免 canvasThemes[非法值] = undefined 触发 "reading 'node'" 崩溃
merge: (persisted, current) => {
const stored = (persisted || {}) as Partial<ThemeStore>;
const theme = VALID_THEMES.includes(stored.theme as ThemeName)
? (stored.theme as ThemeName)
: "dark";
: "light";
return { ...current, theme };
},
},