Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | 1x 4x | /**
* @file App.tsx
* @description
* Root application component that configures routing and internationalization.
*
* **Architecture:**
* - Sets up the I18nextProvider for multi-language support
* - Configures React Router with all application routes
* - Provides a centralized routing configuration point
*
* **Routes Structure:**
* - Home: `/` - Landing page
* - Auth: `/login` - User authentication
* - Admin: `/admin`, `/add-product`, `/delete-product` - Admin-only features
* - User: `/user` - User dashboard
* - Products: `/search-product`, `/list-stock`, `/product/:id/edit` - Product management
*
* **Responsibilities:**
* - Route configuration and matching
* - Internationalization context provision
* - Application-wide provider setup
*
* @component
* @returns {JSX.Element} Root application element with routing
*/
import React from 'react';
import { I18nextProvider } from 'react-i18next';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import i18n from './i18n';
import LoginPage from './pages/LoginPage';
import HomePage from './pages/HomePage';
import AdminDashboard from './pages/AdminDashboard';
import UserDashboard from './pages/UserDashboard';
import AddProductPage from './pages/AddProductPage';
import DeleteProductPage from './pages/DeleteProductPage';
import SearchProductPage from './pages/SearchProductPage';
import ChangeProductDetailsPage from './pages/ChangeProductDetailsPage';
import ListStockPage from './pages/ListStockPage';
/**
* App Component
* Wraps the application with I18n provider and configures all routes
*/
const App: React.FC = () => {
return (
<I18nextProvider i18n={i18n}>
<Router>
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/login" element={<LoginPage />} />
<Route path="/admin" element={<AdminDashboard />} />
<Route path="/user" element={<UserDashboard />} />
<Route path="/add-product" element={<AddProductPage />} />
<Route path="/delete-product" element={<DeleteProductPage />} />
<Route path="/search-product" element={<SearchProductPage />} />
<Route path="/list-stock" element={<ListStockPage />} />
<Route path="/product/:productId/edit" element={<ChangeProductDetailsPage />} />
</Routes>
</Router>
</I18nextProvider>
);
};
export default App;
|