2021-10-13 03:05:34 +00:00
|
|
|
import {faUniversity} from "@fortawesome/free-solid-svg-icons"
|
2021-10-06 00:52:06 +00:00
|
|
|
import * as React from "react"
|
|
|
|
import {useInstanceContext} from "../../contexts/instance"
|
2021-10-13 03:05:34 +00:00
|
|
|
import {DescriptionBox} from "../elements/DescriptionBox"
|
2021-10-06 00:52:06 +00:00
|
|
|
import {ErrorBox} from "../errors/ErrorBox"
|
|
|
|
|
|
|
|
|
2021-10-06 14:41:47 +00:00
|
|
|
export function InstanceDescriptionBox(): JSX.Element | null {
|
2021-10-06 00:52:06 +00:00
|
|
|
const instance = useInstanceContext()
|
|
|
|
|
|
|
|
if(!instance) {
|
|
|
|
return <ErrorBox error={new Error("This component is being rendered outside an InstanceContext.")}/>
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!instance.state.details) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!instance.state.details.description) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2021-10-13 03:05:34 +00:00
|
|
|
<DescriptionBox
|
|
|
|
icon={faUniversity}
|
|
|
|
name={instance.state.details.name}
|
|
|
|
description={instance.state.details.description}
|
|
|
|
/>
|
2021-10-06 00:52:06 +00:00
|
|
|
)
|
|
|
|
}
|