create conv message fix

This commit is contained in:
2026-01-28 03:13:40 +01:00
parent 7a88a7e04e
commit e7a283b39e
2 changed files with 14 additions and 7 deletions

View File

@@ -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/>

View File

@@ -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>