Skip to content

feat(style-pack): rework UI + 模板新建 + 清理 PR #429 遗留死代码#435

Merged
appergb merged 3 commits into
betafrom
feat/style-pack-ui-refresh
May 14, 2026
Merged

feat(style-pack): rework UI + 模板新建 + 清理 PR #429 遗留死代码#435
appergb merged 3 commits into
betafrom
feat/style-pack-ui-refresh

Conversation

@appergb
Copy link
Copy Markdown
Collaborator

@appergb appergb commented May 14, 2026

User description

Summary

PR #429 (Cooper-X-Oak) 引入的 style pack store v1 在用户视角下有多处 UX 问题。这个 PR 系统化重做交互:

UI 重构(Style.tsx)

  • 「原文」从 body 卡片改成标题旁的 pill 切换器,跟其他 builtin 卡视觉分离
  • body 卡片按 light → structured → formal 排序;imported 紧随其后;「+ 新建风格包」固定网格末位
  • imported 卡片右上角换成红色 trash 删除按钮;builtin 显示装饰 sparkle 图标,无 delete
  • builtin 卡片背景灰底处理;编辑按钮 disabled;只读
  • 编辑按钮移到底部,紧贴「导出」右边
  • 删除「轮换 ON/OFF」按钮(卡片 + 编辑面板 + metaStatus 全套清理)
  • 死代码清理:Settings.tsx 里 PR feat: add style pack store v1 #429 留下的「润色 System Prompt 已迁移」告示卡 + 11 个 i18n key 跨 5 语言

模板创建路径(后端)

  • persistence.rs::StylePackStore::create_from_template —— 给「+」按钮一个非 ZIP 的纯模板新建入口
  • 新 IPC create_style_pack_from_template,前端 createStylePackFromTemplate wrapper

编辑面板动画

  • ol-modal-backdrop-out + ol-modal-drawer-out 两个出场 keyframe
  • editorClosing state + 200ms 卸载延迟,关闭时背景模糊平滑淡出

