mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-05 23:33:08 +00:00
Enable button once waku is ready
This commit is contained in:
parent
fae5959d2f
commit
f0cd4064cb
@ -1,5 +1,6 @@
|
|||||||
import React, { ChangeEvent, KeyboardEvent, useState } from 'react';
|
import React, { ChangeEvent, KeyboardEvent, useState } from 'react';
|
||||||
import { Button, Grid, TextField } from '@material-ui/core';
|
import { Button, Grid, TextField } from '@material-ui/core';
|
||||||
|
import { useWaku } from './WakuContext';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
messageHandler: (msg: string) => void;
|
messageHandler: (msg: string) => void;
|
||||||
@ -8,6 +9,7 @@ interface Props {
|
|||||||
|
|
||||||
export default function MessageInput(props: Props) {
|
export default function MessageInput(props: Props) {
|
||||||
const [inputText, setInputText] = useState<string>('');
|
const [inputText, setInputText] = useState<string>('');
|
||||||
|
const { waku } = useWaku();
|
||||||
|
|
||||||
const sendMessage = () => {
|
const sendMessage = () => {
|
||||||
props.sendMessage();
|
props.sendMessage();
|
||||||
@ -40,6 +42,7 @@ export default function MessageInput(props: Props) {
|
|||||||
}}
|
}}
|
||||||
onChange={messageHandler}
|
onChange={messageHandler}
|
||||||
onKeyPress={keyPressHandler}
|
onKeyPress={keyPressHandler}
|
||||||
|
disabled={!waku}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={1}>
|
<Grid item xs={1}>
|
||||||
@ -48,6 +51,7 @@ export default function MessageInput(props: Props) {
|
|||||||
color="primary"
|
color="primary"
|
||||||
size="large"
|
size="large"
|
||||||
onClick={sendMessage}
|
onClick={sendMessage}
|
||||||
|
disabled={!waku}
|
||||||
>
|
>
|
||||||
Send
|
Send
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user