Repository navigation
nav 场景维度·前端实现:场景切换胶囊 + 后台场景管理 + 前后台收口(引用 #16 契约) - #32
Merged
todosdev[bot] merged 4 commits intoNov 6, 2026
Merged
Conversation
前后台共用 nav.scene 偏好,分类/链接按场景过滤,场景可增删改与拖拽排序; 含 mock 场景数据、旧缓存与旧后端兜底,新增前端测试 54 条。 Checkpoint: M-xIApDq2mntWQYtzhHJ3
分类新建显式提交场景内 max+1 的 sortOrder,dev mock 同步按场景取基数;分类/链接保存失败弹错误原文;偏好值读写 trim;排序只重写当前场景的 sortOrder,避免新建序号漂移。 Checkpoint: IujaFTkIxwENDq23fxwuQ
全量视图改用(场景 sortOrder,分类 sortOrder)本地排序,避免场景内序号混排交错;只排序不加分段标题,老缓存无场景时保持原样;补纯函数与页面渲染测试。 Checkpoint: 4-yOKcaxUyf3ADSjypPg0
…c-7d6d-89bb-2e4ccec50704
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
main):服务端返回全量数据,前端只做显示过滤;前后台共用本机偏好nav.scene。变更
web/src/lib/scene-preference.ts、types.ts、api.ts):Zustand 偏好 store(读写 try/catch、trim、storage 事件多标签同步、回落不写回);Scene/AdminScene/sceneId/scenes类型;场景 CRUD 与 reorder 接口、AdminData.scenes(旧后端 404 只退化场景维度,500 照常抛错)。components/scene-switcher.tsx、ui/toggle-group.tsx、public-page.tsx):shadcn/Nova 风格包装 radix-uiToggleGroup(未新增依赖);「全部」段用 LucideLayoutGrid、场景段只显名称、flex-wrap毛玻璃胶囊;老缓存无scenes时按现状平铺。components/admin/scene-panel.tsx、admin-page.tsx、crud-panels.tsx、sortable-list.tsx):场景管理沿用 dnd-kitSortableList;默认场景带「默认」徽标且无删除按钮、删除确认写明移入的默认场景名;分类/链接卡顶部场景胶囊(无「全部」);新建分类带当前sceneId与场景内max+1的sortOrder;保存失败toast.error且弹窗不关闭。nav-store.ts):新增场景排序;分类排序按场景作用域(只重写本次提交项、失败快照同作用域),避免本地sortOrder与服务端漂移。mockDb.ts、index.css):mock 补齐场景、旧 mock 库回填、场景内序号;新增选中胶囊的玻璃 token(复用既有--glass-*)。测试
pnpm test:worker 177 + web 204 全过(合并origin/main后重跑)。pnpm typecheck、pnpm lint(exit 0;30 条既有useImportType警告位于web/src/components/ui/*)、pnpm format:check、pnpm build全部通过。backdrop-filter: blur(16px);场景增删改/过滤/链接分类下拉均符合契约;「全部」在分类sortOrder交错时仍按场景顺序分组;单场景安装不渲染胶囊;console error 0。真实后端形状以已合并的 ONE-448: 主题切换生效(settings.theme 三档 + system 跟随) #17 端点为准(mock 仅用于联调)。