mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-19 05:46:27 +01:00
Room Info updates
This commit is contained in:
parent
7a6d290c2c
commit
ee1fcad71c
@ -1,5 +1,5 @@
|
|||||||
.nitro-room-info {
|
.nitro-room-info {
|
||||||
width: 230px;
|
width: 250px;
|
||||||
|
|
||||||
.gray {
|
.gray {
|
||||||
filter: grayscale(1);
|
filter: grayscale(1);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { RoomMuteComposer, RoomSettingsComposer, RoomStaffPickComposer, UserHomeRoomComposer } from '@nitrots/nitro-renderer';
|
import { RoomMuteComposer, RoomSettingsComposer, RoomStaffPickComposer, SecurityLevel, UserHomeRoomComposer } from '@nitrots/nitro-renderer';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { FC, useCallback, useEffect, useState } from 'react';
|
import { FC, useCallback, useEffect, useState } from 'react';
|
||||||
import { GetConfiguration, LocalizeText } from '../../../../api';
|
import { GetConfiguration, GetSessionDataManager, LocalizeText } from '../../../../api';
|
||||||
import { NavigatorEvent } from '../../../../events';
|
import { NavigatorEvent } from '../../../../events';
|
||||||
import { RoomWidgetThumbnailEvent } from '../../../../events/room-widgets/thumbnail';
|
import { RoomWidgetThumbnailEvent } from '../../../../events/room-widgets/thumbnail';
|
||||||
import { dispatchUiEvent } from '../../../../hooks/events';
|
import { dispatchUiEvent } from '../../../../hooks/events';
|
||||||
@ -43,6 +43,16 @@ export const NavigatorRoomInfoView: FC<NavigatorRoomInfoViewProps> = props =>
|
|||||||
setIsRoomMuted(roomInfoData.enteredGuestRoom.allInRoomMuted);
|
setIsRoomMuted(roomInfoData.enteredGuestRoom.allInRoomMuted);
|
||||||
}, [ roomInfoData ]);
|
}, [ roomInfoData ]);
|
||||||
|
|
||||||
|
const hasPermission = useCallback((permission: string) =>
|
||||||
|
{
|
||||||
|
switch(permission)
|
||||||
|
{
|
||||||
|
case 'settings': return GetSessionDataManager().securityLevel >= SecurityLevel.MODERATOR || roomInfoData.currentRoomOwner;
|
||||||
|
case 'staff_pick': return GetSessionDataManager().securityLevel >= SecurityLevel.COMMUNITY;
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}, [ roomInfoData ]);
|
||||||
|
|
||||||
const processAction = useCallback((action: string, value?: string) =>
|
const processAction = useCallback((action: string, value?: string) =>
|
||||||
{
|
{
|
||||||
if(!roomInfoData || !roomInfoData.enteredGuestRoom) return;
|
if(!roomInfoData || !roomInfoData.enteredGuestRoom) return;
|
||||||
@ -131,7 +141,7 @@ export const NavigatorRoomInfoView: FC<NavigatorRoomInfoViewProps> = props =>
|
|||||||
{ roomThumbnail && <img alt="" src={ roomThumbnail } /> }
|
{ roomThumbnail && <img alt="" src={ roomThumbnail } /> }
|
||||||
</div>
|
</div>
|
||||||
{ roomInfoData.enteredGuestRoom.habboGroupId > 0 && <div className="d-flex align-items-center mb-2 cursor-pointer" onClick={ () => processAction('open_group_info') }>
|
{ roomInfoData.enteredGuestRoom.habboGroupId > 0 && <div className="d-flex align-items-center mb-2 cursor-pointer" onClick={ () => processAction('open_group_info') }>
|
||||||
<div className="group-badge flex-shrink-0 me-2">
|
<div className="group-badge flex-shrink-0 me-1">
|
||||||
<BadgeImageView badgeCode={ roomInfoData.enteredGuestRoom.groupBadgeCode } isGroup={ true } />
|
<BadgeImageView badgeCode={ roomInfoData.enteredGuestRoom.groupBadgeCode } isGroup={ true } />
|
||||||
</div>
|
</div>
|
||||||
<div className="text-decoration-underline small">
|
<div className="text-decoration-underline small">
|
||||||
@ -142,11 +152,13 @@ export const NavigatorRoomInfoView: FC<NavigatorRoomInfoViewProps> = props =>
|
|||||||
<i className="icon icon-arrows me-1" />
|
<i className="icon icon-arrows me-1" />
|
||||||
<span>{ LocalizeText('navigator.embed.caption') }</span>
|
<span>{ LocalizeText('navigator.embed.caption') }</span>
|
||||||
</div>
|
</div>
|
||||||
|
{ hasPermission('settings') && <>
|
||||||
<button className="btn btn-sm btn-primary w-100 mb-1" onClick={ () => processAction('open_room_settings') }>{ LocalizeText('navigator.room.popup.info.room.settings') }</button>
|
<button className="btn btn-sm btn-primary w-100 mb-1" onClick={ () => processAction('open_room_settings') }>{ LocalizeText('navigator.room.popup.info.room.settings') }</button>
|
||||||
<button className="btn btn-sm btn-primary w-100 mb-1" disabled={ true }>{ LocalizeText('open.floor.plan.editor') }</button>
|
<button className="btn btn-sm btn-primary w-100 mb-1" disabled={ true }>{ LocalizeText('open.floor.plan.editor') }</button>
|
||||||
<button className="btn btn-sm btn-primary w-100 mb-1" onClick={ () => processAction('toggle_pick') }>{ LocalizeText(isRoomPicked ? 'navigator.staffpicks.unpick' : 'navigator.staffpicks.pick') }</button>
|
</> }
|
||||||
|
{ hasPermission('staff_pick') && <button className="btn btn-sm btn-primary w-100 mb-1" onClick={ () => processAction('toggle_pick') }>{ LocalizeText(isRoomPicked ? 'navigator.staffpicks.unpick' : 'navigator.staffpicks.pick') }</button> }
|
||||||
<button className="btn btn-sm btn-danger w-100 mb-1" disabled={ true }>{ LocalizeText('help.emergency.main.report.room') }</button>
|
<button className="btn btn-sm btn-danger w-100 mb-1" disabled={ true }>{ LocalizeText('help.emergency.main.report.room') }</button>
|
||||||
<button className="btn btn-sm btn-primary w-100" onClick={ () => processAction('toggle_mute') }>{ LocalizeText(isRoomMuted ? 'navigator.muteall_on' : 'navigator.muteall_off') }</button>
|
{ hasPermission('settings') && <button className="btn btn-sm btn-primary w-100" onClick={ () => processAction('toggle_mute') }>{ LocalizeText(isRoomMuted ? 'navigator.muteall_on' : 'navigator.muteall_off') }</button> }
|
||||||
</> }
|
</> }
|
||||||
|
|
||||||
</NitroCardContentView>
|
</NitroCardContentView>
|
||||||
|
Loading…
Reference in New Issue
Block a user