mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-30 00:50:50 +01:00
fix jukebox on null playlist
This commit is contained in:
parent
6cef3564cf
commit
da281a170b
@ -57,13 +57,13 @@ export const DiskInventoryView: FC<DiskInventoryViewProps> = props =>
|
|||||||
{
|
{
|
||||||
const diskId = diskInventory.getKey(index);
|
const diskId = diskInventory.getKey(index);
|
||||||
const songId = diskInventory.getWithIndex(index);
|
const songId = diskInventory.getWithIndex(index);
|
||||||
const songData = GetNitroInstance().soundManager.musicController?.getSongInfo(songId);
|
const songInfo = GetNitroInstance().soundManager.musicController?.getSongInfo(songId);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutGridItem key={ index } itemActive={ (selectedItem === index) } onClick={ () => setSelectedItem(prev => prev === index ? -1 : index) } classNames={ [ 'text-black' ] }>
|
<LayoutGridItem key={ index } itemActive={ (selectedItem === index) } onClick={ () => setSelectedItem(prev => prev === index ? -1 : index) } classNames={ [ 'text-black' ] }>
|
||||||
<div className="disk-image flex-shrink-0 mb-n2" style={ { backgroundColor: GetDiskColor(songData?.songData) } }>
|
<div className="disk-image flex-shrink-0 mb-n2" style={ { backgroundColor: GetDiskColor(songInfo?.songData) } }>
|
||||||
</div>
|
</div>
|
||||||
<Text truncate fullWidth className="text-center">{ songData?.name }</Text>
|
<Text truncate fullWidth className="text-center">{ songInfo?.name }</Text>
|
||||||
{ (selectedItem === index) &&
|
{ (selectedItem === index) &&
|
||||||
<Flex position="absolute" className="bottom-0 mb-1 bg-secondary p-1 rounded" alignItems="center" justifyContent="center" gap={ 2 }>
|
<Flex position="absolute" className="bottom-0 mb-1 bg-secondary p-1 rounded" alignItems="center" justifyContent="center" gap={ 2 }>
|
||||||
<Button onClick={ event => previewSong(event, songId) } variant="light">
|
<Button onClick={ event => previewSong(event, songId) } variant="light">
|
||||||
|
@ -66,7 +66,7 @@ export const SongPlaylistView: FC<SongPlaylistViewProps> = props =>
|
|||||||
<Flex column>
|
<Flex column>
|
||||||
<Text bold display="block">{ LocalizeText('playlist.editor.text.now.playing.in.your.room') }</Text>
|
<Text bold display="block">{ LocalizeText('playlist.editor.text.now.playing.in.your.room') }</Text>
|
||||||
<Text>
|
<Text>
|
||||||
{ playlist[currentPlayingIndex].name + ' - ' + playlist[currentPlayingIndex].creator }
|
{ playlist[currentPlayingIndex]?.name + ' - ' + playlist[currentPlayingIndex]?.creator }
|
||||||
</Text>
|
</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
@ -58,7 +58,6 @@ const useFurniturePlaylistEditorWidgetState = () =>
|
|||||||
|
|
||||||
useSoundEvent<NowPlayingEvent>(NowPlayingEvent.NPE_SONG_CHANGED, event =>
|
useSoundEvent<NowPlayingEvent>(NowPlayingEvent.NPE_SONG_CHANGED, event =>
|
||||||
{
|
{
|
||||||
console.log(event);
|
|
||||||
setCurrentPlayingIndex(event.position);
|
setCurrentPlayingIndex(event.position);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user