mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-06 16:04:23 +00:00
Add TypeScript types for App component
This commit is contained in:
58
app/src/App.tsx
Normal file
58
app/src/App.tsx
Normal file
@@ -0,0 +1,58 @@
|
||||
import React from 'react';
|
||||
import { MantineProvider, ColorSchemeScript } from '@mantine/core';
|
||||
import { Notifications } from '@mantine/notifications';
|
||||
import { ModalsProvider } from '@mantine/modals';
|
||||
import Layout from './components/layout/Layout';
|
||||
import LoginPage from './components/auth/LoginPage';
|
||||
import { WorkspaceProvider } from './contexts/WorkspaceContext';
|
||||
import { ModalProvider } from './contexts/ModalContext';
|
||||
import { AuthProvider, useAuth } from './contexts/AuthContext';
|
||||
import '@mantine/core/styles.css';
|
||||
import '@mantine/notifications/styles.css';
|
||||
import './App.scss';
|
||||
|
||||
interface AuthenticatedContentProps {}
|
||||
|
||||
const AuthenticatedContent: React.FC<AuthenticatedContentProps> = () => {
|
||||
const { user, loading, initialized } = useAuth();
|
||||
|
||||
if (!initialized) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <div>Loading...</div>;
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
return <LoginPage />;
|
||||
}
|
||||
|
||||
return (
|
||||
<WorkspaceProvider>
|
||||
<ModalProvider>
|
||||
<Layout />
|
||||
</ModalProvider>
|
||||
</WorkspaceProvider>
|
||||
);
|
||||
};
|
||||
|
||||
interface AppProps {}
|
||||
|
||||
const App: React.FC<AppProps> = () => {
|
||||
return (
|
||||
<>
|
||||
<ColorSchemeScript defaultColorScheme="light" />
|
||||
<MantineProvider defaultColorScheme="light">
|
||||
<Notifications />
|
||||
<ModalsProvider>
|
||||
<AuthProvider>
|
||||
<AuthenticatedContent />
|
||||
</AuthProvider>
|
||||
</ModalsProvider>
|
||||
</MantineProvider>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
Reference in New Issue
Block a user