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

38 lines
907 B

import { useEmbeddedLayout } from '@rocket.chat/ui-client';
import type { ReactElement, ReactNode } from 'react';
import { Suspense } from 'react';
import AuthenticationCheck from './AuthenticationCheck';
import EmbeddedPreload from './EmbeddedPreload';
import Preload from './Preload';
import { useCustomScript } from './useCustomScript';
type MainLayoutProps = {
children?: ReactNode;
};
const MainLayout = ({ children = null }: MainLayoutProps): ReactElement => {
useCustomScript();
const isEmbeddedLayout = useEmbeddedLayout();
if (isEmbeddedLayout) {
return (
<EmbeddedPreload>
<AuthenticationCheck>
<Suspense fallback={null}>{children}</Suspense>
</AuthenticationCheck>
</EmbeddedPreload>
);
}
return (
<Preload>
<AuthenticationCheck>
<Suspense fallback={null}>{children}</Suspense>
</AuthenticationCheck>
</Preload>
);
};
export default MainLayout;