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

🔧 Add status text to the ProjectListBox

This commit is contained in:
Steffo 2021-10-07 19:33:58 +02:00
parent 750bdc5ca4
commit 338c565b87

View file

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