1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/apps/stable/App.tsx

56 lines
1.8 KiB
TypeScript
Raw Normal View History

2023-04-27 17:04:33 -04:00
import React from 'react';
2023-06-01 12:12:16 -04:00
import { Navigate, Outlet, Route, Routes } from 'react-router-dom';
2023-04-27 17:04:33 -04:00
2023-09-30 01:17:37 -04:00
import { DASHBOARD_APP_PATHS } from 'apps/dashboard/App';
import AppBody from 'components/AppBody';
2023-06-01 12:12:16 -04:00
import ConnectionRequired from 'components/ConnectionRequired';
import { toAsyncPageRoute } from 'components/router/AsyncRoute';
import { toViewManagerPageRoute } from 'components/router/LegacyRoute';
import { toRedirectRoute } from 'components/router/Redirect';
2023-04-27 17:04:33 -04:00
2023-09-20 00:02:26 -04:00
import { ASYNC_USER_ROUTES } from './routes/asyncRoutes';
import { LEGACY_PUBLIC_ROUTES, LEGACY_USER_ROUTES } from './routes/legacyRoutes';
2023-09-15 10:31:48 -04:00
import { REDIRECTS } from './routes/_redirects';
2023-06-01 12:12:16 -04:00
const Layout = () => (
<AppBody>
<Outlet />
</AppBody>
2023-04-27 17:04:33 -04:00
);
2023-06-01 12:12:16 -04:00
const StableApp = () => (
<Routes>
<Route element={<Layout />}>
{/* User routes */}
<Route path='/' element={<ConnectionRequired />}>
{ASYNC_USER_ROUTES.map(toAsyncPageRoute)}
{LEGACY_USER_ROUTES.map(toViewManagerPageRoute)}
</Route>
{/* Public routes */}
<Route path='/' element={<ConnectionRequired isUserRequired={false} />}>
<Route index element={<Navigate replace to='/home.html' />} />
{LEGACY_PUBLIC_ROUTES.map(toViewManagerPageRoute)}
</Route>
{/* Suppress warnings for unhandled routes */}
<Route path='*' element={null} />
</Route>
{/* Redirects for old paths */}
{REDIRECTS.map(toRedirectRoute)}
{/* Ignore dashboard routes */}
{Object.entries(DASHBOARD_APP_PATHS).map(([ key, path ]) => (
<Route
key={key}
path={`/${path}/*`}
element={null}
/>
))}
2023-06-01 12:12:16 -04:00
</Routes>
);
2023-04-27 17:04:33 -04:00
export default StableApp;