0

35 lines
1.0 KiB
TypeScript
Raw Normal View History

import { Layout } from 'antd';
2022-05-08 18:05:37 -07:00
import { useRecoilValue } from 'recoil';
import {
ClientConfigStore,
isChatAvailableSelector,
clientConfigStateAtom,
fatalErrorStateAtom,
} from '../stores/ClientConfigStore';
2022-05-03 23:55:13 +02:00
import { Content, Header } from '../ui';
2022-05-08 18:05:37 -07:00
import { ClientConfig } from '../../interfaces/client-config.model';
import { DisplayableError } from '../../types/displayable-error';
import FatalErrorStateModal from '../modals/FatalErrorModal';
function Main() {
2022-05-08 18:05:37 -07:00
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
const { name, title } = clientConfig;
const isChatAvailable = useRecoilValue<boolean>(isChatAvailableSelector);
const fatalError = useRecoilValue<DisplayableError>(fatalErrorStateAtom);
return (
<>
<ClientConfigStore />
<Layout>
<Header name={title || name} chatAvailable={isChatAvailable} />
2022-05-03 23:55:13 +02:00
<Content />
{fatalError && (
<FatalErrorStateModal title={fatalError.title} message={fatalError.message} />
)}
</Layout>
</>
);
}
export default Main;