import React from 'react'; import { ErrorBoundary } from '@/components/ErrorBoundary'; import { ProtectedRoute } from '@/components/auth/ProtectedRoute'; import { LazyLogin, LazyRegister, LazyForgotPassword, LazyVerifyEmail, LazyResetPassword, LazyDashboard, LazyChat, LazyLibrary, LazyProfile, LazySettings, LazySessions, LazyNotFound, LazyServerError, LazyUserProfile, LazyRoles, LazyTrackDetail, LazyPlaylistRoutes, LazyMarketplace, LazySearch, LazyNotifications, LazyAnalytics, LazyWebhooks, LazyAdminDashboard, LazyDesignSystemDemo, LazySocial, LazySellerDashboard, LazyWishlist, LazyPurchases, LazyCheckoutComplete, LazyQueue, LazyDeveloper, LazyGear, LazyLive, } from '@/components/ui/LazyComponent'; import { PublicRoute } from './PublicRoute'; import { ProtectedLayoutRoute } from './ProtectedLayoutRoute'; import type { RouteEntry } from './types'; function wrapPublic(element: React.ReactNode): React.ReactNode { return ( {element} ); } function wrapProtected(element: React.ReactNode): React.ReactNode { return ( {element} ); } export function getPublicRoutes(): RouteEntry[] { return [ { path: '/login', element: wrapPublic() }, { path: '/register', element: wrapPublic() }, { path: '/forgot-password', element: wrapPublic() }, { path: '/verify-email', element: wrapPublic() }, { path: '/reset-password', element: wrapPublic() }, ]; } export function getPublicStandaloneRoutes(): RouteEntry[] { return [ { path: '/design-system', element: }, { path: '/u/:username', element: }, ]; } export function getProtectedRoutes(): RouteEntry[] { return [ { path: '/dashboard', element: wrapProtected() }, { path: '/marketplace', element: wrapProtected() }, { path: '/sell', element: wrapProtected( {}} />) }, { path: '/wishlist', element: wrapProtected() }, { path: '/purchases', element: wrapProtected() }, { path: '/checkout/complete', element: wrapProtected() }, { path: '/chat', element: wrapProtected() }, { path: '/library', element: wrapProtected() }, { path: '/profile', element: wrapProtected() }, { path: '/settings', element: wrapProtected() }, { path: '/settings/sessions', element: wrapProtected() }, { path: '/admin/roles', element: wrapProtected() }, { path: '/tracks/:id', element: wrapProtected() }, { path: '/playlists/*', element: wrapProtected() }, { path: '/search', element: wrapProtected() }, { path: '/notifications', element: wrapProtected() }, { path: '/analytics', element: wrapProtected() }, { path: '/webhooks', element: wrapProtected() }, { path: '/admin', element: wrapProtected() }, { path: '/social', element: wrapProtected() }, { path: '/queue', element: wrapProtected() }, { path: '/developer', element: wrapProtected() }, // Gear: connected to backend inventory API { path: '/gear', element: wrapProtected() }, // Live: connected to backend live streams API { path: '/live', element: wrapProtected() }, ]; } export function getErrorRoutes(): RouteEntry[] { return [ { path: '/404', element: }, { path: '/500', element: }, ]; }