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

feat: migrate experimental app to use react data router

This commit is contained in:
Grady Hallenbeck 2023-10-06 20:26:00 -07:00
parent 06b991ddcf
commit 675f9625f2
8 changed files with 162 additions and 62 deletions

View file

@ -52,3 +52,16 @@ export const toAsyncPageRoute = ({ path, page, element, type = AsyncRouteType.St
/>
);
};
export function toAsyncPageRouteConfig({ path, page, element, type = AsyncRouteType.Stable }: AsyncRoute) {
const Element = element || (
type === AsyncRouteType.Experimental ?
ExperimentalAsyncPage :
StableAsyncPage
);
return {
path,
element: <Element page={page ?? path} />
};
}

View file

@ -19,3 +19,10 @@ export function toViewManagerPageRoute(route: LegacyRoute) {
/>
);
}
export function toViewManagerPageRouteConfig(route: LegacyRoute) {
return {
path: route.path,
element: <ViewManagerPage {...route.pageProps} />
};
}

View file

@ -1,5 +1,5 @@
import React from 'react';
import { Navigate, Route, useLocation } from 'react-router-dom';
import { Navigate, Route, RouteObject, useLocation } from 'react-router-dom';
export interface Redirect {
from: string
@ -26,3 +26,10 @@ export function toRedirectRoute({ from, to }: Redirect) {
/>
);
}
export function toRedirectRouteConfig({ from, to }: Redirect): RouteObject {
return {
path: from,
element: <RedirectWithSearch to={to} />
};
}