import { memo, useCallback, useMemo } from 'react' import ArtistInline from '@/web/components/ArtistsInline' import Skeleton from '@/web/components/Skeleton' import Icon from '@/web/components/Icon' import useUserLikedTracksIDs, { useMutationLikeATrack, } from '@/web/api/hooks/useUserLikedTracksIDs' import { player } from '@/web/store' import { formatDuration } from '@/web/utils/common' import { State as PlayerState } from '@/web/utils/player' import { cx } from '@emotion/css' import { useSnapshot } from 'valtio' const PlayOrPauseButtonInTrack = memo( ({ isHighlight, trackID }: { isHighlight: boolean; trackID: number }) => { const playerSnapshot = useSnapshot(player) const isPlaying = useMemo( () => playerSnapshot.state === PlayerState.Playing, [playerSnapshot.state] ) const onClick = () => { isHighlight ? player.playOrPause() : player.playTrack(trackID) } return (