mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 21:28:06 +00:00
feat: updates
This commit is contained in:
parent
4c90db789b
commit
196a974a64
21 changed files with 291 additions and 191 deletions
|
|
@ -5,15 +5,13 @@ import useUserLikedTracksIDs, {
|
|||
import { player } from '@/web/store'
|
||||
import useIpcRenderer from '@/web/hooks/useIpcRenderer'
|
||||
import { State as PlayerState } from '@/web/utils/player'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useEffectOnce } from 'react-use'
|
||||
import { useSnapshot } from 'valtio'
|
||||
|
||||
const IpcRendererReact = () => {
|
||||
const [isPlaying, setIsPlaying] = useState(false)
|
||||
const playerSnapshot = useSnapshot(player)
|
||||
const track = useMemo(() => playerSnapshot.track, [playerSnapshot.track])
|
||||
const state = useMemo(() => playerSnapshot.state, [playerSnapshot.state])
|
||||
const { track, state } = useSnapshot(player)
|
||||
const trackIDRef = useRef(0)
|
||||
|
||||
// Liked songs ids
|
||||
|
|
@ -51,7 +49,7 @@ const IpcRendererReact = () => {
|
|||
|
||||
useEffectOnce(() => {
|
||||
// 用于显示 windows taskbar buttons
|
||||
if (playerSnapshot.track?.id) {
|
||||
if (track?.id) {
|
||||
window.ipcRenderer?.send(IpcChannels.Pause)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue