mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-22 23:04:21 +00:00
🔧 Add status text to the GroupListBox
This commit is contained in:
parent
338c565b87
commit
b2bfb61ae5
1 changed files with 16 additions and 1 deletions
|
@ -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>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue