fix jukebox on null playlist

This commit is contained in:
dank074 2022-11-15 22:39:27 -06:00
parent 6cef3564cf
commit da281a170b
3 changed files with 5 additions and 6 deletions

View File

@ -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">

View File

@ -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>

View File

@ -45,7 +45,7 @@ const useFurniturePlaylistEditorWidgetState = () =>
return;
}
if(roomSession.isRoomOwner || (roomSession.controllerLevel >= RoomControllerLevel.GUEST) || GetSessionDataManager().isModerator) SendMessageComposer(new FurnitureMultiStateComposer(event.objectId, -2));
});
@ -58,7 +58,6 @@ const useFurniturePlaylistEditorWidgetState = () =>
useSoundEvent<NowPlayingEvent>(NowPlayingEvent.NPE_SONG_CHANGED, event =>
{
console.log(event);
setCurrentPlayingIndex(event.position);
});