Repository navigation
站点设置「列数」生效 + 非 classic 时隐藏列数字段 - #48
Merged
todosdev[bot] merged 2 commits intoNov 8, 2026
Merged
Conversation
classic 桌面列数取站点设置(1–12 设几是几,0/未配置保持原默认梯度), 窄屏按固定静态阶梯递减;普通模式与编辑模式共用 linkGridClassName。 后台在 compact/wide 下隐藏列数输入框,值保留、切回 classic 回显。 Checkpoint: zGcWif30ddQdDmCD7DTj5
…9-73cd-92dd-7316e7048060 # 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
docs/api-contract.md零改动。Changes
列数取值(新增
web/src/lib/grid-columns.ts)resolveColumns(columns?)+DEFAULT_COLUMNS = 8:1–12 原样生效,0/缺失/非整数/越界一律回默认 8,与linkStyle、showUrl同一套读侧兜底口径。网格排法(
web/src/components/link-grid.tsx)CLASSIC_GRID_BY_COLUMNS:12 行字面静态类名(grid-cols-N与sm:md:lg:xl:变体),不出现grid-cols-${n}拼接;第 8 行与改动前的默认梯度逐字一致。linkGridClassName(linkStyle, columns);LINK_GRID_CLASS.classic指向默认梯度那一行,compact/wide 保持原样并忽略columns。LinkGrid、CategorySection增加columns透传。普通 / 编辑模式同源
web/src/components/home-edit-board.tsx:HomeEditBoard增加columns,网格容器改走linkGridClassName;nav 场景可见性·后端实现:schema_v3 迁移 + visibility DTO 过滤 + 默认强制公开校验(引用合并规格) #33 新增的「+」砖在同一网格内,自动跟随列数。web/src/components/public-page.tsx:resolveColumns(settings?.columns)解析一次,分别传给CategorySection与HomeEditBoard。后台表单(
web/src/components/admin/settings-panels.tsx)form.linkStyle === "classic"条件渲染,非 classic 时不渲染、不加说明文字;form.columns始终留在表单里,保存照旧整包提交。测试
web/test/grid-columns.test.ts(边界与脏值兜底)。link-grid(5 / 1 / 12 / 0 梯度、compact/wide 隔离、透传)、settings-panels(隐藏 / 切回回显 / compact 下仍提交原列数)、public-page(columns=5、0、compact 组合)、public-edit-mode(编辑模式同列数)各补用例。梯度(桌面列数 → 手机 / sm / md / lg / xl):1→1/1/1/1/1,3→2/2/3/3/3,5→2/2/3/4/5,8→4/5/6/7/8,9→4/6/7/8/9,12→4/6/8/10/12;lg 封顶 10、md ≤8、sm ≤6、base ≤4,任何一档不超过上一档。
Testing
pnpm lint(退出码 0,改动文件零告警)、pnpm format:check(无差异)、pnpm typecheck(web / worker 均 0 错误)、pnpm test(web 29 套 337 项、worker 13 套 214 项全过)、pnpm build(web + worker 成功)。build:web+wrangler dev+ 真实 D1,量grid-template-columns轨道数):columns仍为 5;切回 classic 回显 5;直接在输入框敲 0 保存 → 后端 0、首页回到 8 列。grid-cols-*规则全部生成,确认无动态类名被 Tailwind 漏扫。web/dist;web/public/icon-index.json会在本地构建时重生成,本 PR 已还原、不含该文件的变更。