From f0cd4064cbc3cbbda365103df15b430bb7a754cb Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 22 Apr 2021 17:05:19 +1000 Subject: [PATCH] Enable button once waku is ready --- web-chat/src/MessageInput.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web-chat/src/MessageInput.tsx b/web-chat/src/MessageInput.tsx index 760c544bf9..f3fc69d688 100644 --- a/web-chat/src/MessageInput.tsx +++ b/web-chat/src/MessageInput.tsx @@ -1,5 +1,6 @@ import React, { ChangeEvent, KeyboardEvent, useState } from 'react'; import { Button, Grid, TextField } from '@material-ui/core'; +import { useWaku } from './WakuContext'; interface Props { messageHandler: (msg: string) => void; @@ -8,6 +9,7 @@ interface Props { export default function MessageInput(props: Props) { const [inputText, setInputText] = useState(''); + const { waku } = useWaku(); const sendMessage = () => { props.sendMessage(); @@ -40,6 +42,7 @@ export default function MessageInput(props: Props) { }} onChange={messageHandler} onKeyPress={keyPressHandler} + disabled={!waku} /> @@ -48,6 +51,7 @@ export default function MessageInput(props: Props) { color="primary" size="large" onClick={sendMessage} + disabled={!waku} > Send