Skip to content

feat: polish settings custom background UI - #14

Merged
irmia2026 merged 3 commits into
mainfrom
refactor/settings-ui-cleanup
Jun 22, 2026
Merged

feat: polish settings custom background UI#14
irmia2026 merged 3 commits into
mainfrom
refactor/settings-ui-cleanup

Conversation

@xiaokangzaina

Copy link
Copy Markdown
Collaborator

Summary

  • Add custom background upload/preset switching support in the settings UI.
  • Convert per-tool toggles into click-to-toggle tool cards while keeping group-level switches.
  • Clean up and consolidate custom-background glass styling into one maintainable CSS layer.
  • Make config rows, contact rows, stat cards, and tool cards consistently ultra-transparent with theme-colored active borders.

Checks

  • syntax_check pages/settings/app.js passed.
  • JS linter unavailable in the local environment, so lint was skipped.

@xiaokangzaina
xiaokangzaina requested a review from irmia2026 as a code owner June 20, 2026 13:02

@irmia2026 irmia2026 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! The canvas blur-crop approach is clever, and the performance optimizations (will-change/contain) are thoughtful. A few issues to address:

🔴 Important

1. Toast 与实际行为矛盾

handleCustomBackgroundUpload 第 318 行 toast:"深色/浅色/自动模式仍可切换"。但 cycleAppearanceModeapplyAppearance 都强制锁定 dark 模式,实际无法切换。建议改为:

showToast("自定义背景已启用(深色模式)");

2. switchToPresetBackground 丢失用户的 appearance 偏好

自定义背景启用时 appearanceMode 被强制改为 "dark"。切回预设后 applyAppearance(appearanceMode) 永远传 "dark",用户之前的 "light""auto" 设置丢失。建议在启用自定义背景前保存原 appearanceMode(如 previousAppearanceMode),切回时恢复。

🟡 Minor

3. prefers-reduced-motion 太激进

当前 * { animation: none !important; transition: none !important; } 影响页面所有元素。建议限定为自定义背景模式下的卡片元素,避免波及其他 UI 组件。

4. refreshThemeControls 被三重调用

applyCustomBackgroundapplyPalette (内部调 refreshThemeControls) → applyAppearance (内部也调) → 末尾再手动调一次。功能正确但可精简。

✅ 做得好的

  • Canvas 双层模糊裁切 + shadow 描边方案很漂亮
  • 12MB 限制 + CUSTOM_BACKGROUND_SIZE 常量化
  • aria-pressed + focus-visible 无障碍处理
  • will-change/contain/translateZ 性能优化到位
  • button:disabled 样式完善

@irmia2026 irmia2026 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiaokangzaina Thanks for the follow-up fix! Re-reviewing 4e68729:

#1 (Toast): Button now properly disabled with title "自定义背景下已锁定深色模式" and label showing "锁定". This correctly communicates that custom backgrounds intentionally lock dark mode — not a bug but a design decision. Toast copy could be updated to match, minor and not a blocker.

#2 (previousAppearanceMode): Now persisted both front-end and back-end. Looks correct.

#3 (reduced-motion): Still suggest scoping to custom-bg cards only — not blocking.

#4 (refreshThemeControls triple call): Now single-called from applyPalette. Clean.

No blockers. Approved.

@irmia2026
irmia2026 merged commit 5f859e2 into main Jun 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants