1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-23 07:14:21 +00:00

🔧 Add status text to the ProjectListBox

This commit is contained in:
Steffo 2021-10-07 19:33:58 +02:00
parent 5e74e9b8d7
commit 955aa52503
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -2,6 +2,8 @@ import {Box, Heading} from "@steffo/bluelib-react"
import * as React from "react" import * as React from "react"
import {ManagedViewSet} from "../../hooks/useManagedViewSet" import {ManagedViewSet} from "../../hooks/useManagedViewSet"
import {SophonResearchProject} from "../../types/SophonTypes" import {SophonResearchProject} from "../../types/SophonTypes"
import {Empty} from "../elements/Empty"
import {Loading} from "../elements/Loading"
import {ProjectResourcePanel} from "./ProjectResourcePanel" import {ProjectResourcePanel} from "./ProjectResourcePanel"
@ -11,6 +13,19 @@ export interface ProjectListBoxProps {
export function ProjectListBox({viewSet}: ProjectListBoxProps): JSX.Element { export function ProjectListBox({viewSet}: ProjectListBoxProps): JSX.Element {
const resources = React.useMemo(
() => {
if(!viewSet.resources) {
return <Loading/>
}
if(viewSet.resources.length === 0) {
return <Empty>This group owns no projects.</Empty>
}
return viewSet.resources?.map(res => <ProjectResourcePanel resource={res} key={res.value.slug}/>)
},
[viewSet],
)
return ( return (
<Box> <Box>
<Heading level={3}> <Heading level={3}>
@ -19,7 +34,7 @@ export function ProjectListBox({viewSet}: ProjectListBoxProps): JSX.Element {
<p> <p>
Research projects are containers for all kind of research data pertaining to a specific topic. Research projects are containers for all kind of research data pertaining to a specific topic.
</p> </p>
{viewSet.resources?.map(res => <ProjectResourcePanel resource={res} key={res.value.slug}/>)} {resources}
</Box> </Box>
) )
} }