mirror of
https://github.com/Steffo99/todocolors.git
synced 2024-11-22 00:04:18 +00:00
Hide task editor while websocket is not open
This commit is contained in:
parent
3d60ede6a2
commit
048899b9ad
1 changed files with 5 additions and 1 deletions
|
@ -7,7 +7,7 @@ import {faAdd} from "@fortawesome/free-solid-svg-icons"
|
|||
|
||||
|
||||
export function BoardTaskEditor({className}: {className?: string}) {
|
||||
const {editedTask, send, setEditedTaskText} = useManagedBoard()
|
||||
const {editedTask, send, setEditedTaskText, websocketState} = useManagedBoard()
|
||||
|
||||
const submitTask = useCallback((e: FormEvent) => {
|
||||
e.preventDefault();
|
||||
|
@ -15,6 +15,10 @@ export function BoardTaskEditor({className}: {className?: string}) {
|
|||
setEditedTaskText("")
|
||||
}, [send, editedTask])
|
||||
|
||||
if(websocketState != WebSocket.OPEN) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={submitTask} className={cn(style.editorForm, className)}>
|
||||
<EditorTextInput/>
|
||||
|
|
Loading…
Reference in a new issue