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 the map — it's now the homepage import MapPage from "./pages/MapPage"; // Lazy load everything else — each page becomes its own JS chunk const Index = lazy(() => import("./pages/Index")); 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 BecomePhotographerPage = lazy(() => import("./pages/BecomePhotographerPage")); const BecomeBuilderPage = lazy(() => import("./pages/BecomeBuilderPage")); const BecomeArtistPage = lazy(() => import("./pages/BecomeArtistPage")); const BecomeGraffitiPage = lazy(() => import("./pages/BecomeGraffitiPage")); const BecomeTattooPage = lazy(() => import("./pages/BecomeTattooPage")); const BecomeTrainerPage = lazy(() => import("./pages/BecomeTrainerPage")); const BecomeMusicianPage = lazy(() => import("./pages/BecomeMusicianPage")); const BecomeJudgePage = lazy(() => import("./pages/BecomeJudgePage")); const BecomeSkaterPage = lazy(() => import("./pages/BecomeSkaterPage")); const SkatersPage = lazy(() => import("./pages/SkatersPage")); const CrewsPage = lazy(() => import("./pages/CrewsPage")); const CreateCrewPage = lazy(() => import("./pages/CreateCrewPage")); const EditCrewPage = lazy(() => import("./pages/EditCrewPage")); const CrewDetailPage = lazy(() => import("./pages/CrewDetailPage")); 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 ContactsPage = lazy(() => import("./pages/ContactsPage")); 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 PrivacyPage = lazy(() => import("./pages/PrivacyPage")); 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 GlossaryPage = lazy(() => import("./pages/GlossaryPage")); const NotFound = lazy(() => import("./pages/NotFound")); // Minimal inline fallback — no extra component needed function PageLoader() { return (
); } export function AppRouter() { return ( }> {/* Map is the homepage */} } /> {/* /map redirects to / */} } /> {/* Legacy home page still accessible */} } /> } /> } /> {/* Legacy route redirect */} } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> {/* Bounty System */} } /> {/* Security & Signers */} } /> {/* Stash - Private Inventory */} } /> {/* Info pages */} } /> } /> } /> } /> {/* Amber NIP-55 callback — Amber redirects here after signing/login */} } /> {/* Marketplace */} } /> {/* Newsletter */} } /> {/* Trick Glossary */} } /> {/* NIP-19 route for npub1, note1, naddr1, nevent1, nprofile1 */} } /> {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} } /> ); } export default AppRouter;