veza/apps/web/src/router/routeConfig.tsx
senke ecc9362c47 fix(web): gate ghost routes behind ComingSoon placeholder component
- Create ComingSoon.tsx: simple placeholder showing feature name and
  "under development" message with proper Tailwind styling
- Replace LazyGear, LazyLive, LazyEducation, LazyQueue, LazyDeveloper
  route elements with <ComingSoon feature="..." />
- Remove unused lazy imports for ghost components

Users navigating to /gear, /live, /education, /queue, /developer will
now see a clear "Coming Soon" message instead of broken components
that depend on non-existent backend APIs.

Addresses audit finding D5: 5 ghost routes without backend.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 23:23:26 +01:00

109 lines
4.1 KiB
TypeScript

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,
} from '@/components/ui/LazyComponent';
import { ComingSoon } from '@/components/ui/ComingSoon';
import { PublicRoute } from './PublicRoute';
import { ProtectedLayoutRoute } from './ProtectedLayoutRoute';
import type { RouteEntry } from './types';
function wrapPublic(element: React.ReactNode): React.ReactNode {
return (
<PublicRoute>
<ErrorBoundary>{element}</ErrorBoundary>
</PublicRoute>
);
}
function wrapProtected(element: React.ReactNode): React.ReactNode {
return (
<ProtectedRoute>
<ProtectedLayoutRoute>
<ErrorBoundary>{element}</ErrorBoundary>
</ProtectedLayoutRoute>
</ProtectedRoute>
);
}
export function getPublicRoutes(): RouteEntry[] {
return [
{ path: '/login', element: wrapPublic(<LazyLogin />) },
{ path: '/register', element: wrapPublic(<LazyRegister />) },
{ path: '/forgot-password', element: wrapPublic(<LazyForgotPassword />) },
{ path: '/verify-email', element: wrapPublic(<LazyVerifyEmail />) },
{ path: '/reset-password', element: wrapPublic(<LazyResetPassword />) },
];
}
export function getPublicStandaloneRoutes(): RouteEntry[] {
return [
{ path: '/design-system', element: <ErrorBoundary><LazyDesignSystemDemo /></ErrorBoundary> },
{ path: '/u/:username', element: <ErrorBoundary><LazyUserProfile /></ErrorBoundary> },
];
}
export function getProtectedRoutes(): RouteEntry[] {
return [
{ path: '/dashboard', element: wrapProtected(<LazyDashboard />) },
{ path: '/marketplace', element: wrapProtected(<LazyMarketplace />) },
{ path: '/sell', element: wrapProtected(<LazySellerDashboard onCreateProduct={() => {}} />) },
{ path: '/wishlist', element: wrapProtected(<LazyWishlist />) },
{ path: '/purchases', element: wrapProtected(<LazyPurchases />) },
{ path: '/chat', element: wrapProtected(<LazyChat />) },
{ path: '/library', element: wrapProtected(<LazyLibrary />) },
{ path: '/profile', element: wrapProtected(<LazyProfile />) },
{ path: '/settings', element: wrapProtected(<LazySettings />) },
{ path: '/settings/sessions', element: wrapProtected(<LazySessions />) },
{ path: '/admin/roles', element: wrapProtected(<LazyRoles />) },
{ path: '/tracks/:id', element: wrapProtected(<LazyTrackDetail />) },
{ path: '/playlists/*', element: wrapProtected(<LazyPlaylistRoutes />) },
{ path: '/search', element: wrapProtected(<LazySearch />) },
{ path: '/notifications', element: wrapProtected(<LazyNotifications />) },
{ path: '/analytics', element: wrapProtected(<LazyAnalytics onNavigateTrack={() => {}} />) },
{ path: '/webhooks', element: wrapProtected(<LazyWebhooks />) },
{ path: '/admin', element: wrapProtected(<LazyAdminDashboard />) },
{ path: '/social', element: wrapProtected(<LazySocial onViewProfile={() => {}} />) },
// PLANNED — no backend yet: gated behind ComingSoon placeholder
{ path: '/gear', element: wrapProtected(<ComingSoon feature="Gear" />) },
{ path: '/live', element: wrapProtected(<ComingSoon feature="Live" />) },
{ path: '/education', element: wrapProtected(<ComingSoon feature="Education" />) },
{ path: '/queue', element: wrapProtected(<ComingSoon feature="Queue" />) },
{ path: '/developer', element: wrapProtected(<ComingSoon feature="Developer" />) },
];
}
export function getErrorRoutes(): RouteEntry[] {
return [
{ path: '/404', element: <ErrorBoundary><LazyNotFound /></ErrorBoundary> },
{ path: '/500', element: <ErrorBoundary><LazyServerError /></ErrorBoundary> },
];
}