视觉一致性

  • SavedToast 统一替换 inline notice/error banner
  • 编辑面板 backdrop 视觉对齐 SettingsModal 标准(rgba(15,17,22,0.32) + blur(8px) saturate(140%)
  • 关闭按钮规格对齐 SettingsModal(28×28 round-999 no-border)

规划文档

  • docs/style-pack-marketplace.md:风格包市场 v1 完整 spec(HTTP API、IPC 契约、DTO、鉴权、缓存、安全、TODO 列表、决策记录)

Test plan

  • 切换激活不同 builtin 包,确认蓝边/光圈瞬时切换无抖动
  • 点「+ 新建风格包」→ 进入编辑器 → 修改名字/prompt → 保存 → 再次点 ✓ 激活
  • 在 imported 卡右上角点红色 trash → 确认 → 包消失
  • 原文 pill 旁出现「·当前」字样当 active
  • builtin 卡的编辑按钮灰显不可点
  • 设置 → 提供商页:LLM 卡和 ASR 卡之间无空白「润色 System Prompt 已迁移」卡
  • 编辑面板打开 backdrop 平滑淡入、关闭平滑淡出(不再硬切)
  • CI 三平台 build 绿

PR Type

Enhancement, Bug fix, Tests, Documentation


Description

  • Add blank-template style pack creation

  • Refresh Style page pack management UI

    • Remove rotation controls and status
    • Add template tile and saved toast
    • Smooth editor enter/exit animations
  • Wire template creation through IPC

    • Persist new packs in StylePackStore
    • Register command in Tauri runtime
  • Update locales, docs, tests, versions


Diagram Walkthrough

flowchart LR
  UI["Style management screen"] -- "creates from template" --> IPC["Tauri IPC command"]
  IPC["create_style_pack_from_template"] -- "persists pack" --> STORE["StylePackStore persistence"]
  STORE -- "reloads packs" --> UI
  UI -- "shows feedback" --> TOAST["SavedToast and modal animations"]
Loading

File Walkthrough

Relevant files
Enhancement
7 files
commands.rs
Add style pack template command handler                                   
+20/-0   
lib.rs
Register new style pack command                                                   
+1/-0     
persistence.rs
Persist packs created from template                                           
+31/-0   
ipc.ts
Add IPC wrapper for template creation                                       
+16/-0   
Settings.tsx
Remove obsolete style prompt notice                                           
+0/-28   
Style.tsx
Rework style pack manager interactions                                     
+293/-180
global.css
Add modal enter and exit animations                                           
+32/-0   
Documentation
6 files
en.ts
Remove migrated style prompt copy                                               
+0/-11   
ja.ts
Remove migrated style prompt copy                                               
+0/-11   
ko.ts
Remove migrated style prompt copy                                               
+0/-11   
zh-CN.ts
Remove migrated style prompt copy                                               
+0/-11   
zh-TW.ts
Remove migrated style prompt copy                                               
+0/-11   
style-pack-marketplace.md
Add marketplace planning document                                               
+299/-0 
Configuration changes
3 files
package.json
Bump app version for release                                                         
+1/-1     
Cargo.toml
Bump Tauri package version                                                             
+1/-1     
tauri.conf.json
Bump desktop app version                                                                 
+1/-1     
Bug fix
1 files
_atoms.tsx
Restore button cursor affordance                                                 
Tests
1 files
stylePrefs.test.ts
Expand style preference coverage                                                 

baiqing added 3 commits May 14, 2026 14:59
UI:
- 「原文」改成标题旁的 pill 切换器,与 builtin 卡分离
- builtin 卡片按 light → structured → formal 排序,followed by imported 包
- 「+ 新建风格包」tile 固定在网格末位
- imported 卡片右上角换成红色 trash 删除按钮(builtin 显示装饰 sparkle 图标,无 delete)
- builtin 卡片背景做灰底处理;编辑按钮 disabled,"只读"
- 编辑按钮挪到底部,紧接「导出」右边

后端:
- 新增 IPC create_style_pack_from_template / persistence.create_from_template,「+」走这条路径直接落盘
- 编辑面板出场加 modal-backdrop-out / modal-drawer-out 两个 keyframe

清理:
- 删除 Settings.tsx 里 PR #429 留下的"润色 System Prompt 已迁移"死告示卡
- 删除 11 个相关 i18n key 跨 5 种语言
- 删除卡片上的「轮换 ON/OFF」按钮 + 编辑面板里同款 + metaStatus item
- BusyAction 移除 'toggling' 变体
- 删除 BUILTIN 选中态与 active 共用 highlight 的 bug
- SavedToast 统一替换 inline notice/error banner
预留风格包市场的 HTTP API + IPC 契约 + DTO + 鉴权/缓存/安全策略。
IPC stub 未实装;后端 endpoint 选型 + 服务端工程化待定。
@appergb appergb merged commit 0aa3ee6 into beta May 14, 2026
4 checks passed
@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

429 - Partially compliant

Compliant requirements:

  • Reworked style pack management UI
  • Blank-template creation path
  • Rotation control cleanup and dead-code removal
  • Editor open/close animation support
  • Translation/copy updates

Non-compliant requirements:

  • No new automated test coverage is shown for the new template-creation flow or modal behavior

Requires further human verification:

  • Visual/layout verification of the refreshed style page and editor animations
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Scroll lock

The editor no longer locks body scrolling while the drawer is open. On long pages or trackpad/wheel input, the background list can keep moving behind the modal, which makes the editor feel non-modal and can cause users to lose context while editing.

useEffect(() => {
  if (!editorOpen) return;
  const handleKeyDown = (event: KeyboardEvent) => {
    if (event.key === 'Escape') {
      event.preventDefault();
      closeEditor();
    }
  };
  window.addEventListener('keydown', handleKeyDown);
  return () => {
    window.removeEventListener('keydown', handleKeyDown);
  };
}, [editorOpen, dirty, selectedPack, draft]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant