mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +01:00
Changes
This commit is contained in:
parent
51ea8fe4a3
commit
21f5a0c0cd
@ -7,23 +7,16 @@ export class RoomWidgetChooserContentEvent extends RoomWidgetUpdateEvent
|
||||
public static FURNI_CHOOSER_CONTENT: string = 'RWCCE_FURNI_CHOOSER_CONTENT';
|
||||
|
||||
private _items: RoomObjectItem[];
|
||||
private _isModerator: boolean;
|
||||
|
||||
constructor(type: string, items: RoomObjectItem[], isModerator: boolean = false)
|
||||
constructor(type: string, items: RoomObjectItem[])
|
||||
{
|
||||
super(type);
|
||||
|
||||
this._items = items;
|
||||
this._isModerator = isModerator;
|
||||
}
|
||||
|
||||
public get items(): RoomObjectItem[]
|
||||
{
|
||||
return this._items;
|
||||
}
|
||||
|
||||
public get isModerator(): boolean
|
||||
{
|
||||
return this._isModerator;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ export class FurniChooserWidgetHandler extends RoomWidgetHandler
|
||||
return (a.name < b.name) ? -1 : 1;
|
||||
});
|
||||
|
||||
this.container.eventDispatcher.dispatchEvent(new RoomWidgetChooserContentEvent(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, items, GetSessionDataManager().isModerator));
|
||||
this.container.eventDispatcher.dispatchEvent(new RoomWidgetChooserContentEvent(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, items));
|
||||
}
|
||||
|
||||
private selectRoomObject(message: RoomWidgetRoomObjectMessage): void
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { SecurityLevel } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useState } from 'react';
|
||||
import { LocalizeText, RoomObjectItem, RoomWidgetChooserContentEvent, RoomWidgetRequestWidgetMessage, RoomWidgetUpdateRoomObjectEvent } from '../../../../api';
|
||||
import { GetSessionDataManager, LocalizeText, RoomObjectItem, RoomWidgetChooserContentEvent, RoomWidgetRequestWidgetMessage, RoomWidgetUpdateRoomObjectEvent } from '../../../../api';
|
||||
import { BatchUpdates, UseEventDispatcherHook } from '../../../../hooks';
|
||||
import { useRoomContext } from '../../RoomContext';
|
||||
import { ChooserWidgetView } from './ChooserWidgetView';
|
||||
@ -8,7 +9,6 @@ export const FurniChooserWidgetView: FC<{}> = props =>
|
||||
{
|
||||
const [ isVisible, setIsVisible ] = useState(false);
|
||||
const [ items, setItems ] = useState<RoomObjectItem[]>(null);
|
||||
const [ isModerator, setIsModerator ] = useState<boolean>(false);
|
||||
const [ refreshTimeout, setRefreshTimeout ] = useState<ReturnType<typeof setTimeout>>(null);
|
||||
const { eventDispatcher = null, widgetHandler = null } = useRoomContext();
|
||||
|
||||
@ -29,7 +29,6 @@ export const FurniChooserWidgetView: FC<{}> = props =>
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setItems(event.items);
|
||||
setIsModerator(event.isModerator);
|
||||
setIsVisible(true);
|
||||
});
|
||||
}, []);
|
||||
@ -63,5 +62,5 @@ export const FurniChooserWidgetView: FC<{}> = props =>
|
||||
|
||||
if(!items) return null;
|
||||
|
||||
return <ChooserWidgetView title={ LocalizeText('widget.chooser.furni.title') } displayItemId={ isModerator } items={ items } onCloseClick={ close } />;
|
||||
return <ChooserWidgetView title={ LocalizeText('widget.chooser.furni.title') } displayItemId={ GetSessionDataManager().hasSecurity(SecurityLevel.MODERATOR) } items={ items } onCloseClick={ close } />;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user