2021-10-06 00:52:06 +00:00
|
|
|
import {Box, Heading} from "@steffo/bluelib-react"
|
|
|
|
import * as React from "react"
|
|
|
|
import {useInstanceContext} from "../../contexts/instance"
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: In the future, it would be nice for this to be parsed as Markdown!
|
|
|
|
return (
|
|
|
|
<Box>
|
|
|
|
<Heading level={3}>
|
|
|
|
Welcome to {instance.state.details.name}!
|
|
|
|
</Heading>
|
2021-10-06 01:18:59 +00:00
|
|
|
<pre>
|
2021-10-06 00:52:06 +00:00
|
|
|
{instance.state.details.description}
|
2021-10-06 01:18:59 +00:00
|
|
|
</pre>
|
2021-10-06 00:52:06 +00:00
|
|
|
</Box>
|
|
|
|
)
|
|
|
|
}
|