import { lazy, Suspense } from "react"; import { HashRouter, Route, Routes } from "react-router-dom"; import { ScrollToTop } from "./components/ScrollToTop"; import { DeepLinkHandler } from "./components/DeepLinkHandler"; // Eagerly load only the most-visited pages import Index from "./pages/Index"; // Lazy load everything else — each page becomes its own JS chunk const MapPage = lazy(() => import("./pages/MapPage")); const EventsPage = lazy(() => import("./pages/EventsPage")); const LabPage = lazy(() => import("./pages/LabPage")); const WalletPage = lazy(() => import("./pages/WalletPage")); const SettingsPage = lazy(() => import("./pages/SettingsPage")); const CreateSpotPage = lazy(() => import("./pages/CreateSpotPage")); const CreateShopPage = lazy(() => import("./pages/CreateShopPage")); const CreateEventPage = lazy(() => import("./pages/CreateEventPage")); const CreateListingPage = lazy(() => import("./pages/CreateListingPage")); const CreateTourPage = lazy(() => import("./pages/CreateTourPage")); const EditSpotPage = lazy(() => import("./pages/EditSpotPage")); const EditShopPage = lazy(() => import("./pages/EditShopPage")); const EditEventPage = lazy(() => import("./pages/EditEventPage")); const GearSwapPage = lazy(() => import("./pages/GearSwapPage")); const SpotDetailPage = lazy(() => import("./pages/SpotDetailPage")); const ShopDetailPage = lazy(() => import("./pages/ShopDetailPage")); const EventDetailPage = lazy(() => import("./pages/EventDetailPage")); const OnboardingPage = lazy(() => import("./pages/OnboardingPage")); const PyramidPage = lazy(() => import("./pages/PyramidPage")); const BecomeCoachPage = lazy(() => import("./pages/BecomeCoachPage")); const BecomeFilmerPage = lazy(() => import("./pages/BecomeFilmerPage")); const BecomeEditorPage = lazy(() => import("./pages/BecomeEditorPage")); const CoachDetailPage = lazy(() => import("./pages/CoachDetailPage")); const TourDetailPage = lazy(() => import("./pages/TourDetailPage")); const AboutPage = lazy(() => import("./pages/AboutPage")); const FAQPage = lazy(() => import("./pages/FAQPage")); const FoodPage = lazy(() => import("./pages/FoodPage")); const CommunityStatsPage = lazy(() => import("./pages/CommunityStatsPage")); const SpotCollectionsPage = lazy(() => import("./pages/SpotCollectionsPage")); const CollectionDetailPage = lazy(() => import("./pages/CollectionDetailPage")); const DirectMessagesPage = lazy(() => import("./pages/DirectMessagesPage")); const ConversationPage = lazy(() => import("./pages/ConversationPage")); const BountyLeaderboardPage = lazy(() => import("./pages/BountyLeaderboardPage")); const SignersPage = lazy(() => import("./pages/SignersPage")); const StashPage = lazy(() => import("./pages/StashPage")); const NIP19Page = lazy(() => import("./pages/NIP19Page").then(m => ({ default: m.NIP19Page }))); const LicensePage = lazy(() => import("./pages/LicensePage")); const SupportersPage = lazy(() => import("./pages/SupportersPage")); const RiderCardPage = lazy(() => import("./pages/RiderCardPage")); const AmberCallbackPage = lazy(() => import("./pages/AmberCallbackPage")); const MarketplacePage = lazy(() => import("./pages/MarketplacePage")); const NewsletterPage = lazy(() => import("./pages/NewsletterPage")); const NotFound = lazy(() => import("./pages/NotFound")); // Minimal inline fallback — no extra component needed function PageLoader() { return (
); } export function AppRouter() { return ( }> } /> } /> } /> } /> {/* Legacy route redirect */} } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> {/* Bounty System */} } /> {/* Security & Signers */} } /> {/* Stash - Private Inventory */} } /> {/* Info pages */} } /> } /> } /> {/* Amber NIP-55 callback — Amber redirects here after signing/login */} } /> {/* Marketplace */} } /> {/* Newsletter */} } /> {/* NIP-19 route for npub1, note1, naddr1, nevent1, nprofile1 */} } /> {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} } /> ); } export default AppRouter;