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