2021-10-07 03:17:45 +00:00
|
|
|
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<any>) => JSX.Element | null,
|
|
|
|
selectedRoute: (props: Dict<any>) => JSX.Element | null,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function ProjectRouter({groupPk, ...props}: ProjectRouterProps): JSX.Element {
|
|
|
|
return (
|
|
|
|
<ViewSetRouter
|
|
|
|
{...props}
|
2021-10-14 01:43:05 +00:00
|
|
|
viewSet={useManagedViewSet<SophonResearchProject>(`/api/projects/by-group/${groupPk}/`, "slug")}
|
2021-10-07 03:25:53 +00:00
|
|
|
pathSegment={"researchProject"}
|
2021-10-07 03:17:45 +00:00
|
|
|
pkKey={"slug"}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|