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:
parent
06b991ddcf
commit
675f9625f2
8 changed files with 162 additions and 62 deletions
|
@ -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} />
|
||||
};
|
||||
}
|
||||
|
|
|
@ -19,3 +19,10 @@ export function toViewManagerPageRoute(route: LegacyRoute) {
|
|||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function toViewManagerPageRouteConfig(route: LegacyRoute) {
|
||||
return {
|
||||
path: route.path,
|
||||
element: <ViewManagerPage {...route.pageProps} />
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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} />
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue