mirror of
https://github.com/logos-messaging/examples.waku.org.git
synced 2026-01-07 07:13:12 +00:00
rename prop
This commit is contained in:
parent
5ff08636a0
commit
4e586e81f7
@ -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
|
||||||
|
|||||||
@ -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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user