// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
// SPDX-License-Identifier: Apache-2.0
import { AppShell, ErrorBoundary, Loading, Logo, useMedplum, useMedplumProfile } from '@medplum/react';
import { IconVariablePlus } from '@tabler/icons-react';
import { Suspense } from 'react';
import type { JSX } from 'react';
import { Route, Routes } from 'react-router';
import { HomePage } from './pages/HomePage';
import { LandingPage } from './pages/LandingPage';
import { ResourcePage } from './pages/ResourcePage';
import { SignInPage } from './pages/SignInPage';
export function App(): JSX.Element | null {
const medplum = useMedplum();
const profile = useMedplumProfile();
if (medplum.isLoading()) {
return null;
}
return (
<AppShell
logo={<Logo size={24} />}
menus={[
{
title: 'My Links',
links: [{ icon: <IconVariablePlus />, label: 'ValueSet Selector', href: '/' }],
},
]}
>
<ErrorBoundary>
<Suspense fallback={<Loading />}>
<Routes>
<Route path="/" element={profile ? <HomePage /> : <LandingPage />} />
<Route path="/signin" element={<SignInPage />} />
<Route path="/:resourceType/:id" element={<ResourcePage />} />
</Routes>
</Suspense>
</ErrorBoundary>
</AppShell>
);
}