2022-04-28 18:54:33 +02:00
|
|
|
import { Layout } from 'antd';
|
2022-05-08 18:05:37 -07:00
|
|
|
import { useRecoilValue } from 'recoil';
|
2022-05-26 11:08:37 -07:00
|
|
|
import {
|
|
|
|
ClientConfigStore,
|
|
|
|
isChatAvailableSelector,
|
|
|
|
clientConfigStateAtom,
|
2022-05-27 22:27:20 -07:00
|
|
|
fatalErrorStateAtom,
|
2022-05-26 11:08:37 -07:00
|
|
|
} 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';
|
2022-05-27 22:27:20 -07:00
|
|
|
import { DisplayableError } from '../../types/displayable-error';
|
|
|
|
import FatalErrorStateModal from '../modals/FatalErrorModal';
|
2022-04-25 23:10:07 -07:00
|
|
|
|
|
|
|
function Main() {
|
2022-05-08 18:05:37 -07:00
|
|
|
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
|
|
|
|
const { name, title } = clientConfig;
|
2022-05-26 11:08:37 -07:00
|
|
|
const isChatAvailable = useRecoilValue<boolean>(isChatAvailableSelector);
|
2022-05-27 22:27:20 -07:00
|
|
|
const fatalError = useRecoilValue<DisplayableError>(fatalErrorStateAtom);
|
|
|
|
|
2022-04-25 23:10:07 -07:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<ClientConfigStore />
|
|
|
|
<Layout>
|
2022-05-26 11:08:37 -07:00
|
|
|
<Header name={title || name} chatAvailable={isChatAvailable} />
|
2022-05-03 23:55:13 +02:00
|
|
|
<Content />
|
2022-05-27 22:27:20 -07:00
|
|
|
{fatalError && (
|
|
|
|
<FatalErrorStateModal title={fatalError.title} message={fatalError.message} />
|
|
|
|
)}
|
2022-04-25 23:10:07 -07:00
|
|
|
</Layout>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Main;
|