style(LyricsSetting): 优化设置中歌词预览的样式#675
Conversation
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
本次 PR 主要优化了歌词设置中的预览样式,并重构了字体大小的逻辑。
主要改动包括:
- 新增了
fontSizeComputed计算属性,用于根据是否启用 Apple Music-like Lyrics (AMLL) 动态计算翻译和音译歌词的字体大小。 - 在歌词预览中应用了全局歌词字体设置。
代码整体实现良好,我提出了一项关于 fontSizeComputed 的重构建议,旨在增强类型安全和代码健壮性,并简化模板中的逻辑。采纳该建议后,可以移除冗余的 @blur 事件处理器。
| const fontSizeComputed = (key: string) => computed({ | ||
| get: () => settingStore.useAMLyrics ? | ||
| // AMLL 会为翻译和音译设置 `font-size: max(.5em, 10px);` | ||
| Math.max(0.5 * settingStore.lyricFontSize, 10) : | ||
| settingStore[key], | ||
| set: (value) => settingStore[key] = value, | ||
| }); | ||
|
|
||
| // 真实显示的翻译字体大小 | ||
| const tranFontSize = fontSizeComputed("lyricTranFontSize"); | ||
|
|
||
| // 真实显示的音译字体大小 | ||
| const romaFontSize = fontSizeComputed("lyricRomaFontSize"); |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| </Transition> | ||
| <n-input-number | ||
| v-model:value="settingStore.lyricTranFontSize" | ||
| v-model:value="tranFontSize" |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| </Transition> | ||
| <n-input-number | ||
| v-model:value="settingStore.lyricRomaFontSize" | ||
| v-model:value="romaFontSize" |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
我才发现我导入成 lodash-es 的 max 了!我想用 Math.max 的!idea 自动导入害了我 这么个小更改,没必要新开 pr 了
No description provided.