mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 15:40:51 +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 songId = diskInventory.getWithIndex(index);
|
||||
const songData = GetNitroInstance().soundManager.musicController?.getSongInfo(songId);
|
||||
const songInfo = GetNitroInstance().soundManager.musicController?.getSongInfo(songId);
|
||||
|
||||
return (
|
||||
<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>
|
||||
<Text truncate fullWidth className="text-center">{ songData?.name }</Text>
|
||||
<Text truncate fullWidth className="text-center">{ songInfo?.name }</Text>
|
||||
{ (selectedItem === index) &&
|
||||
<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">
|
||||
|
@ -66,7 +66,7 @@ export const SongPlaylistView: FC<SongPlaylistViewProps> = props =>
|
||||
<Flex column>
|
||||
<Text bold display="block">{ LocalizeText('playlist.editor.text.now.playing.in.your.room') }</Text>
|
||||
<Text>
|
||||
{ playlist[currentPlayingIndex].name + ' - ' + playlist[currentPlayingIndex].creator }
|
||||
{ playlist[currentPlayingIndex]?.name + ' - ' + playlist[currentPlayingIndex]?.creator }
|
||||
</Text>
|
||||
</Flex>
|
||||
|
||||
|
@ -58,7 +58,6 @@ const useFurniturePlaylistEditorWidgetState = () =>
|
||||
|
||||
useSoundEvent<NowPlayingEvent>(NowPlayingEvent.NPE_SONG_CHANGED, event =>
|
||||
{
|
||||
console.log(event);
|
||||
setCurrentPlayingIndex(event.position);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user