-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
- Loading branch information
1 parent
f0a54e1
commit cbab1a3
Showing
7 changed files
with
75 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Tooltip from './base/tooltip'; | ||
import { Virtuoso } from 'react-virtuoso'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import defaultCover from '../assets/default-cover.png'; | ||
import * as player from '../utils/player'; | ||
import { useAtomValue } from 'jotai'; | ||
import { currentSongJotai, playlistJotai } from '../jotais/play'; | ||
|
||
export default function PlaylistTooltip () { | ||
const playlist = useAtomValue(playlistJotai); | ||
const currentSong = useAtomValue(currentSongJotai); | ||
return ( | ||
<Tooltip | ||
content={( | ||
<div className='flex flex-col h-64 w-72 gap-4 p-2'> | ||
<span className='font-(500 size-lg)'> | ||
<FormattedMessage defaultMessage='Playlist ({total})' values={{ total: playlist.length }} /> | ||
</span> | ||
<Virtuoso | ||
totalCount={playlist.length} | ||
itemContent={(index) => { | ||
const thatSong = playlist[index]; | ||
return ( | ||
<div onDoubleClickCapture={() => { | ||
player.setCurrentSong(thatSong); | ||
}} className='flex gap-2 py-2 border-b-(1 solid outline-pri) hover:bg-bg-pri cursor-pointer transition-colors items-center'> | ||
<img draggable={false} src={thatSong.cover ?? defaultCover} alt={thatSong.name} className='rounded-md w-8 h-8' /> | ||
<div className='flex flex-col *:text-truncate max-w-56'> | ||
<span className={`color-text-pri font-size-xs font-500 ${currentSong!.id === thatSong.id ? 'color-fg-pri font-600' : ''}`}>{thatSong.name}</span> | ||
<span className={`color-text-sec font-size-xs ${currentSong!.id === thatSong.id ? '!color-fg-pri' : ''}`}>{thatSong.album}</span> | ||
</div> | ||
</div> | ||
); | ||
}} | ||
/> | ||
</div> | ||
)} | ||
className='flex w-5 h-5' | ||
placement='top-right' | ||
trigger='click' | ||
> | ||
<span className='i-fluent:navigation-play-20-regular w-5 h-5 cursor-pointer' /> | ||
</Tooltip> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters