create conv message fix
This commit is contained in:
@@ -32,7 +32,7 @@ function MainApp() {
|
||||
<h2>Dashboard</h2>
|
||||
<section className="main">
|
||||
|
||||
<AdminWidget/>
|
||||
|
||||
<RoomWidget roomlist={rooms}/>
|
||||
<ChatWidget convlist={conversations}/>
|
||||
<InventoryWidget/>
|
||||
|
||||
@@ -47,6 +47,7 @@ return (
|
||||
Add users
|
||||
</button>
|
||||
<button
|
||||
hidden={showCreateConv}
|
||||
onClick={() => setShowCreateConv(v => !v)}
|
||||
>
|
||||
Create Conv
|
||||
@@ -65,6 +66,12 @@ return (
|
||||
/>
|
||||
)}
|
||||
|
||||
{showCreateConv && (
|
||||
<CreateConvMenu
|
||||
onSend={createConversation}
|
||||
/>
|
||||
)}
|
||||
|
||||
{activeConvId && (
|
||||
<MessagesBox
|
||||
conv_id={activeConvId}
|
||||
@@ -176,20 +183,20 @@ function AddUsersMenu({ convId, usersById, fetchConvUsers, onValidate, onClose }
|
||||
|
||||
function CreateConvMenu({onSend}) {
|
||||
|
||||
const [nametext, setNameText] = useState("");
|
||||
const [nameText, setNameText] = useState("");
|
||||
const handleSend = () =>{
|
||||
if (!nametext.trim()) return;
|
||||
if (!nameText.trim()) return;
|
||||
|
||||
onSend(nametext);
|
||||
onSend(nameText);
|
||||
|
||||
setText("");
|
||||
setNameText("");
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="createConvBox">
|
||||
<input
|
||||
value= {text}
|
||||
onChange= {element => setText(element.target.value)}
|
||||
value= {nameText}
|
||||
onChange= {element => setNameText(element.target.value)}
|
||||
placeholder="Ma Conversation"
|
||||
/>
|
||||
<button onClick= {handleSend}>Send</button>
|
||||
|
||||
Reference in New Issue
Block a user