mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-21 22:34:21 +00:00
🐛 Fix #81
This commit is contained in:
parent
fae22ac62c
commit
a7f8cbd57c
1 changed files with 10 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
import {Box, Details, Form, Idiomatic as I, useFormState} from "@steffo/bluelib-react"
|
||||
import * as React from "react"
|
||||
import {useAuthorizationContext} from "../../contexts/authorization"
|
||||
import {useGroupContext} from "../../contexts/group"
|
||||
import {useProjectContext} from "../../contexts/project"
|
||||
import {useApplyChanges} from "../../hooks/useApplyChanges"
|
||||
import {useFormSlug} from "../../hooks/useFormSlug"
|
||||
|
@ -17,6 +18,7 @@ export interface NotebookCreateBoxProps {
|
|||
|
||||
export function NotebookCreateBox({viewSet, resource}: NotebookCreateBoxProps): JSX.Element | null {
|
||||
const authorization = useAuthorizationContext()
|
||||
const group = useGroupContext()
|
||||
const project = useProjectContext()
|
||||
|
||||
const name =
|
||||
|
@ -57,9 +59,17 @@ export function NotebookCreateBox({viewSet, resource}: NotebookCreateBoxProps):
|
|||
if(!authorization) {
|
||||
return null
|
||||
}
|
||||
if(!group) {
|
||||
return null
|
||||
}
|
||||
if(!authorization.state.token) {
|
||||
return null
|
||||
}
|
||||
if(!(
|
||||
group.value.members.includes(authorization.state.user.id) || group.value.owner === authorization.state.user.id
|
||||
)) {
|
||||
return null
|
||||
}
|
||||
if(resource) {
|
||||
if(resource.value.locked_by) {
|
||||
return null
|
||||
|
|
Loading…
Reference in a new issue