2021-10-07 03:32:38 +00:00
|
|
|
import {Box, Heading} from "@steffo/bluelib-react"
|
|
|
|
import * as React from "react"
|
|
|
|
import {ManagedViewSet} from "../../hooks/useManagedViewSet"
|
|
|
|
import {SophonNotebook} from "../../types/SophonTypes"
|
2021-10-07 17:26:46 +00:00
|
|
|
import {Empty} from "../elements/Empty"
|
|
|
|
import {Loading} from "../elements/Loading"
|
2021-10-07 03:32:38 +00:00
|
|
|
import {NotebookResourcePanel} from "./NotebookResourcePanel"
|
|
|
|
|
|
|
|
|
|
|
|
export interface NotebookListBoxProps {
|
|
|
|
viewSet: ManagedViewSet<SophonNotebook>
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function NotebookListBox({viewSet}: NotebookListBoxProps): JSX.Element {
|
2021-10-07 17:26:46 +00:00
|
|
|
const resources = React.useMemo(
|
|
|
|
() => {
|
|
|
|
if(!viewSet.resources) {
|
|
|
|
return <Loading/>
|
|
|
|
}
|
|
|
|
if(viewSet.resources.length === 0) {
|
|
|
|
return <Empty>This project has no notebooks.</Empty>
|
|
|
|
}
|
|
|
|
return viewSet.resources?.map(res => <NotebookResourcePanel resource={res} key={res.value.slug}/>)
|
|
|
|
},
|
|
|
|
[viewSet],
|
|
|
|
)
|
|
|
|
|
2021-10-07 03:32:38 +00:00
|
|
|
return (
|
|
|
|
<Box>
|
|
|
|
<Heading level={3}>
|
|
|
|
Notebooks
|
|
|
|
</Heading>
|
2021-10-07 16:47:43 +00:00
|
|
|
<p>
|
|
|
|
Notebooks are interactive Python documents that you can edit in your browser and run on Sophon server.
|
|
|
|
</p>
|
2021-10-07 17:26:46 +00:00
|
|
|
{resources}
|
2021-10-07 03:32:38 +00:00
|
|
|
</Box>
|
|
|
|
)
|
|
|
|
}
|