From 1cc229730c4a3fc53fd13036b23e3e45dd2fdc5b Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 7 Oct 2021 05:17:45 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Create=20`ProjectRouter`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.tsx | 9 ++++++- .../src/components/project/ProjectRouter.tsx | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 frontend/src/components/project/ProjectRouter.tsx diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index d8f1b97..c5453ed 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -11,6 +11,7 @@ import {GroupRouter} from "./components/group/GroupRouter" import {InstanceRouter} from "./components/instance/InstanceRouter" import {InstanceStepPage} from "./components/instance/InstanceStepPage" import {DebugBox} from "./components/placeholder/DebugBox" +import {ProjectRouter} from "./components/project/ProjectRouter" import {ThemedBluelib} from "./components/theme/ThemedBluelib" import {ThemedTitle} from "./components/theme/ThemedTitle" import {AuthorizationProvider} from "./contexts/authorization" @@ -34,7 +35,13 @@ function App({}: RouteComponentProps) { selectedRoute={() => <> } - selectedRoute={DebugBox} + selectedRoute={(props) => <> + + } /> } /> diff --git a/frontend/src/components/project/ProjectRouter.tsx b/frontend/src/components/project/ProjectRouter.tsx new file mode 100644 index 0000000..52ec0a0 --- /dev/null +++ b/frontend/src/components/project/ProjectRouter.tsx @@ -0,0 +1,24 @@ +import * as React from "react" +import {useManagedViewSet} from "../../hooks/useManagedViewSet" +import {Dict} from "../../types/ExtraTypes" +import {SophonResearchProject} from "../../types/SophonTypes" +import {ViewSetRouter} from "../routing/ViewSetRouter" + + +export interface ProjectRouterProps { + groupPk: string, + unselectedRoute: (props: Dict) => JSX.Element | null, + selectedRoute: (props: Dict) => JSX.Element | null, +} + + +export function ProjectRouter({groupPk, ...props}: ProjectRouterProps): JSX.Element { + return ( + (`/api/projects/by-group/${groupPk}`, "slug")} + pathSegment={"researchGroup"} + pkKey={"slug"} + /> + ) +}