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/client/views/root/AppLayout.tsx

39 lines
979 B

import React, { createElement, FC, Fragment, Suspense } from 'react';
import { useSubscription } from 'use-subscription';
import { appLayout } from '../../lib/appLayout';
import { blazePortals } from '../../lib/portals/blazePortals';
import BlazeTemplate from './BlazeTemplate';
import PageLoading from './PageLoading';
const AppLayout: FC = () => {
const descriptor = useSubscription(appLayout);
const portals = useSubscription(blazePortals);
if (descriptor === null) {
return null;
}
if ('template' in descriptor) {
return (
<>
<BlazeTemplate template={descriptor.template} data={descriptor.data} />
{portals.map(({ key, node }) => (
<Fragment key={key} children={node} />
))}
</>
);
}
if ('component' in descriptor) {
return (
<Suspense fallback={<PageLoading />}>
{createElement(descriptor.component, descriptor.props)}
</Suspense>
);
}
throw new Error('invalid app layout descriptor');
};
export default AppLayout;