2026-02-07 03:16:37 +00:00
|
|
|
import React from 'react';
|
fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle
- Fix 98 TypeScript errors across 37 files:
- Service layer double-unwrapping (subscriptionService, distributionService, gearService)
- Self-referencing variables in SearchPageResults
- FeedView/ExploreView .posts→.items alignment
- useQueueSync Zustand subscribe API
- AdminAuditLogsView missing interface fields
- Toast proxy type, interceptor type narrowing
- 22 unused imports/variables removed
- 5 storybook mock data fixes
- Align frontend API calls with backend endpoints:
- Analytics: useAnalyticsView now calls /creator/analytics/dashboard (was /analytics)
- Chat: chatService uses /conversations (was mock data), WS URL from backend token
- Dashboard StatsSection: uses real /dashboard API data (was hardcoded zeros)
- Settings: suppress 2FA toast error when endpoint unavailable
- Fix marketplace products: seed uses 'active' status (was 'published')
- Enrich seed: admin follows all creators (feed has content)
- Optimize bundle: vendor catch-all 793KB→318KB gzip (-60%)
Split into vendor-charts, vendor-emoji, vendor-swagger, vendor-media, etc.
- Clean repo: remove ~100 orphaned screenshots, audit reports, logs from root
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:18:49 +00:00
|
|
|
import { Navigate, useNavigate } from 'react-router-dom';
|
2026-02-07 03:16:37 +00:00
|
|
|
import { ErrorBoundary } from '@/components/ErrorBoundary';
|
|
|
|
|
import { ProtectedRoute } from '@/components/auth/ProtectedRoute';
|
|
|
|
|
import {
|
2026-03-09 15:49:05 +00:00
|
|
|
LazySharedPlaylistPage,
|
2026-02-07 03:16:37 +00:00
|
|
|
LazyLogin,
|
|
|
|
|
LazyRegister,
|
|
|
|
|
LazyForgotPassword,
|
|
|
|
|
LazyVerifyEmail,
|
|
|
|
|
LazyResetPassword,
|
|
|
|
|
LazyDashboard,
|
|
|
|
|
LazyChat,
|
2026-03-06 17:52:08 +00:00
|
|
|
LazyChatJoin,
|
2026-02-07 03:16:37 +00:00
|
|
|
LazyLibrary,
|
|
|
|
|
LazySettings,
|
|
|
|
|
LazySessions,
|
|
|
|
|
LazyNotFound,
|
|
|
|
|
LazyServerError,
|
|
|
|
|
LazyUserProfile,
|
|
|
|
|
LazyRoles,
|
|
|
|
|
LazyTrackDetail,
|
|
|
|
|
LazyPlaylistRoutes,
|
|
|
|
|
LazyMarketplace,
|
|
|
|
|
LazySearch,
|
|
|
|
|
LazyNotifications,
|
|
|
|
|
LazyAnalytics,
|
|
|
|
|
LazyWebhooks,
|
|
|
|
|
LazyAdminDashboard,
|
2026-03-10 17:20:27 +00:00
|
|
|
LazyAdminModeration,
|
|
|
|
|
LazyAdminPlatform,
|
feat(v0.701): AdminTransfers page/route, MSW, stories, Deep Health, API ref, docs, scope v0.702
- Step 13: AdminTransfersPage, LazyAdminTransfers, route /admin/transfers
- Step 14: MSW handlers admin transfers
- Step 15: AdminTransfersView stories (Default, Empty, WithFailedTransfers, Error, Loading)
- Step 16-17: DeepHealth handler (disk, config), GET /health/deep
- Step 19: health_deep_test.go (4 tests)
- Step 20: docs/API_REFERENCE.md
- Step 21: Archive V0_604, MIGRATIONS.md migration 116
- Step 22: CHANGELOG, PROJECT_STATE, FEATURE_STATUS v0.701
- Step 23: RETROSPECTIVE_V0701, V0_702 placeholder, SCOPE_CONTROL, .cursorrules
- Step 24: Archive V0_701_RELEASE_SCOPE
- Fix: AdminTransfersView Select component (use options API)
2026-02-23 22:42:02 +00:00
|
|
|
LazyAdminTransfers,
|
2026-02-07 03:16:37 +00:00
|
|
|
LazyDesignSystemDemo,
|
|
|
|
|
LazySocial,
|
2026-03-09 00:52:56 +00:00
|
|
|
LazyFeed,
|
|
|
|
|
LazyDiscover,
|
2026-02-07 03:16:37 +00:00
|
|
|
LazySellerDashboard,
|
|
|
|
|
LazyWishlist,
|
|
|
|
|
LazyPurchases,
|
2026-02-23 23:17:39 +00:00
|
|
|
LazyProductDetail,
|
2026-02-22 13:42:15 +00:00
|
|
|
LazyCheckoutComplete,
|
Phase 2 stabilisation: code mort, Modal→Dialog, feature flags, tests, router split, Rust legacy
Bloc A - Code mort:
- Suppression Studio (components, views, features)
- Suppression gamification + services mock (projectService, storageService, gamificationService)
- Mise à jour Sidebar, Navbar, locales
Bloc B - Frontend:
- Suppression modal.tsx deprecated, Modal.stories (doublon Dialog)
- Feature flags: PLAYLIST_SEARCH, PLAYLIST_RECOMMENDATIONS, ROLE_MANAGEMENT = true
- Suppression 19 tests orphelins, retrait exclusions vitest.config
Bloc C - Backend:
- Extraction routes_auth.go depuis router.go
Bloc D - Rust:
- Suppression security_legacy.rs (code mort, patterns déjà dans security/)
2026-02-14 16:23:32 +00:00
|
|
|
LazyQueue,
|
|
|
|
|
LazyDeveloper,
|
|
|
|
|
LazyGear,
|
|
|
|
|
LazyLive,
|
2026-02-24 09:00:43 +00:00
|
|
|
LazyGoLive,
|
2026-03-10 12:34:16 +00:00
|
|
|
LazyListenTogether,
|
2026-02-22 17:30:49 +00:00
|
|
|
LazyCloud,
|
2026-03-10 18:37:35 +00:00
|
|
|
LazySubscription,
|
2026-03-10 18:54:45 +00:00
|
|
|
LazyDistribution,
|
2026-03-11 08:46:25 +00:00
|
|
|
LazyEducation,
|
2026-03-13 13:57:19 +00:00
|
|
|
LazySupport,
|
2026-03-23 18:13:20 +00:00
|
|
|
LazyLanding,
|
2026-02-07 03:16:37 +00:00
|
|
|
} from '@/components/ui/LazyComponent';
|
2026-04-05 14:19:16 +00:00
|
|
|
const LazyPrototype = React.lazy(() => import('@/features/prototype/PrototypePage'));
|
2026-02-07 03:16:37 +00:00
|
|
|
import { PublicRoute } from './PublicRoute';
|
|
|
|
|
import { ProtectedLayoutRoute } from './ProtectedLayoutRoute';
|
fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle
- Fix 98 TypeScript errors across 37 files:
- Service layer double-unwrapping (subscriptionService, distributionService, gearService)
- Self-referencing variables in SearchPageResults
- FeedView/ExploreView .posts→.items alignment
- useQueueSync Zustand subscribe API
- AdminAuditLogsView missing interface fields
- Toast proxy type, interceptor type narrowing
- 22 unused imports/variables removed
- 5 storybook mock data fixes
- Align frontend API calls with backend endpoints:
- Analytics: useAnalyticsView now calls /creator/analytics/dashboard (was /analytics)
- Chat: chatService uses /conversations (was mock data), WS URL from backend token
- Dashboard StatsSection: uses real /dashboard API data (was hardcoded zeros)
- Settings: suppress 2FA toast error when endpoint unavailable
- Fix marketplace products: seed uses 'active' status (was 'published')
- Enrich seed: admin follows all creators (feed has content)
- Optimize bundle: vendor catch-all 793KB→318KB gzip (-60%)
Split into vendor-charts, vendor-emoji, vendor-swagger, vendor-media, etc.
- Clean repo: remove ~100 orphaned screenshots, audit reports, logs from root
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:18:49 +00:00
|
|
|
import { useUser } from '@/features/auth/hooks/useUser';
|
2026-02-07 03:16:37 +00:00
|
|
|
import type { RouteEntry } from './types';
|
|
|
|
|
|
fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle
- Fix 98 TypeScript errors across 37 files:
- Service layer double-unwrapping (subscriptionService, distributionService, gearService)
- Self-referencing variables in SearchPageResults
- FeedView/ExploreView .posts→.items alignment
- useQueueSync Zustand subscribe API
- AdminAuditLogsView missing interface fields
- Toast proxy type, interceptor type narrowing
- 22 unused imports/variables removed
- 5 storybook mock data fixes
- Align frontend API calls with backend endpoints:
- Analytics: useAnalyticsView now calls /creator/analytics/dashboard (was /analytics)
- Chat: chatService uses /conversations (was mock data), WS URL from backend token
- Dashboard StatsSection: uses real /dashboard API data (was hardcoded zeros)
- Settings: suppress 2FA toast error when endpoint unavailable
- Fix marketplace products: seed uses 'active' status (was 'published')
- Enrich seed: admin follows all creators (feed has content)
- Optimize bundle: vendor catch-all 793KB→318KB gzip (-60%)
Split into vendor-charts, vendor-emoji, vendor-swagger, vendor-media, etc.
- Clean repo: remove ~100 orphaned screenshots, audit reports, logs from root
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:18:49 +00:00
|
|
|
/** Redirects /profile to /u/<current_username> */
|
|
|
|
|
function ProfileRedirect() {
|
|
|
|
|
const { data: user } = useUser();
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (user?.username) {
|
|
|
|
|
navigate(`/u/${user.username}`, { replace: true });
|
|
|
|
|
}
|
|
|
|
|
}, [user?.username, navigate]);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-07 03:16:37 +00:00
|
|
|
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>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-05 14:19:16 +00:00
|
|
|
function wrapAdminProtected(element: React.ReactNode): React.ReactNode {
|
|
|
|
|
return (
|
|
|
|
|
<ProtectedRoute requireAdmin>
|
|
|
|
|
<ProtectedLayoutRoute>
|
|
|
|
|
<ErrorBoundary>{element}</ErrorBoundary>
|
|
|
|
|
</ProtectedLayoutRoute>
|
|
|
|
|
</ProtectedRoute>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-07 03:16:37 +00:00
|
|
|
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 [
|
2026-03-23 18:13:20 +00:00
|
|
|
{ path: '/launch', element: <ErrorBoundary><LazyLanding /></ErrorBoundary> },
|
2026-02-07 03:16:37 +00:00
|
|
|
{ path: '/design-system', element: <ErrorBoundary><LazyDesignSystemDemo /></ErrorBoundary> },
|
2026-04-05 14:19:16 +00:00
|
|
|
{ path: '/prototype/*', element: <ErrorBoundary><React.Suspense fallback={null}><LazyPrototype /></React.Suspense></ErrorBoundary> },
|
2026-02-07 03:16:37 +00:00
|
|
|
{ path: '/u/:username', element: <ErrorBoundary><LazyUserProfile /></ErrorBoundary> },
|
feat(web): update all features, stories, e2e tests, and auth interceptor
Update auth, playlists, tracks, search, profile, dashboard, player,
settings, and social features. Add e2e audit specs for all major pages.
Update ESLint config, vitest config, and route configuration.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 17:16:36 +00:00
|
|
|
{ path: '/playlists/shared/:token', element: <ErrorBoundary><LazySharedPlaylistPage /></ErrorBoundary> },
|
2026-02-07 03:16:37 +00:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getProtectedRoutes(): RouteEntry[] {
|
|
|
|
|
return [
|
|
|
|
|
{ path: '/dashboard', element: wrapProtected(<LazyDashboard />) },
|
|
|
|
|
{ path: '/marketplace', element: wrapProtected(<LazyMarketplace />) },
|
2026-02-23 23:17:39 +00:00
|
|
|
{ path: '/marketplace/products/:id', element: wrapProtected(<LazyProductDetail />) },
|
2026-02-07 03:16:37 +00:00
|
|
|
{ path: '/sell', element: wrapProtected(<LazySellerDashboard onCreateProduct={() => {}} />) },
|
|
|
|
|
{ path: '/wishlist', element: wrapProtected(<LazyWishlist />) },
|
|
|
|
|
{ path: '/purchases', element: wrapProtected(<LazyPurchases />) },
|
2026-02-22 13:42:15 +00:00
|
|
|
{ path: '/checkout/complete', element: wrapProtected(<LazyCheckoutComplete />) },
|
2026-03-06 17:52:08 +00:00
|
|
|
{ path: '/chat/join/:token', element: wrapProtected(<LazyChatJoin />) },
|
2026-02-07 03:16:37 +00:00
|
|
|
{ path: '/chat', element: wrapProtected(<LazyChat />) },
|
|
|
|
|
{ path: '/library', element: wrapProtected(<LazyLibrary />) },
|
fix: stabilize frontend — 98 TS errors to 0, align API endpoints, optimize bundle
- Fix 98 TypeScript errors across 37 files:
- Service layer double-unwrapping (subscriptionService, distributionService, gearService)
- Self-referencing variables in SearchPageResults
- FeedView/ExploreView .posts→.items alignment
- useQueueSync Zustand subscribe API
- AdminAuditLogsView missing interface fields
- Toast proxy type, interceptor type narrowing
- 22 unused imports/variables removed
- 5 storybook mock data fixes
- Align frontend API calls with backend endpoints:
- Analytics: useAnalyticsView now calls /creator/analytics/dashboard (was /analytics)
- Chat: chatService uses /conversations (was mock data), WS URL from backend token
- Dashboard StatsSection: uses real /dashboard API data (was hardcoded zeros)
- Settings: suppress 2FA toast error when endpoint unavailable
- Fix marketplace products: seed uses 'active' status (was 'published')
- Enrich seed: admin follows all creators (feed has content)
- Optimize bundle: vendor catch-all 793KB→318KB gzip (-60%)
Split into vendor-charts, vendor-emoji, vendor-swagger, vendor-media, etc.
- Clean repo: remove ~100 orphaned screenshots, audit reports, logs from root
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:18:49 +00:00
|
|
|
{ path: '/profile', element: wrapProtected(<ProfileRedirect />) },
|
2026-02-07 03:16:37 +00:00
|
|
|
{ path: '/settings', element: wrapProtected(<LazySettings />) },
|
|
|
|
|
{ path: '/settings/sessions', element: wrapProtected(<LazySessions />) },
|
2026-04-05 14:19:16 +00:00
|
|
|
{ path: '/admin/roles', element: wrapAdminProtected(<LazyRoles />) },
|
2026-02-07 03:16:37 +00:00
|
|
|
{ path: '/tracks/:id', element: wrapProtected(<LazyTrackDetail />) },
|
|
|
|
|
{ path: '/playlists/*', element: wrapProtected(<LazyPlaylistRoutes />) },
|
|
|
|
|
{ path: '/search', element: wrapProtected(<LazySearch />) },
|
|
|
|
|
{ path: '/notifications', element: wrapProtected(<LazyNotifications />) },
|
2026-02-15 15:03:43 +00:00
|
|
|
{ path: '/analytics', element: wrapProtected(<LazyAnalytics />) },
|
2026-02-07 03:16:37 +00:00
|
|
|
{ path: '/webhooks', element: wrapProtected(<LazyWebhooks />) },
|
2026-04-05 14:19:16 +00:00
|
|
|
{ path: '/admin', element: wrapAdminProtected(<LazyAdminDashboard />) },
|
|
|
|
|
{ path: '/admin/moderation', element: wrapAdminProtected(<LazyAdminModeration />) },
|
|
|
|
|
{ path: '/admin/platform', element: wrapAdminProtected(<LazyAdminPlatform />) },
|
|
|
|
|
{ path: '/admin/transfers', element: wrapAdminProtected(<LazyAdminTransfers />) },
|
2026-02-15 15:03:43 +00:00
|
|
|
{ path: '/social', element: wrapProtected(<LazySocial />) },
|
2026-03-09 00:52:56 +00:00
|
|
|
{ path: '/feed', element: wrapProtected(<LazyFeed />) },
|
|
|
|
|
{ path: '/discover', element: wrapProtected(<LazyDiscover />) },
|
Phase 2 stabilisation: code mort, Modal→Dialog, feature flags, tests, router split, Rust legacy
Bloc A - Code mort:
- Suppression Studio (components, views, features)
- Suppression gamification + services mock (projectService, storageService, gamificationService)
- Mise à jour Sidebar, Navbar, locales
Bloc B - Frontend:
- Suppression modal.tsx deprecated, Modal.stories (doublon Dialog)
- Feature flags: PLAYLIST_SEARCH, PLAYLIST_RECOMMENDATIONS, ROLE_MANAGEMENT = true
- Suppression 19 tests orphelins, retrait exclusions vitest.config
Bloc C - Backend:
- Extraction routes_auth.go depuis router.go
Bloc D - Rust:
- Suppression security_legacy.rs (code mort, patterns déjà dans security/)
2026-02-14 16:23:32 +00:00
|
|
|
{ path: '/queue', element: wrapProtected(<LazyQueue />) },
|
|
|
|
|
{ path: '/developer', element: wrapProtected(<LazyDeveloper />) },
|
|
|
|
|
// Gear: connected to backend inventory API
|
|
|
|
|
{ path: '/gear', element: wrapProtected(<LazyGear />) },
|
|
|
|
|
// Live: connected to backend live streams API
|
2026-02-24 09:00:43 +00:00
|
|
|
{ path: '/live/go-live', element: wrapProtected(<LazyGoLive />) },
|
Phase 2 stabilisation: code mort, Modal→Dialog, feature flags, tests, router split, Rust legacy
Bloc A - Code mort:
- Suppression Studio (components, views, features)
- Suppression gamification + services mock (projectService, storageService, gamificationService)
- Mise à jour Sidebar, Navbar, locales
Bloc B - Frontend:
- Suppression modal.tsx deprecated, Modal.stories (doublon Dialog)
- Feature flags: PLAYLIST_SEARCH, PLAYLIST_RECOMMENDATIONS, ROLE_MANAGEMENT = true
- Suppression 19 tests orphelins, retrait exclusions vitest.config
Bloc C - Backend:
- Extraction routes_auth.go depuis router.go
Bloc D - Rust:
- Suppression security_legacy.rs (code mort, patterns déjà dans security/)
2026-02-14 16:23:32 +00:00
|
|
|
{ path: '/live', element: wrapProtected(<LazyLive />) },
|
2026-03-10 12:34:16 +00:00
|
|
|
// Co-listening (v0.10.7 F481)
|
|
|
|
|
{ path: '/listen-together/:sessionId', element: wrapProtected(<LazyListenTogether />) },
|
2026-02-22 17:30:49 +00:00
|
|
|
// Cloud: connected to backend cloud storage API
|
|
|
|
|
{ path: '/cloud', element: wrapProtected(<LazyCloud />) },
|
2026-03-10 18:37:35 +00:00
|
|
|
// v0.12.1: Subscription Plans & Management
|
|
|
|
|
{ path: '/subscription', element: wrapProtected(<LazySubscription />) },
|
2026-03-10 18:54:45 +00:00
|
|
|
// v0.12.2: Distribution to External Platforms
|
|
|
|
|
{ path: '/distribution', element: wrapProtected(<LazyDistribution />) },
|
2026-03-11 08:46:25 +00:00
|
|
|
// v0.12.3: Formation & Éducation
|
|
|
|
|
{ path: '/education', element: wrapProtected(<LazyEducation />) },
|
2026-03-13 13:57:19 +00:00
|
|
|
// v0.13.5 TASK-MKT-004: Support page
|
|
|
|
|
{ path: '/support', element: wrapProtected(<LazySupport />) },
|
feat: UI components, services, utils, i18n, and routing
Update shared components (ComingSoon, SelectTrigger, AnnouncementBanner,
modals, social cards). Add usePatina hook. Refine API services, error
handling, query invalidation, state management. Update i18n strings
(en/fr/es). Update routing and app configuration.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 14:46:42 +00:00
|
|
|
|
|
|
|
|
// Redirect aliases — intuitive URLs that map to actual routes
|
|
|
|
|
{ path: '/tracks', element: <Navigate to="/library" replace /> },
|
|
|
|
|
{ path: '/community', element: <Navigate to="/social" replace /> },
|
|
|
|
|
{ path: '/favorites', element: <Navigate to="/playlists/favoris" replace /> },
|
|
|
|
|
{ path: '/home', element: <Navigate to="/dashboard" replace /> },
|
2026-02-07 03:16:37 +00:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getErrorRoutes(): RouteEntry[] {
|
|
|
|
|
return [
|
|
|
|
|
{ path: '/404', element: <ErrorBoundary><LazyNotFound /></ErrorBoundary> },
|
|
|
|
|
{ path: '/500', element: <ErrorBoundary><LazyServerError /></ErrorBoundary> },
|
|
|
|
|
];
|
|
|
|
|
}
|