mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 04:20:07 +02:00
Add album detail list view (#1681)
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { usePlayerSong } from '/@/renderer/store';
|
||||
import { QueueSong } from '/@/shared/types/domain-types';
|
||||
import { QueueSong, Song } from '/@/shared/types/domain-types';
|
||||
|
||||
export const useIsCurrentSong = (song: QueueSong) => {
|
||||
export const useIsCurrentSong = (song: QueueSong | Song) => {
|
||||
const currentSong = usePlayerSong();
|
||||
|
||||
const isActive = useMemo(() => {
|
||||
return song._uniqueId === currentSong?._uniqueId;
|
||||
}, [song._uniqueId, currentSong?._uniqueId]);
|
||||
const queueSong = song as QueueSong;
|
||||
|
||||
if (queueSong._uniqueId != null && queueSong._uniqueId !== '') {
|
||||
return queueSong._uniqueId === currentSong?._uniqueId;
|
||||
}
|
||||
|
||||
return song.id === currentSong?.id;
|
||||
}, [song, currentSong?.id, currentSong?._uniqueId]);
|
||||
|
||||
return { isActive };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user