diff --git a/CHANGELOG.md b/CHANGELOG.md index 6593a46674..21178fd88f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `WakuRelay.getPeers` method. +- Use `WakuRelay.getPeers` in web chat app example to disable send button. ### Changed - Enable passing `string`s to `addPeerToAddressBook`. diff --git a/examples/web-chat/src/MessageInput.tsx b/examples/web-chat/src/MessageInput.tsx index d8a8bfe208..3911bb873b 100644 --- a/examples/web-chat/src/MessageInput.tsx +++ b/examples/web-chat/src/MessageInput.tsx @@ -34,11 +34,15 @@ export default function MessageInput(props: Props) { } }; + // Enable the button if there are relay peers available or the user is sending a command + const activeButton = + (waku && waku.relay.getPeers().size !== 0) || inputText.startsWith('/'); + return (