Skip to content
This repository was archived by the owner on Jul 17, 2026. It is now read-only.

refactor(setting): 优化设置 - #800

Merged
imsyy merged 4 commits into
SPlayer-Dev:devfrom
MoYingJi:pr/o
Feb 2, 2026
Merged

imsyy merged 4 commits into
SPlayer-Dev:devfrom
MoYingJi:pr/o

Conversation

@MoYingJi

@MoYingJi MoYingJi commented Feb 1, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @MoYingJi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

本次拉取请求主要对设置模块进行了重构和优化。核心目标是简化设置项的定义和渲染逻辑,使其更具声明性,并增强了条件性设置的灵活性。通过引入新的属性和统一的解析方法,开发者可以更方便地控制设置项在特定条件下的显示状态、值、标题和描述,同时提升了代码的可维护性和用户界面的交互体验。

Highlights

  • 统一设置项属性处理: 优化了 SettingItemRenderer.vue 中设置项属性(如 title、description、disabled)的解析逻辑,通过引入新的计算属性 title 和 descriptionContent,并统一使用 toValue 辅助函数,减少了重复代码并提高了可读性。
  • 增强强制显示逻辑: 扩展了 SettingItem.forceIf 接口,新增 forcedTitle 和 forcedDescription 属性,允许在满足特定条件时,不仅强制设置项的值,还能强制其标题和描述,从而提供更灵活的条件反馈。
  • 重构歌词括号替换设置: 将“替换歌词括号内容”设置项及其子项(“括号替换样式”、“自定义替换内容”)重构为嵌套结构,改善了设置界面的组织和用户体验。
  • 优化工具函数管理: 将 descMultiline 工具函数从 src/components/Setting/config/utils.ts 移动到更通用的 src/utils/format.ts,并引入 trimIndentString 辅助函数,提高了代码的复用性和模块化。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

这次的重构工作非常出色,显著提升了设置组件的可维护性和代码清晰度。将 forceIf 的逻辑集中到 SettingItemRenderer 中,并扩展其功能以支持 forcedTitle 和 forcedDescription,这是一个很棒的设计。同时,广泛使用 toValue 简化了对 MaybeRefOrGetter 的处理,使得代码更加现代化和简洁。将相关的设置项进行嵌套,也优化了UI的结构和用户体验。我只发现了一个小问题,在 SettingItemRenderer.vue 中,descriptionContent 的实现可以进一步简化和增强健壮性,具体请看我的评论。

Comment thread src/components/Setting/SettingItemRenderer.vue
优化 SettingItemRenderer

将 title 和 description 的变化也集成进 forceIf 里
@imsyy
imsyy merged commit 0f5fbc1 into SPlayer-Dev:dev Feb 2, 2026
@MoYingJi
MoYingJi deleted the pr/o branch February 2, 2026 13:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants