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:
@@ -399,8 +399,8 @@ async function addHotelUser(user_id,hotel_ids) {
|
||||
//if (!accessTokenSingle || !clientId) return;
|
||||
|
||||
const ws = new WebSocket(
|
||||
//`ws://localhost:7080/auth/ws/${accessTokenSingle}`
|
||||
`wss://79.137.75.155/hotel-demo/api/auth/ws/${accessTokenSingle}`
|
||||
`ws://localhost:7080/auth/ws/${accessTokenSingle}`
|
||||
//`wss://79.137.75.155/hotel-demo/api/auth/ws/${accessTokenSingle}`
|
||||
);
|
||||
|
||||
wsRef.current = ws;
|
||||
|
||||
@@ -142,6 +142,10 @@ export default function Login({ onLogin }) {
|
||||
<button onClick={LoginTest1} >login test 1</button>
|
||||
<button onClick={LoginTest2} >login test 2</button>
|
||||
</div>
|
||||
<div>
|
||||
<p>Connectez-vous en utilisant
|
||||
"test1"/"test2" comme username et password</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
.chatWidget {
|
||||
margin :5px;
|
||||
display: flex;
|
||||
@@ -12,7 +13,7 @@
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem;
|
||||
padding: 8px;
|
||||
overflow-y: auto;
|
||||
height: 20%;
|
||||
}
|
||||
@@ -61,6 +62,7 @@ width: 70%;
|
||||
|
||||
/* Messages */
|
||||
.msg {
|
||||
margin: 5px;
|
||||
max-width: 70%;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: 10px;
|
||||
@@ -79,11 +81,18 @@ width: 70%;
|
||||
}
|
||||
|
||||
.createConvBox {
|
||||
margin: 5px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.createConvBox > * {
|
||||
margin: 5px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.convUtils button {
|
||||
margin: 3px;
|
||||
|
||||
}
|
||||
@@ -28,6 +28,14 @@ export default function ChatWidget({convlist}) {
|
||||
|
||||
console.log("client id in chat widget");
|
||||
|
||||
function hideCreateConv(){
|
||||
setShowCreateConv(false);
|
||||
};
|
||||
|
||||
function hideAddUser(){
|
||||
showAddUsers(false)
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="chatWidget">
|
||||
<div className="convlist">
|
||||
@@ -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>
|
||||
|
||||
@@ -49,6 +49,10 @@ function ItemCard({id, name, amount}) {
|
||||
setEditing(false);
|
||||
}
|
||||
|
||||
function closeInput(){
|
||||
setEdtiting(false);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="itemcard">
|
||||
<h3>{name}</h3>
|
||||
@@ -65,6 +69,7 @@ function ItemCard({id, name, amount}) {
|
||||
autoFocus
|
||||
onChange={e => setItemAmount(e.target.value)}
|
||||
onKeyDown={e => e.key == "Enter" && submit(id, itemAmount)}
|
||||
onBlur={closeInput}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -34,6 +34,10 @@ function RoomCard({ number, status ,id}) {
|
||||
setEdtiting(false);
|
||||
}
|
||||
|
||||
function closeInput(){
|
||||
setEdtiting(false);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="card">
|
||||
<h3>Room {number}</h3>
|
||||
@@ -51,6 +55,7 @@ function RoomCard({ number, status ,id}) {
|
||||
autoFocus
|
||||
onChange={e => SetValue(e.target.value)}
|
||||
onKeyDown={e => e.key === "Enter" && submit()}
|
||||
onBlur={closeInput}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user