import React, { Suspense, lazy } from 'react'; import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; import { Helmet, HelmetProvider } from 'react-helmet-async'; import { Toaster } from '@/components/ui/toaster'; import { SupabaseAuthProvider } from '@/contexts/SupabaseAuthContext'; import { TenantProvider } from '@/contexts/TenantContext'; import ScrollToTop from '@/components/common/ScrollToTop'; import LoadingSpinner from '@/components/common/LoadingSpinner'; // Layout Components const PublicLayout = lazy(() => import('@/components/layout/PublicLayout')); const DashboardLayout = lazy(() => import('@/components/layout/DashboardLayout')); const AdminLayout = lazy(() => import('@/components/layout/AdminLayout')); const ProtectedRoute = lazy(() => import('@/components/auth/ProtectedRoute')); // Public Pages const LandingPage = lazy(() => import('@/pages/LandingPage.jsx')); const AboutPage = lazy(() => import('@/pages/AboutPage.jsx')); const ContactPage = lazy(() => import('@/pages/ContactPage.jsx')); const FAQPage = lazy(() => import('@/pages/FAQPage.jsx')); const AddressesPage = lazy(() => import('@/pages/AddressesPage.jsx')); const PricingPage = lazy(() => import('@/pages/PricingPage.jsx')); const LoginPage = lazy(() => import('@/pages/LoginPage.jsx')); const SignupPage = lazy(() => import('@/pages/SignupPage.jsx')); const TermsPage = lazy(() => import('@/pages/legal/TermsPage.jsx')); const PrivacyPage = lazy(() => import('@/pages/legal/PrivacyPage.jsx')); const RefundPage = lazy(() => import('@/pages/legal/RefundPage.jsx')); const BusinessSetupPage = lazy(() => import('@/pages/services/BusinessSetupPage.jsx')); const MailServicePage = lazy(() => import('@/pages/services/MailServicePage.jsx')); const PhoneServicePage = lazy(() => import('@/pages/services/PhoneServicePage.jsx')); const BlogPage = lazy(() => import('@/pages/blog/BlogPage.jsx')); const BlogPostPage = lazy(() => import('@/pages/blog/BlogPostPage.jsx')); // Subscription & Checkout const SubscribePage = lazy(() => import('@/pages/SubscribePage.jsx')); const CheckoutCallbackPage = lazy(() => import('@/pages/CheckoutCallbackPage.jsx')); // Protected Pages const DashboardPage = lazy(() => import('@/pages/dashboard/DashboardPage.jsx')); const BillingPage = lazy(() => import('@/pages/dashboard/BillingPage.jsx')); const MailPage = lazy(() => import('@/pages/dashboard/MailPage.jsx')); const PhonePage = lazy(() => import('@/pages/dashboard/PhonePage.jsx')); const SMSPage = lazy(() => import('@/pages/dashboard/SMSPage.jsx')); const MyDetailsPage = lazy(() => import('@/pages/dashboard/MyDetailsPage.jsx')); const TeamPage = lazy(() => import('@/pages/dashboard/TeamPage.jsx')); const SettingsPage = lazy(() => import('@/pages/dashboard/SettingsPage.jsx')); // Admin Pages const AdminDashboard = lazy(() => import('@/pages/admin/AdminDashboard.jsx')); const AdminTenants = lazy(() => import('@/pages/admin/AdminTenants.jsx')); const AdminUsers = lazy(() => import('@/pages/admin/AdminUsers.jsx')); const AdminKYC = lazy(() => import('@/pages/admin/AdminKYC.jsx')); const PageLoader = () => (
); function App() { const siteUrl = 'https://virtualofficesdubai.ae'; const defaultTitle = 'Virtual Office Dubai'; const defaultDescription = 'Virtual Office Dubai provides compliant business addresses with AI phone assistants and local office numbers, based in Dubai, UAE.'; const ogImageUrl = 'https://horizons-cdn.hostinger.com/b1db84ec-6e36-4e1a-8c05-742d1acfcdca/b1716431fa6c4c2d76549173e74e5352.jpg'; const schema = { '@context': 'https://schema.org', '@graph': [ { '@type': 'Organization', name: 'Virtual Office Dubai', url: siteUrl, logo: ogImageUrl, contactPoint: { '@type': 'ContactPoint', telephone: '+971-4-123-4567', 'contactType': 'Customer Service', }, }, { '@type': 'WebSite', url: siteUrl, potentialAction: { '@type': 'SearchAction', target: { '@type': 'EntryPoint', 'urlTemplate': `${siteUrl}/search?q={search_term_string}`, }, 'query-input': 'required name=search_term_string', }, }, ], }; return (
{/* Public Routes */} }>}> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> {/* Subscription and Checkout Routes */} }>} /> }>} /> {/* Dashboard Routes */} }> }> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> }>} /> {/* Admin Pages */} }> }> }>} /> }>} /> }>} /> }>} />
); } export default App;