nas-samba: rebuilt as single Ubuntu image with Samba + CloudNAS (no MongoDB)
This commit is contained in:
51
apps/nas-samba/source/app/frontend/src/App.js
Normal file
51
apps/nas-samba/source/app/frontend/src/App.js
Normal file
@@ -0,0 +1,51 @@
|
||||
import React, { useState, useCallback, useRef, useEffect } from 'react';
|
||||
import { Toaster, toast } from 'sonner';
|
||||
import { AuthProvider, useAuth } from './context/AuthContext';
|
||||
import { ThemeProvider, useTheme } from './context/ThemeContext';
|
||||
import LoginPage from './components/LoginPage';
|
||||
import Dashboard from './components/Dashboard';
|
||||
import SharePage from './components/SharePage';
|
||||
import LoadingScreen from './components/ui/LoadingScreen';
|
||||
|
||||
function AppContent() {
|
||||
const { user, loading } = useAuth();
|
||||
|
||||
// Handle /share/:token routes without React Router
|
||||
const path = window.location.pathname;
|
||||
const shareMatch = path.match(/^\/share\/([a-f0-9]+)$/);
|
||||
if (shareMatch) {
|
||||
return <SharePage token={shareMatch[1]} />;
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <LoadingScreen />;
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
return <LoginPage />;
|
||||
}
|
||||
|
||||
return <Dashboard />;
|
||||
}
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<ThemeProvider>
|
||||
<AuthProvider>
|
||||
<Toaster
|
||||
position="top-right"
|
||||
richColors
|
||||
closeButton
|
||||
toastOptions={{
|
||||
style: {
|
||||
fontFamily: 'Inter, system-ui, sans-serif',
|
||||
},
|
||||
}}
|
||||
/>
|
||||
<AppContent />
|
||||
</AuthProvider>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
Reference in New Issue
Block a user