A View for Drives, which function similar to a homepage or dashboard.
({ resource }: ResourcePageProps)
| 14 | |
| 15 | /** A View for Drives, which function similar to a homepage or dashboard. */ |
| 16 | function DrivePage({ resource }: ResourcePageProps): JSX.Element { |
| 17 | const title = useTitle(resource); |
| 18 | const [children] = useArray(resource, properties.children); |
| 19 | const { baseURL, setBaseURL } = useSettings(); |
| 20 | |
| 21 | return ( |
| 22 | <ContainerNarrow about={resource.getSubject()}> |
| 23 | {baseURL !== resource.getSubject() && ( |
| 24 | <Button onClick={() => setBaseURL(resource.getSubject())}> |
| 25 | Set as current drive |
| 26 | </Button> |
| 27 | )} |
| 28 | <ValueForm resource={resource} propertyURL={properties.description} /> |
| 29 | <Card> |
| 30 | <h3>{title} children:</h3> |
| 31 | <CardInsideFull> |
| 32 | {children.map(child => { |
| 33 | return ( |
| 34 | <CardRow key={child}> |
| 35 | <ResourceInline subject={child} /> |
| 36 | </CardRow> |
| 37 | ); |
| 38 | })} |
| 39 | <CardRow> |
| 40 | <AtomicLink path={paths.new}> |
| 41 | <FaPlus /> Create new resource |
| 42 | </AtomicLink> |
| 43 | </CardRow> |
| 44 | </CardInsideFull> |
| 45 | </Card> |
| 46 | {baseURL.startsWith('http://localhost') && ( |
| 47 | <p> |
| 48 | You are running Atomic-Server on `localhost`, which means that it will |
| 49 | not be available from any other machine than your current local |
| 50 | device. If you want your Atomic-Server to be available from the web, |
| 51 | you should set this up at a Domain on a server. |
| 52 | </p> |
| 53 | )} |
| 54 | </ContainerNarrow> |
| 55 | ); |
| 56 | } |
| 57 | |
| 58 | export default DrivePage; |
nothing calls this directly
no test coverage detected