FIX exit on focus from some inputs
All checks were successful
Deploy React / build-and-deploy (push) Successful in 16s
All checks were successful
Deploy React / build-and-deploy (push) Successful in 16s
This commit is contained in:
@@ -28,7 +28,15 @@ export default function ChatWidget({convlist}) {
|
||||
|
||||
console.log("client id in chat widget");
|
||||
|
||||
return (
|
||||
function hideCreateConv(){
|
||||
setShowCreateConv(false);
|
||||
};
|
||||
|
||||
function hideAddUser(){
|
||||
showAddUsers(false)
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="chatWidget">
|
||||
<div className="convlist">
|
||||
{convlist.map(conv => (
|
||||
@@ -45,7 +53,7 @@ return (
|
||||
disabled={!activeConvId}
|
||||
onClick={() => setShowAddUsers(v => !v)}
|
||||
>
|
||||
Add users
|
||||
Update users
|
||||
</button>
|
||||
<button
|
||||
hidden={showCreateConv}
|
||||
@@ -64,12 +72,14 @@ return (
|
||||
fetchConvUsers={fetchConvUsers}
|
||||
onValidate={addUserToConv}
|
||||
onClose={() => setShowAddUsers(false)}
|
||||
|
||||
/>
|
||||
)}
|
||||
|
||||
{showCreateConv && (
|
||||
<CreateConvMenu
|
||||
onSend={createConversation}
|
||||
exit={hideCreateConv}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -205,7 +215,7 @@ function AddUsersMenu({ convId, usersById, fetchConvUsers, onValidate, onClose }
|
||||
|
||||
return (
|
||||
<div className="addUsersMenu">
|
||||
<h3>Add users</h3>
|
||||
<h3>update users</h3>
|
||||
|
||||
<ul>
|
||||
{Object.entries(usersById).map(([id, name]) => (
|
||||
@@ -228,24 +238,32 @@ function AddUsersMenu({ convId, usersById, fetchConvUsers, onValidate, onClose }
|
||||
);
|
||||
}
|
||||
|
||||
function CreateConvMenu({onSend}) {
|
||||
function CreateConvMenu({onSend, exit}) {
|
||||
|
||||
const [nameText, setNameText] = useState("");
|
||||
|
||||
|
||||
const handleSend = () =>{
|
||||
if (!nameText.trim()) return;
|
||||
|
||||
onSend(nameText);
|
||||
|
||||
setNameText("");
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 1000);
|
||||
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="createConvBox">
|
||||
<input
|
||||
value= {nameText}
|
||||
autoFocus
|
||||
onChange= {element => setNameText(element.target.value)}
|
||||
onKeyDown={e => e.key === "Enter" && handleSend() }
|
||||
placeholder="Ma Conversation"
|
||||
onBlur={exit}
|
||||
/>
|
||||
<button onClick= {handleSend}>Send</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user