mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 05:38:04 +00:00
feat: updates (#1530)
* feat: 支持repeat mode切换 * feat: 歌单页面的播放按钮可以暂停 * fix: 专辑页面播放按钮 考虑私人FM的情况 解决按钮闪烁问题 * fix: SvgName报错 * update
This commit is contained in:
parent
13281d3f08
commit
24af937e70
5 changed files with 96 additions and 30 deletions
|
|
@ -10,6 +10,7 @@ import { resizeImage } from '@/renderer/utils/common'
|
|||
import {
|
||||
State as PlayerState,
|
||||
Mode as PlayerMode,
|
||||
RepeatMode as PlayerRepeatMode,
|
||||
} from '@/renderer/utils/player'
|
||||
|
||||
const PlayingTrack = () => {
|
||||
|
|
@ -130,25 +131,45 @@ const MediaControls = () => {
|
|||
|
||||
const Others = () => {
|
||||
const playerSnapshot = useSnapshot(player)
|
||||
const mode = useMemo(() => playerSnapshot.mode, [playerSnapshot.mode])
|
||||
|
||||
const switchRepeatMode = () => {
|
||||
if (playerSnapshot.repeatMode === PlayerRepeatMode.OFF) {
|
||||
player.repeatMode = PlayerRepeatMode.ON
|
||||
} else if (playerSnapshot.repeatMode === PlayerRepeatMode.ON) {
|
||||
player.repeatMode = PlayerRepeatMode.ONE
|
||||
} else {
|
||||
player.repeatMode = PlayerRepeatMode.OFF
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='flex items-center justify-end gap-2 pr-2 text-black dark:text-white'>
|
||||
<IconButton
|
||||
onClick={() => toast('Work in progress')}
|
||||
disabled={mode === PlayerMode.FM}
|
||||
disabled={playerSnapshot.mode === PlayerMode.FM}
|
||||
>
|
||||
<SvgIcon className='h-6 w-6' name='playlist' />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() => toast('施工中...')}
|
||||
disabled={mode === PlayerMode.FM}
|
||||
onClick={switchRepeatMode}
|
||||
disabled={playerSnapshot.mode === PlayerMode.FM}
|
||||
>
|
||||
<SvgIcon className='h-6 w-6' name='repeat' />
|
||||
<SvgIcon
|
||||
className={classNames(
|
||||
'h-6 w-6',
|
||||
playerSnapshot.repeatMode !== PlayerRepeatMode.OFF &&
|
||||
'text-brand-500'
|
||||
)}
|
||||
name={
|
||||
playerSnapshot.repeatMode === PlayerRepeatMode.ONE
|
||||
? 'repeat-1'
|
||||
: 'repeat'
|
||||
}
|
||||
/>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() => toast('施工中...')}
|
||||
disabled={mode === PlayerMode.FM}
|
||||
disabled={playerSnapshot.mode === PlayerMode.FM}
|
||||
>
|
||||
<SvgIcon className='h-6 w-6' name='shuffle' />
|
||||
</IconButton>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue