Files
bakery-ia/frontend/src/App.tsx

67 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-08-16 20:13:40 +02:00
import React, { useEffect } from 'react';
import { RouterProvider } from 'react-router-dom';
import { Provider } from 'react-redux';
2025-08-03 19:23:20 +02:00
import { Toaster } from 'react-hot-toast';
2025-08-16 20:13:40 +02:00
import { router } from './router';
2025-08-03 19:23:20 +02:00
import { store } from './store';
2025-08-16 20:13:40 +02:00
import ErrorBoundary from './components/ErrorBoundary';
import { useAuth } from './hooks/useAuth';
2025-08-11 07:01:08 +02:00
2025-08-03 19:23:20 +02:00
// i18n
import './i18n';
// Global styles
import './styles/globals.css';
2025-08-16 20:13:40 +02:00
const AppContent: React.FC = () => {
const { initializeAuth } = useAuth();
2025-08-03 19:23:20 +02:00
useEffect(() => {
2025-08-16 20:13:40 +02:00
initializeAuth();
}, [initializeAuth]);
2025-08-03 19:23:20 +02:00
2025-08-16 20:13:40 +02:00
return (
<ErrorBoundary>
<div className="App min-h-screen bg-gray-50">
<RouterProvider router={router} />
{/* Global Toast Notifications */}
<Toaster
position="top-right"
toastOptions={{
duration: 4000,
style: {
background: '#fff',
color: '#333',
boxShadow: '0 4px 25px -5px rgba(0, 0, 0, 0.1)',
borderRadius: '12px',
padding: '16px',
},
success: {
iconTheme: {
primary: '#22c55e',
secondary: '#fff',
},
},
error: {
iconTheme: {
primary: '#ef4444',
secondary: '#fff',
},
},
}}
2025-08-03 19:23:20 +02:00
/>
2025-08-16 20:13:40 +02:00
</div>
</ErrorBoundary>
);
};
2025-08-03 19:23:20 +02:00
2025-08-16 20:13:40 +02:00
const App: React.FC = () => {
2025-08-03 19:23:20 +02:00
return (
<Provider store={store}>
2025-08-16 20:13:40 +02:00
<AppContent />
2025-08-03 19:23:20 +02:00
</Provider>
);
};
export default App;