Repository navigation
删除后台「链接」管理项 + 首页编辑模式补新增链接入口 - #47
Merged
todosdev[bot] merged 2 commits intoNov 8, 2026
Merged
Conversation
- 删除后台「链接」分区与 LinkPanel,LinkEditDialog 保留给首页编辑模式复用 - 新建按全局 MAX+1 提交、POST 后读回完整 DTO 并入 store;空分类的「+」砖兼作拖拽落点 - 顺带修编辑模式砖宽不足、以及弹窗开着按 Esc 连编辑模式一起退出的问题 Checkpoint: xYV_sayjVh-x1OYDUsidJ
…b-70eb-a00b-19eaf0d5b60a # Conflicts: # web/src/components/home-edit-board.tsx
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.
Summary
LinkPanel列表页;后台菜单由 9 项变 8 项,分类、场景、搜索引擎、站点设置、导入导出、安全、系统、关于保持不变。LinkEditDialog的新建态,所属分类已预选,新链接排在该分类末尾。LinkEditDialog保留复用;POST /api/admin/links契约不变(仍只回{id}),未改 worker 与docs/api-contract.md。Changes
后台(
web/src/components/admin/)admin-page.tsx:ADMIN_TABS去掉links,删除<TabsContent value="links">与LinkIcon引入。crud-panels.tsx:删除LinkPanel及只服务它的ALL_CATEGORIES、Select*/SiteIcon等 imports;CategoryPanel不动。link-edit-dialog.tsx:新增必填 proponCreateLink(input) => Promise<AdminLink>,新建分支交给调用方提交(排序号与「读回完整 DTO」由调用方负责),成功后与编辑态共用onSaved。首页编辑模式(
web/src/components/home-edit-board.tsx、public-page.tsx)AddLinkTile:复用linkTileClassName+PLACEHOLDER_CLASS,与同档砖同宽同高、1px 虚线、24px 加号,aria-label/title为向「<分类名>」新增链接;空分类时它同时是cat:<分类Id>拖拽落点(把最后一条拖走后还能拖回来),非空时禁用以免抢标题行的命中。原EmptyDropZone由它取代。HomeEditBoard增加onAddLink;public-page.tsx用creatingCategoryId驱动弹窗新建态与defaultCategoryId。w-full口径对齐);弹窗打开时按 Esc 会连编辑模式一起退出(Radix 先关弹窗、窗口监听随后拿到已清空的 state,改为再看事件目标是否仍在[role="dialog"]内)。数据层(
web/src/lib/)api.ts:adminCreateLink返回类型收成Promise<{id: string}>(对齐冻结契约)、导出CreateLinkInput、新增adminListLinks()。nav-store.ts:新增createLinkOnHome——先settleLinkOrder()等在飞的排序/拖动落库,按全局MAX+1(含待删链接占用的槽位)显式提交sortOrder,POST 后按 id 读回完整 DTO;applyEditedLink更名applySavedLink并支持「不存在则追加」,新建砖因此直接出现在分类末尾。测试
web/test/link-edit-dialog.test.tsx(图标上传/清旧、分类搬家、排序在飞时先 settle、新建走onCreateLink、失败不关窗),承接原LinkPanel承载的弹窗级覆盖。crud-panels.test.tsx(删 LinkPanel 专属用例)、admin-page.test.tsx(8 项菜单)、admin-scenes.test.tsx、nav-store-link-edits.test.ts、public-edit-mode.test.tsx(「+」砖、新建流程、Esc 行为)。Testing
pnpm lint(33 条 warning 均为既有的ui/*与glass.tsx,本次文件零告警)、pnpm format:check、pnpm typecheck、pnpm test、pnpm build全绿;与最新main合并后重跑:worker 13 个文件 214 例、web 28 个文件 322 例全部通过。wrangler dev+ 真实 D1,新库):/#admin侧栏 8 项且无「链接」;编辑模式点某分类末尾「+」→ 弹窗标题「新建链接」、所属分类已预选 → 保存后新砖出现在该分类末尾且服务端sort_order为全局最大+1;再点砖可编辑、点 ✕ 删除有撤销并在 5 秒后落库、跨分类拖动后服务端顺序同步;控制台无报错。+砖与同排砖同宽同高):classic 141.5×130 @1440、80.5×130 @390;compact 236.8×36;wide 397.3×62,均不溢出网格;空分类的「+」砖可点也可投放(拖入后服务端归组与顺序同步)。(
web/dist为构建产物、不入库;本分支未改动 worker 与接口文档。)