mirror of
https://github.com/Steffo99/todocolors.git
synced 2024-11-25 17:54: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}) {
|
export function BoardTaskEditor({className}: {className?: string}) {
|
||||||
const {editedTask, send, setEditedTaskText} = useManagedBoard()
|
const {editedTask, send, setEditedTaskText, websocketState} = useManagedBoard()
|
||||||
|
|
||||||
const submitTask = useCallback((e: FormEvent) => {
|
const submitTask = useCallback((e: FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -15,6 +15,10 @@ export function BoardTaskEditor({className}: {className?: string}) {
|
||||||
setEditedTaskText("")
|
setEditedTaskText("")
|
||||||
}, [send, editedTask])
|
}, [send, editedTask])
|
||||||
|
|
||||||
|
if(websocketState != WebSocket.OPEN) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={submitTask} className={cn(style.editorForm, className)}>
|
<form onSubmit={submitTask} className={cn(style.editorForm, className)}>
|
||||||
<EditorTextInput/>
|
<EditorTextInput/>
|
||||||
|
|
Loading…
Reference in a new issue