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 GroupListBox

This commit is contained in:
Steffo 2021-10-07 19:35:52 +02:00
parent 955aa52503
commit 3d42add8d8
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 {SophonResearchGroup} from "../../types/SophonTypes" import {SophonResearchGroup} from "../../types/SophonTypes"
import {Empty} from "../elements/Empty"
import {Loading} from "../elements/Loading"
import {GroupResourcePanel} from "./GroupResourcePanel" import {GroupResourcePanel} from "./GroupResourcePanel"
@ -11,6 +13,19 @@ export interface GroupListBoxProps {
export function GroupListBox({viewSet}: GroupListBoxProps): JSX.Element { export function GroupListBox({viewSet}: GroupListBoxProps): JSX.Element {
const resources = React.useMemo(
() => {
if(!viewSet.resources) {
return <Loading/>
}
if(viewSet.resources.length === 0) {
return <Empty>This Sophon instance has no groups.</Empty>
}
return viewSet.resources?.map(res => <GroupResourcePanel resource={res} key={res.value.slug}/>)
},
[viewSet],
)
return ( return (
<Box> <Box>
<Heading level={3}> <Heading level={3}>
@ -19,7 +34,7 @@ export function GroupListBox({viewSet}: GroupListBoxProps): JSX.Element {
<p> <p>
Research groups are groups of people that work together on one or more research projects. Research groups are groups of people that work together on one or more research projects.
</p> </p>
{viewSet.resources?.map(res => <GroupResourcePanel resource={res} key={res.value.slug}/>)} {resources}
</Box> </Box>
) )
} }