The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/lib/appLayout.tsx

41 lines
1.2 KiB

import { Emitter } from '@rocket.chat/emitter';
import type { ReactElement } from 'react';
import React, { lazy } from 'react';
const ConnectionStatusBar = lazy(() => import('../components/connectionStatus/ConnectionStatusBar'));
const BannerRegion = lazy(() => import('../views/banners/BannerRegion'));
const PortalsWrapper = lazy(() => import('../views/root/PortalsWrapper'));
const ModalRegion = lazy(() => import('../views/modal/ModalRegion'));
type AppLayoutDescriptor = ReactElement | null;
class AppLayoutSubscription extends Emitter<{ update: void }> {
private descriptor: AppLayoutDescriptor = null;
getSnapshot = (): AppLayoutDescriptor => this.descriptor;
subscribe = (onStoreChange: () => void): (() => void) => this.on('update', onStoreChange);
setCurrentValue(descriptor: AppLayoutDescriptor): void {
this.descriptor = descriptor;
this.emit('update');
}
render(element: ReactElement): void {
this.setCurrentValue(
<>
<ConnectionStatusBar />
<BannerRegion />
{element}
<PortalsWrapper />
<ModalRegion />
</>,
);
}
renderStandalone(element: ReactElement): void {
this.setCurrentValue(element);
}
}
export const appLayout = new AppLayoutSubscription();