317 lines
12 KiB
TypeScript
317 lines
12 KiB
TypeScript
import { lazy, Suspense } from 'react'
|
|
import { Route, Routes } from 'react-router-dom'
|
|
|
|
import { PageLoading } from '@/components/PageLoading'
|
|
import { NotFoundPage } from '@/features/NotFoundPage'
|
|
import { StorefrontLayout } from '@/layouts/StorefrontLayout'
|
|
|
|
const ListingListPage = lazy(() =>
|
|
import('@/features/listings/ListingListPage').then(module => ({
|
|
default: module.ListingListPage,
|
|
}))
|
|
)
|
|
const ListingDetailPage = lazy(() =>
|
|
import('@/features/listings/ListingDetailPage').then(module => ({
|
|
default: module.ListingDetailPage,
|
|
}))
|
|
)
|
|
const ListingCollectionsPage = lazy(() =>
|
|
import('@/features/listings/ListingCollectionsPage').then(module => ({
|
|
default: module.ListingCollectionsPage,
|
|
}))
|
|
)
|
|
const SellerListingsPage = lazy(() =>
|
|
import('@/features/seller/SellerListingsPage').then(module => ({
|
|
default: module.SellerListingsPage,
|
|
}))
|
|
)
|
|
const SellerListingDetailPage = lazy(() =>
|
|
import('@/features/seller/SellerListingDetailPage').then(module => ({
|
|
default: module.SellerListingDetailPage,
|
|
}))
|
|
)
|
|
const SellerListingFormPage = lazy(() =>
|
|
import('@/features/seller/SellerListingFormPage').then(module => ({
|
|
default: module.SellerListingFormPage,
|
|
}))
|
|
)
|
|
const SellerHandoffsPage = lazy(() =>
|
|
import('@/features/seller/SellerHandoffsPage').then(module => ({
|
|
default: module.SellerHandoffsPage,
|
|
}))
|
|
)
|
|
const SellerEarningsPage = lazy(() =>
|
|
import('@/features/seller/SellerEarningsPage').then(module => ({
|
|
default: module.SellerEarningsPage,
|
|
}))
|
|
)
|
|
const SellerPickupsPage = lazy(() =>
|
|
import('@/features/seller/SellerPickupsPage').then(module => ({
|
|
default: module.SellerPickupsPage,
|
|
}))
|
|
)
|
|
const OrderListPage = lazy(() =>
|
|
import('@/features/orders/OrderListPage').then(module => ({ default: module.OrderListPage }))
|
|
)
|
|
const OrderDetailPage = lazy(() =>
|
|
import('@/features/orders/OrderDetailPage').then(module => ({ default: module.OrderDetailPage }))
|
|
)
|
|
const WalletPage = lazy(() =>
|
|
import('@/features/wallet/WalletPage').then(module => ({ default: module.WalletPage }))
|
|
)
|
|
const PaymentAccountsPage = lazy(() =>
|
|
import('@/features/wallet/PaymentAccountsPage').then(module => ({
|
|
default: module.PaymentAccountsPage,
|
|
}))
|
|
)
|
|
const WithdrawalPage = lazy(() =>
|
|
import('@/features/wallet/WithdrawalPage').then(module => ({ default: module.WithdrawalPage }))
|
|
)
|
|
const AnnouncementsPage = lazy(() =>
|
|
import('@/features/announcements/AnnouncementsPage').then(module => ({
|
|
default: module.AnnouncementsPage,
|
|
}))
|
|
)
|
|
const AnnouncementDetailPage = lazy(() =>
|
|
import('@/features/announcements/AnnouncementDetailPage').then(module => ({
|
|
default: module.AnnouncementDetailPage,
|
|
}))
|
|
)
|
|
const NotificationsPage = lazy(() =>
|
|
import('@/features/notifications/NotificationsPage').then(module => ({
|
|
default: module.NotificationsPage,
|
|
}))
|
|
)
|
|
const InvitationsPage = lazy(() =>
|
|
import('@/features/invitations/InvitationsPage').then(module => ({
|
|
default: module.InvitationsPage,
|
|
}))
|
|
)
|
|
const InviteLandingPage = lazy(() =>
|
|
import('@/features/invitations/InviteLandingPage').then(module => ({
|
|
default: module.InviteLandingPage,
|
|
}))
|
|
)
|
|
const CrashListPage = lazy(() =>
|
|
import('@/features/crash/CrashListPage').then(module => ({ default: module.CrashListPage }))
|
|
)
|
|
const CrashDetailPage = lazy(() =>
|
|
import('@/features/crash/CrashDetailPage').then(module => ({ default: module.CrashDetailPage }))
|
|
)
|
|
const CrashOrdersPage = lazy(() =>
|
|
import('@/features/crash/CrashOrdersPage').then(module => ({ default: module.CrashOrdersPage }))
|
|
)
|
|
const MessagesPage = lazy(() =>
|
|
import('@/features/messages/MessagesPage').then(module => ({ default: module.MessagesPage }))
|
|
)
|
|
const ChatPage = lazy(() =>
|
|
import('@/features/messages/ChatPage').then(module => ({ default: module.ChatPage }))
|
|
)
|
|
const LoginPage = lazy(() =>
|
|
import('@/features/auth/LoginPage').then(module => ({ default: module.LoginPage }))
|
|
)
|
|
const RegisterPage = lazy(() =>
|
|
import('@/features/auth/RegisterPage').then(module => ({ default: module.RegisterPage }))
|
|
)
|
|
const MobileLayout = lazy(() =>
|
|
import('@/layouts/MobileLayout').then(module => ({ default: module.MobileLayout }))
|
|
)
|
|
const MobileHomePage = lazy(() =>
|
|
import('@/features/mobile/MobileHomePage').then(module => ({ default: module.MobileHomePage }))
|
|
)
|
|
const MobileListingDetailPage = lazy(() =>
|
|
import('@/features/mobile/MobileListingDetailPage').then(module => ({
|
|
default: module.MobileListingDetailPage,
|
|
}))
|
|
)
|
|
const MobileProfilePage = lazy(() =>
|
|
import('@/features/mobile/MobileProfilePage').then(module => ({
|
|
default: module.MobileProfilePage,
|
|
}))
|
|
)
|
|
const MobileWithdrawalPage = lazy(() =>
|
|
import('@/features/mobile/MobileWithdrawalPage').then(module => ({
|
|
default: module.MobileWithdrawalPage,
|
|
}))
|
|
)
|
|
const MobileAnnouncementsPage = lazy(() =>
|
|
import('@/features/mobile/MobileAnnouncementsPage').then(module => ({
|
|
default: module.MobileAnnouncementsPage,
|
|
}))
|
|
)
|
|
const MobileAnnouncementDetailPage = lazy(() =>
|
|
import('@/features/mobile/MobileAnnouncementDetailPage').then(module => ({
|
|
default: module.MobileAnnouncementDetailPage,
|
|
}))
|
|
)
|
|
const MobileListingCollectionsPage = lazy(() =>
|
|
import('@/features/mobile/MobileListingCollectionsPage').then(module => ({
|
|
default: module.MobileListingCollectionsPage,
|
|
}))
|
|
)
|
|
const MobileInviteLandingPage = lazy(() =>
|
|
import('@/features/mobile/MobileInviteLandingPage').then(module => ({
|
|
default: module.MobileInviteLandingPage,
|
|
}))
|
|
)
|
|
const MobileNotificationsPage = lazy(() =>
|
|
import('@/features/mobile/MobileNotificationsPage').then(module => ({
|
|
default: module.MobileNotificationsPage,
|
|
}))
|
|
)
|
|
const MobileInvitationsPage = lazy(() =>
|
|
import('@/features/mobile/MobileInvitationsPage').then(module => ({
|
|
default: module.MobileInvitationsPage,
|
|
}))
|
|
)
|
|
const MobileRegisterPage = lazy(() =>
|
|
import('@/features/mobile/MobileRegisterPage').then(module => ({
|
|
default: module.MobileRegisterPage,
|
|
}))
|
|
)
|
|
const MobileAddHomeGuidePage = lazy(() =>
|
|
import('@/features/mobile/MobileAddHomeGuidePage').then(module => ({
|
|
default: module.MobileAddHomeGuidePage,
|
|
}))
|
|
)
|
|
const MobileCrashListPage = lazy(() =>
|
|
import('@/features/mobile/MobileCrashListPage').then(module => ({
|
|
default: module.MobileCrashListPage,
|
|
}))
|
|
)
|
|
const MobileCrashDetailPage = lazy(() =>
|
|
import('@/features/mobile/MobileCrashDetailPage').then(module => ({
|
|
default: module.MobileCrashDetailPage,
|
|
}))
|
|
)
|
|
const MobileCrashOrdersPage = lazy(() =>
|
|
import('@/features/mobile/MobileCrashOrdersPage').then(module => ({
|
|
default: module.MobileCrashOrdersPage,
|
|
}))
|
|
)
|
|
const MobileOrdersPage = lazy(() =>
|
|
import('@/features/mobile/MobileOrdersPage').then(module => ({
|
|
default: module.MobileOrdersPage,
|
|
}))
|
|
)
|
|
const MobileOrderDetailPage = lazy(() =>
|
|
import('@/features/mobile/MobileOrderDetailPage').then(module => ({
|
|
default: module.MobileOrderDetailPage,
|
|
}))
|
|
)
|
|
const MobileMessagesPage = lazy(() =>
|
|
import('@/features/mobile/MobileMessagesPage').then(module => ({
|
|
default: module.MobileMessagesPage,
|
|
}))
|
|
)
|
|
const MobileChatPage = lazy(() =>
|
|
import('@/features/mobile/MobileChatPage').then(module => ({
|
|
default: module.MobileChatPage,
|
|
}))
|
|
)
|
|
const MobileRealnamePage = lazy(() =>
|
|
import('@/features/mobile/MobileRealnamePage').then(module => ({
|
|
default: module.MobileRealnamePage,
|
|
}))
|
|
)
|
|
const MobileSellerListingsPage = lazy(() =>
|
|
import('@/features/mobile/MobileSellerListingsPage').then(module => ({
|
|
default: module.MobileSellerListingsPage,
|
|
}))
|
|
)
|
|
const MobileSellerListingDetailPage = lazy(() =>
|
|
import('@/features/mobile/MobileSellerListingDetailPage').then(module => ({
|
|
default: module.MobileSellerListingDetailPage,
|
|
}))
|
|
)
|
|
const MobileSellerFormPage = lazy(() =>
|
|
import('@/features/mobile/MobileSellerFormPage').then(module => ({
|
|
default: module.MobileSellerFormPage,
|
|
}))
|
|
)
|
|
const ProfilePage = lazy(() =>
|
|
import('@/features/profile/ProfilePage').then(module => ({ default: module.ProfilePage }))
|
|
)
|
|
const RealnamePage = lazy(() =>
|
|
import('@/features/realname/RealnamePage').then(module => ({ default: module.RealnamePage }))
|
|
)
|
|
const ProcessPage = lazy(() =>
|
|
import('@/features/help/ProcessPage').then(module => ({ default: module.ProcessPage }))
|
|
)
|
|
const RulesPage = lazy(() =>
|
|
import('@/features/help/RulesPage').then(module => ({ default: module.RulesPage }))
|
|
)
|
|
export function AppRouter() {
|
|
return (
|
|
<Suspense fallback={<PageLoading />}>
|
|
<Routes>
|
|
<Route element={<StorefrontLayout />}>
|
|
<Route index element={<ListingListPage />} />
|
|
<Route path="listings/collections" element={<ListingCollectionsPage />} />
|
|
<Route path="listings/:id" element={<ListingDetailPage />} />
|
|
<Route path="orders" element={<OrderListPage />} />
|
|
<Route path="orders/:id" element={<OrderDetailPage />} />
|
|
<Route path="wallet" element={<WalletPage />} />
|
|
<Route path="wallet/payment-accounts" element={<PaymentAccountsPage />} />
|
|
<Route path="wallet/withdrawal" element={<WithdrawalPage />} />
|
|
<Route path="announcements" element={<AnnouncementsPage />} />
|
|
<Route path="announcements/:id" element={<AnnouncementDetailPage />} />
|
|
<Route path="notifications" element={<NotificationsPage />} />
|
|
<Route path="invitations" element={<InvitationsPage />} />
|
|
<Route path="crash" element={<CrashListPage />} />
|
|
<Route path="crash/orders" element={<CrashOrdersPage />} />
|
|
<Route path="crash/:id" element={<CrashDetailPage />} />
|
|
<Route path="messages" element={<MessagesPage />} />
|
|
<Route path="messages/:id" element={<ChatPage />} />
|
|
<Route path="profile" element={<ProfilePage />} />
|
|
<Route path="realname" element={<RealnamePage />} />
|
|
<Route path="process" element={<ProcessPage />} />
|
|
<Route path="rules" element={<RulesPage />} />
|
|
<Route path="seller/listings" element={<SellerListingsPage />} />
|
|
<Route path="seller/listings/new" element={<SellerListingFormPage />} />
|
|
<Route path="seller/listings/:id" element={<SellerListingDetailPage />} />
|
|
<Route path="seller/listings/:id/edit" element={<SellerListingFormPage />} />
|
|
<Route path="seller/handoffs" element={<SellerHandoffsPage />} />
|
|
<Route path="seller/earnings" element={<SellerEarningsPage />} />
|
|
<Route path="seller/pickups" element={<SellerPickupsPage />} />
|
|
</Route>
|
|
|
|
<Route path="/login" element={<LoginPage />} />
|
|
<Route path="/register" element={<RegisterPage />} />
|
|
<Route path="/i/:code" element={<InviteLandingPage />} />
|
|
<Route path="/m/login" element={<LoginPage />} />
|
|
|
|
<Route path="/m" element={<MobileLayout />}>
|
|
<Route index element={<MobileHomePage />} />
|
|
<Route path="listings" element={<MobileHomePage />} />
|
|
<Route path="listings/collections" element={<MobileListingCollectionsPage />} />
|
|
<Route path="listings/:id" element={<MobileListingDetailPage />} />
|
|
<Route path="orders" element={<MobileOrdersPage />} />
|
|
<Route path="orders/:id" element={<MobileOrderDetailPage />} />
|
|
<Route path="messages" element={<MobileMessagesPage />} />
|
|
<Route path="messages/:id" element={<MobileChatPage />} />
|
|
<Route path="realname" element={<MobileRealnamePage />} />
|
|
<Route path="seller/listings" element={<MobileSellerListingsPage />} />
|
|
<Route path="seller/listings/new" element={<MobileSellerFormPage />} />
|
|
<Route path="seller/listings/:id" element={<MobileSellerListingDetailPage />} />
|
|
<Route path="seller/listings/:id/edit" element={<MobileSellerFormPage />} />
|
|
<Route path="profile" element={<MobileProfilePage />} />
|
|
<Route path="wallet/withdrawal" element={<MobileWithdrawalPage />} />
|
|
<Route path="announcements" element={<MobileAnnouncementsPage />} />
|
|
<Route path="announcements/:id" element={<MobileAnnouncementDetailPage />} />
|
|
<Route path="notifications" element={<MobileNotificationsPage />} />
|
|
<Route path="invitations" element={<MobileInvitationsPage />} />
|
|
<Route path="i/:code" element={<MobileInviteLandingPage />} />
|
|
<Route path="register" element={<MobileRegisterPage />} />
|
|
<Route path="add-home-guide" element={<MobileAddHomeGuidePage />} />
|
|
<Route path="crash" element={<MobileCrashListPage />} />
|
|
<Route path="crash/orders" element={<MobileCrashOrdersPage />} />
|
|
<Route path="crash/:id" element={<MobileCrashDetailPage />} />
|
|
</Route>
|
|
|
|
<Route path="*" element={<NotFoundPage />} />
|
|
</Routes>
|
|
</Suspense>
|
|
)
|
|
}
|