import { isIosPwa, resizeImage } from '@/web/utils/common'
import player from '@/web/states/player'
import { State as PlayerState } from '@/web/utils/player'
import { useSnapshot } from 'valtio'
import useTracks from '@/web/api/hooks/useTracks'
import { css, cx } from '@emotion/css'
import Wave from './Wave'
import Icon from '@/web/components/Icon'
import { useWindowSize } from 'react-use'
import { playerWidth, topbarHeight } from '@/web/utils/const'
import useIsMobile from '@/web/hooks/useIsMobile'
import { Virtuoso } from 'react-virtuoso'
const Header = () => {
return (
)
}
const Track = ({
track,
index,
playingTrackIndex,
state,
}: {
track?: Track
index: number
playingTrackIndex: number
state: PlayerState
}) => {
return (
{
if (e.detail === 2 && track?.id) player.playTrack(track.id)
}}
>
{/* Cover */}

{/* Track info */}
{track?.name}
{track?.ar.map(a => a.name).join(', ')}
{/* Wave icon */}
{playingTrackIndex === index ? (
) : (
{String(index + 1).padStart(2, '0')}
)}
)
}
const TrackList = ({ className }: { className?: string }) => {
const { trackList, trackIndex, state } = useSnapshot(player)
const { data: tracksRaw } = useTracks({ ids: trackList })
const tracks = tracksRaw?.songs || []
const { height } = useWindowSize()
const isMobile = useIsMobile()
const listHeight = height - topbarHeight - playerWidth - 24 // 24是封面与底部间距
const listHeightMobile = height - 154 - 110 - (isIosPwa ? 34 : 0) // 154是列表距离底部的距离,110是顶部的距离
return (
<>
,
Footer: () => ,
}}
itemContent={(index, track) => (
)}
>
>
)
}
const PlayingNext = () => {
return (
<>
>
)
}
export default PlayingNext