rename prop

This commit is contained in:
Sasha 2023-02-27 23:53:43 +01:00
parent 5ff08636a0
commit 4e586e81f7
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View File

@ -11,12 +11,12 @@ import {
} from "@livechat/ui-kit"; } from "@livechat/ui-kit";
interface Props { interface Props {
hasPeers: boolean; hasLightPushPeers: boolean;
sendMessage: ((msg: string) => Promise<void>) | undefined; sendMessage: ((msg: string) => Promise<void>) | undefined;
} }
export default function MessageInput(props: Props) { export default function MessageInput(props: Props) {
const { hasPeers } = props; const { hasLightPushPeers } = props;
const { node } = useWaku<LightNode>(); const { node } = useWaku<LightNode>();
const [inputText, setInputText] = useState<string>(""); const [inputText, setInputText] = useState<string>("");
@ -46,12 +46,12 @@ export default function MessageInput(props: Props) {
// Enable the button if there are peers available or the user is sending a command // Enable the button if there are peers available or the user is sending a command
useEffect(() => { useEffect(() => {
if (inputText.startsWith("/") || hasPeers) { if (inputText.startsWith("/") || hasLightPushPeers) {
setActiveButton(true); setActiveButton(true);
} else if (node) { } else if (node) {
setActiveButton(false); setActiveButton(false);
} }
}, [inputText, hasPeers]); }, [inputText, hasLightPushPeers]);
return ( return (
<TextComposer <TextComposer

View File

@ -59,7 +59,7 @@ export default function Room(props: Props) {
title="Waku v2 chat app" title="Waku v2 chat app"
/> />
<ChatList messages={props.messages} /> <ChatList messages={props.messages} />
<MessageInput hasPeers={!!lightPushPeers} sendMessage={onSend} /> <MessageInput hasLightPushPeers={!!lightPushPeers} sendMessage={onSend} />
</div> </div>
); );
} }