Skip to content

Conversation

@MoYingJi
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link
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

  • 播放时间格式切换功能: 为播放器添加了播放时间格式切换功能,用户现在可以根据个人喜好选择不同的时间显示方式。
  • 可配置的时间显示: 在播放器底部栏和全屏播放页面,用户可以通过点击时间显示区域来快速切换时间格式,也可以在设置页面进行详细配置。
  • 新增时间格式设置项: 在播放设置中新增了“播放器时间样式”和“底栏时间样式”选项,允许用户选择“播放时间 / 总时长”、“剩余时间 / 总时长”或“播放时间 / 剩余时间”三种格式。
  • 时间格式工具函数: 引入了新的工具函数 getTimeDisplay 和相关类型,以统一和简化播放时间在不同组件中的显示逻辑。
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.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

本次 PR 添加了播放器时间格式的切换功能,整体实现清晰。通过在 settingStore 中添加新状态,并在 PlaySetting 页面提供配置项,用户可以自定义主播放器和全屏播放器的时间显示格式。点击时间区域可以快速循环切换格式,提升了用户体验。代码结构方面,将时间格式化逻辑集中在 src/utils/format.ts 中是很好的实践。我发现了一些可以改进的地方,主要涉及代码健壮性、性能优化和代码复用,具体请看我的评论。这些修改将有助于提升应用的稳定性和可维护性。

Comment on lines +217 to +222
const toggleTimeFormat = () => {
const currentIndex = TIME_FORMATS.indexOf(settingStore.timeFormatMainPlayer)
settingStore.timeFormatMainPlayer = TIME_FORMATS[(currentIndex + 1) % TIME_FORMATS.length];
};
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

toggleTimeFormat 函数中的逻辑与 PlayerControl.vue 中的几乎完全相同,只是操作的 settingStore 属性不同。为了遵循 DRY (Don't Repeat Yourself) 原则并提高代码的可维护性,建议将这个切换逻辑提取到一个公共的工具函数中,例如在 src/utils/format.ts 中创建一个 getNextTimeFormat 函数。这样两个组件都可以复用这个逻辑。

Comment on lines +115 to +120
const toggleTimeFormat = () => {
const currentIndex = TIME_FORMATS.indexOf(settingStore.timeFormatFullPlayer);
settingStore.timeFormatFullPlayer = TIME_FORMATS[(currentIndex + 1) % TIME_FORMATS.length];
};
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

toggleTimeFormat 函数中的逻辑与 MainPlayer.vue 中的几乎完全相同。为了提高代码的复用性和可维护性,建议将此逻辑抽象成一个可复用的工具函数,并放置在 src/utils/format.ts 文件中。

Comment on lines +364 to +369
export const displayTimeFormat = (format: TimeFormat): [TimeDisplayType, TimeDisplayType] => {
switch (format) {
case "current-total": return ["current", "total"];
case "remaining-total": return ["remaining", "total"];
case "current-remaining": return ["current", "remaining"];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

这个 switch 语句没有处理所有 TimeFormat 类型之外的意外值。虽然 TypeScript 的类型系统可以在编译时提供保障,但考虑到设置可能从 localStorage 中读取,数据可能存在损坏或来自旧版本的风险。为了增强代码的健壮性,建议添加一个 default 分支作为回退,以防止在 format 值为意外值时函数返回 undefined 导致运行时错误。

Suggested change
export const displayTimeFormat = (format: TimeFormat): [TimeDisplayType, TimeDisplayType] => {
switch (format) {
case "current-total": return ["current", "total"];
case "remaining-total": return ["remaining", "total"];
case "current-remaining": return ["current", "remaining"];
}
export const displayTimeFormat = (format: TimeFormat): [TimeDisplayType, TimeDisplayType] => {
switch (format) {
case "current-total": return ["current", "total"];
case "remaining-total": return ["remaining", "total"];
case "current-remaining": return ["current", "remaining"];
default: return ["current", "total"];
}
};

Comment on lines +372 to +381
export const getTimeDisplay = (
format: () => TimeFormat, statusStore: { currentTime: number, duration: number }
) => (index: number) => computed(() => {
const display = displayTimeFormat(format())[index];
switch (display) {
case "current": return msToTime(statusStore.currentTime);
case "total": return msToTime(statusStore.duration);
case "remaining": return "-" + msToTime(statusStore.duration - statusStore.currentTime);
}
});

This comment was marked as outdated.

@MoYingJi MoYingJi marked this pull request as draft December 28, 2025 17:16
@MoYingJi MoYingJi marked this pull request as ready for review December 28, 2025 17:20
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.

1 participant