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

46 lines
1.1 KiB
TypeScript
Raw Normal View History

import { History } from '@remix-run/router';
import React from 'react';
import {
RouterProvider,
2023-10-06 20:45:37 -07:00
createHashRouter,
Outlet
} from 'react-router-dom';
import { EXPERIMENTAL_APP_ROUTES } from 'apps/experimental/routes/routes';
2023-10-06 20:45:37 -07:00
import AppHeader from 'components/AppHeader';
import Backdrop from 'components/Backdrop';
import { useLegacyRouterSync } from 'hooks/useLegacyRouterSync';
2023-10-06 20:45:37 -07:00
import { DASHBOARD_APP_ROUTES } from 'apps/dashboard/routes/routes';
const router = createHashRouter([
2023-10-06 20:45:37 -07:00
{
element: <RootAppLayout />,
children: [
...EXPERIMENTAL_APP_ROUTES,
...DASHBOARD_APP_ROUTES
]
}
]);
2023-10-06 20:45:37 -07:00
export default function RootAppRouter({ history }: Readonly<{ history: History}>) {
useLegacyRouterSync({ router, history });
return <RouterProvider router={router} />;
}
2023-10-06 20:45:37 -07:00
/**
* Layout component that renders legacy components required on all pages.
* NOTE: The app will crash if these get removed from the DOM.
*/
2023-10-06 20:45:37 -07:00
function RootAppLayout() {
return (
<>
<Backdrop />
<AppHeader isHidden />
<Outlet />
</>
);
}