mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 23:50:52 +01:00
Add toolbar transition
This commit is contained in:
parent
4b1ef5d5ec
commit
b0bcd39166
@ -1,37 +1,40 @@
|
|||||||
import { Nitro, RoomBackgroundColorEvent, RoomEngineDimmerStateEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomEngineTriggerWidgetEvent, RoomObjectHSLColorEnabledEvent, RoomObjectWidgetRequestEvent, RoomSessionChatEvent, RoomSessionDanceEvent, RoomSessionDimmerPresetsEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionEvent, RoomSessionFriendRequestEvent, RoomSessionPresentEvent, RoomSessionUserBadgesEvent, RoomZoomEvent } from 'nitro-renderer';
|
import { Nitro, RoomBackgroundColorEvent, RoomEngineDimmerStateEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomEngineTriggerWidgetEvent, RoomObjectHSLColorEnabledEvent, RoomObjectWidgetRequestEvent, RoomSessionChatEvent, RoomSessionDanceEvent, RoomSessionDimmerPresetsEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionEvent, RoomSessionFriendRequestEvent, RoomSessionPresentEvent, RoomSessionUserBadgesEvent, RoomZoomEvent } from 'nitro-renderer';
|
||||||
import { useEffect } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { useRoomEngineEvent } from '../../hooks/events/nitro/room/room-engine-event';
|
import { useRoomEngineEvent } from '../../hooks/events/nitro/room/room-engine-event';
|
||||||
import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/room-session-manager-event';
|
import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/room-session-manager-event';
|
||||||
|
import { FadeTransition } from '../../transitions/FadeTransition';
|
||||||
import { HotelView } from '../hotel-view/HotelView';
|
import { HotelView } from '../hotel-view/HotelView';
|
||||||
import { ToolbarView } from '../toolbar/ToolbarView';
|
import { ToolbarView } from '../toolbar/ToolbarView';
|
||||||
import { MainViewProps } from './MainView.types';
|
import { MainViewProps } from './MainView.types';
|
||||||
|
|
||||||
export function MainView(props: MainViewProps): JSX.Element
|
export function MainView(props: MainViewProps): JSX.Element
|
||||||
{
|
{
|
||||||
const onInterstitialEvent = (event: RoomEngineEvent) =>
|
const [ isReady, setIsReady ] = useState(false);
|
||||||
{
|
|
||||||
console.log(event);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onRoomEngineEvent = (event: RoomEngineEvent) =>
|
const onInterstitialEvent = useCallback((event: RoomEngineEvent) =>
|
||||||
{
|
{
|
||||||
console.log(event);
|
console.log(event);
|
||||||
};
|
}, []);
|
||||||
|
|
||||||
const onRoomEngineObjectEvent = (event: RoomEngineObjectEvent) =>
|
const onRoomEngineEvent = useCallback((event: RoomEngineEvent) =>
|
||||||
{
|
{
|
||||||
console.log(event);
|
console.log(event);
|
||||||
};
|
}, []);
|
||||||
|
|
||||||
const onRoomSessionEvent = (event: RoomSessionEvent) =>
|
const onRoomEngineObjectEvent = useCallback((event: RoomEngineObjectEvent) =>
|
||||||
{
|
{
|
||||||
console.log(event);
|
console.log(event);
|
||||||
}
|
}, []);
|
||||||
|
|
||||||
const onRoomSessionErrorMessageEvent = (event: RoomSessionErrorMessageEvent) =>
|
const onRoomSessionEvent = useCallback((event: RoomSessionEvent) =>
|
||||||
{
|
{
|
||||||
console.log(event);
|
console.log(event);
|
||||||
}
|
}, []);
|
||||||
|
|
||||||
|
const onRoomSessionErrorMessageEvent = useCallback((event: RoomSessionErrorMessageEvent) =>
|
||||||
|
{
|
||||||
|
console.log(event);
|
||||||
|
}, []);
|
||||||
|
|
||||||
useRoomEngineEvent(RoomEngineEvent.ENGINE_INITIALIZED, onInterstitialEvent);
|
useRoomEngineEvent(RoomEngineEvent.ENGINE_INITIALIZED, onInterstitialEvent);
|
||||||
useRoomEngineEvent(RoomEngineEvent.OBJECTS_INITIALIZED, onInterstitialEvent);
|
useRoomEngineEvent(RoomEngineEvent.OBJECTS_INITIALIZED, onInterstitialEvent);
|
||||||
@ -99,13 +102,17 @@ export function MainView(props: MainViewProps): JSX.Element
|
|||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
|
setIsReady(true);
|
||||||
|
|
||||||
Nitro.instance.communication.connection.onReady();
|
Nitro.instance.communication.connection.onReady();
|
||||||
});
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<HotelView />
|
<HotelView />
|
||||||
|
<FadeTransition inProp={ isReady } timeout={ 300 }>
|
||||||
<ToolbarView />
|
<ToolbarView />
|
||||||
|
</FadeTransition>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user