import { lazy, Suspense } from "react"; import { Navigate, Route, Routes } from "react-router-dom"; import { useAuthStore } from "./store/auth"; import { MobileTabBar } from "./components/layout/MobileTabBar"; // هر صفحه با React.lazy لود میشود (code splitting) const DashboardPage = lazy(() => import("./pages/Dashboard/DashboardPage").then((m) => ({ default: m.DashboardPage })), ); const WizardPage = lazy(() => import("./pages/Wizard/WizardPage").then((m) => ({ default: m.WizardPage }))); const SuppliersPage = lazy(() => import("./pages/Suppliers/SuppliersPage").then((m) => ({ default: m.SuppliersPage })), ); const CategoryPage = lazy(() => import("./pages/Suppliers/CategoryPage").then((m) => ({ default: m.CategoryPage })), ); const SupplierDetailPage = lazy(() => import("./pages/Suppliers/SupplierDetailPage").then((m) => ({ default: m.SupplierDetailPage })), ); const ProjectsPage = lazy(() => import("./pages/Projects/ProjectsPage").then((m) => ({ default: m.ProjectsPage })), ); const UnitsPage = lazy(() => import("./pages/Units/UnitsPage").then((m) => ({ default: m.UnitsPage }))); const LoginPage = lazy(() => import("./pages/Auth/LoginPage").then((m) => ({ default: m.LoginPage }))); const InventoryPage = lazy(() => import("./pages/Inventory/InventoryPage").then((m) => ({ default: m.InventoryPage })), ); const ArrivalsPage = lazy(() => import("./pages/Inventory/ArrivalsPage").then((m) => ({ default: m.ArrivalsPage }))); const ChangeInventoryPage = lazy(() => import("./pages/Inventory/ChangeInventoryPage").then((m) => ({ default: m.ChangeInventoryPage })), ); const DailyControlPage = lazy(() => import("./pages/Inventory/DailyControlPage").then((m) => ({ default: m.DailyControlPage })), ); const WarehousesPage = lazy(() => import("./pages/Inventory/WarehousesPage").then((m) => ({ default: m.WarehousesPage })), ); const OrganizationPage = lazy(() => import("./pages/Inventory/OrganizationPage").then((m) => ({ default: m.OrganizationPage })), ); const AdminPanelPage = lazy(() => import("./pages/Admin/AdminPanel").then((m) => ({ default: m.AdminPanel })), ); function Loading() { return (