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

fix(PlayerControl): 评论数量在没有评论按钮时也意外显示 - #982

Merged
imsyy merged 2 commits into
SPlayer-Dev:devfrom
MoYingJi:pr/fc
Mar 7, 2026
Merged

imsyy merged 2 commits into
SPlayer-Dev:devfrom
MoYingJi:pr/fc

Conversation

@MoYingJi

@MoYingJi MoYingJi commented Mar 7, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 7, 2026 02:29
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • 修复评论数量显示逻辑: 解决了在全屏播放器设置中,即使评论按钮被禁用,评论数量仍然可能显示的问题。现在,评论数量的显示将与评论按钮的可见性保持一致。
Changelog
  • src/components/Modal/Setting/FullscreenPlayerManager.vue
    • 为全屏播放器元素设置中的 n-switch 组件添加了 disabled 属性,允许根据条件禁用开关。
    • 更新了 Item 类型定义,增加了可选的 disabled 属性。
    • 将 items 数组���换为计算属性 computed<Item[]>,以便动态评估禁用状态。
    • 当评论按钮(comments)被禁用时,自动禁用“显示评论数量”(commentCount)的设置开关。
  • src/components/Player/PlayerControl.vue
    • 调整了 n-badge 组件的 v-if 条件,使其在评论按钮不可见时也不显示评论数量,从而修复了评论数量意外显示的问题。
Activity
  • 此拉取请求目前没有人工活动。
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

本次 PR 修复了在评论按钮被隐藏时,评论数量依然会显示的问题。PlayerControl.vue 中的修改通过 v-if 指令正确地控制了 n-badge 组件的渲染,确保了评论按钮和评论数量的显示逻辑一致。FullscreenPlayerManager.vue 中的改动则在设置界面中增加了选项之间的依赖关系,当“显示评论按钮”关闭时,“显示评论数量”选项会被禁用,提升了设置项的可用性。整体实现是合理的。我有一个关于代码可读性的建议。

Comment thread src/components/Player/PlayerControl.vue Outdated
Comment on lines +44 to +48
v-if="
!musicStore.playSong.path &&
!statusStore.pureLyricMode &&
settingStore.fullscreenPlayerElements.comments
"

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.

medium

为了提高代码的可读性和可维护性,建议将这个 v-if 的条件提取到一个计算属性中。这样可以使模板更简洁,逻辑也更清晰。

可以在 <script setup> 中添加如下计算属性:

const showCommentButton = computed(
  () =>
    !musicStore.playSong.path &&
    !statusStore.pureLyricMode &&
    settingStore.fullscreenPlayerElements.comments,
);

然后模板中就可以使用这个计算属性了。

v-if="showCommentButton"

Copilot AI 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.

Pull request overview

该 PR 旨在修复全屏播放器中“评论按钮被隐藏时,评论数量仍意外显示”的问题,并在设置面板中对相关开关进行联动约束,使 UI 行为更一致。

Changes:

  • 将评论相关的 v-if 从内部图标移动到 <n-badge> 上,避免仅徽标被渲染导致计数单独显示。
  • 在全屏播放器元素管理设置中,为“显示评论数量”增加禁用态(当“显示评论按钮”关闭时不可操作)。
  • 将设置项列表从静态数组改为 computed,以便根据当前设置动态计算禁用态。

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/components/Player/PlayerControl.vue 将评论徽标整体按“评论按钮开关”条件渲染,避免只显示数量不显示按钮
src/components/Modal/Setting/FullscreenPlayerManager.vue 增加“评论数量”开关的禁用态,并将 items 改为计算属性以响应联动

You can also share your feedback on Copilot code review. Take the survey.

<n-text class="name">{{ item.label }}</n-text>
<n-switch
:value="settingStore.fullscreenPlayerElements[item.key]"
:value="item.disabled ? false : settingStore.fullscreenPlayerElements[item.key]"

Copilot AI Mar 7, 2026

Copy link

Choose a reason for hiding this comment

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

The switch’s displayed value is forced to false when item.disabled is true, even though settingStore.fullscreenPlayerElements[item.key] may still be true (e.g., user enables commentCount then disables comments). This makes the UI state diverge from the persisted setting and can surprise users when re-enabling comments. Consider either (1) always displaying the real stored value while disabled, or (2) actively syncing the store (set commentCount to false) when comments is turned off.

Suggested change
:value="item.disabled ? false : settingStore.fullscreenPlayerElements[item.key]"
:value="settingStore.fullscreenPlayerElements[item.key]"
Copilot uses AI. Check for mistakes.
settingStore.fullscreenPlayerElements.comments
"
:show="
statusStore.songCommentCount > 0 && settingStore.fullscreenPlayerElements.commentCount

Copilot AI Mar 7, 2026

Copy link

Choose a reason for hiding this comment

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

Now that the whole <n-badge> is gated by fullscreenPlayerElements.comments, the comment-count fetch logic in the script (which only checks fullscreenPlayerElements.commentCount) can still call the comments API even when the comments entry point is hidden. Consider also gating comment-count fetching on fullscreenPlayerElements.comments (or automatically turning off commentCount when comments is disabled) to avoid unnecessary requests.

Suggested change
statusStore.songCommentCount > 0 && settingStore.fullscreenPlayerElements.commentCount
statusStore.songCommentCount > 0 &&
settingStore.fullscreenPlayerElements.commentCount &&
settingStore.fullscreenPlayerElements.comments
Copilot uses AI. Check for mistakes.
type Item = { label: string; key: FullscreenPlayerElementKey; disabled?: boolean };

const items: Item[] = [
const items = computed<Item[]>(() => [

Copilot AI Mar 7, 2026

Copy link

Choose a reason for hiding this comment

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

items is now created with computed(...), but computed is not imported in this <script setup> block. This will cause a runtime/compile error when bundling the component. Import computed from vue (or refactor back to a static array if reactivity isn’t needed).

Copilot uses AI. Check for mistakes.
@imsyy
imsyy merged commit 1490a2a into SPlayer-Dev:dev Mar 7, 2026
@MoYingJi
MoYingJi deleted the pr/fc branch March 11, 2026 19:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants