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;
|
//if (!accessTokenSingle || !clientId) return;
|
||||||
|
|
||||||
const ws = new WebSocket(
|
const ws = new WebSocket(
|
||||||
//`ws://localhost:7080/auth/ws/${accessTokenSingle}`
|
`ws://localhost:7080/auth/ws/${accessTokenSingle}`
|
||||||
`wss://79.137.75.155/hotel-demo/api/auth/ws/${accessTokenSingle}`
|
//`wss://79.137.75.155/hotel-demo/api/auth/ws/${accessTokenSingle}`
|
||||||
);
|
);
|
||||||
|
|
||||||
wsRef.current = ws;
|
wsRef.current = ws;
|
||||||
|
|||||||
@@ -118,32 +118,36 @@ export default function Login({ onLogin }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="loginWrapper">
|
<div className="loginWrapper">
|
||||||
<div className="loginBlock">
|
<div className="loginBlock">
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Username"
|
placeholder="Username"
|
||||||
value={username}
|
value={username}
|
||||||
onChange={(e) => setUsername(e.target.value)}
|
onChange={(e) => setUsername(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<button type="submit">Login</button>
|
<button type="submit">Login</button>
|
||||||
{error && <p style={{ color: "red" }}>{error}</p>}
|
{error && <p style={{ color: "red" }}>{error}</p>}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button onClick={LoginTest1} >login test 1</button>
|
<button onClick={LoginTest1} >login test 1</button>
|
||||||
<button onClick={LoginTest2} >login test 2</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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
.chatWidget {
|
.chatWidget {
|
||||||
margin :5px;
|
margin :5px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -12,7 +13,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
padding: 0.75rem;
|
padding: 8px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
height: 20%;
|
height: 20%;
|
||||||
}
|
}
|
||||||
@@ -61,6 +62,7 @@ width: 70%;
|
|||||||
|
|
||||||
/* Messages */
|
/* Messages */
|
||||||
.msg {
|
.msg {
|
||||||
|
margin: 5px;
|
||||||
max-width: 70%;
|
max-width: 70%;
|
||||||
padding: 0.5rem 0.75rem;
|
padding: 0.5rem 0.75rem;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
@@ -79,11 +81,18 @@ width: 70%;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.createConvBox {
|
.createConvBox {
|
||||||
|
margin: 5px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
}
|
}
|
||||||
|
|
||||||
.createConvBox > * {
|
.createConvBox > * {
|
||||||
|
margin: 5px;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.convUtils button {
|
||||||
|
margin: 3px;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -28,7 +28,15 @@ export default function ChatWidget({convlist}) {
|
|||||||
|
|
||||||
console.log("client id in chat widget");
|
console.log("client id in chat widget");
|
||||||
|
|
||||||
return (
|
function hideCreateConv(){
|
||||||
|
setShowCreateConv(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
function hideAddUser(){
|
||||||
|
showAddUsers(false)
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
<div className="chatWidget">
|
<div className="chatWidget">
|
||||||
<div className="convlist">
|
<div className="convlist">
|
||||||
{convlist.map(conv => (
|
{convlist.map(conv => (
|
||||||
@@ -45,7 +53,7 @@ return (
|
|||||||
disabled={!activeConvId}
|
disabled={!activeConvId}
|
||||||
onClick={() => setShowAddUsers(v => !v)}
|
onClick={() => setShowAddUsers(v => !v)}
|
||||||
>
|
>
|
||||||
Add users
|
Update users
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
hidden={showCreateConv}
|
hidden={showCreateConv}
|
||||||
@@ -64,12 +72,14 @@ return (
|
|||||||
fetchConvUsers={fetchConvUsers}
|
fetchConvUsers={fetchConvUsers}
|
||||||
onValidate={addUserToConv}
|
onValidate={addUserToConv}
|
||||||
onClose={() => setShowAddUsers(false)}
|
onClose={() => setShowAddUsers(false)}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showCreateConv && (
|
{showCreateConv && (
|
||||||
<CreateConvMenu
|
<CreateConvMenu
|
||||||
onSend={createConversation}
|
onSend={createConversation}
|
||||||
|
exit={hideCreateConv}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -205,7 +215,7 @@ function AddUsersMenu({ convId, usersById, fetchConvUsers, onValidate, onClose }
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="addUsersMenu">
|
<div className="addUsersMenu">
|
||||||
<h3>Add users</h3>
|
<h3>update users</h3>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
{Object.entries(usersById).map(([id, name]) => (
|
{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 [nameText, setNameText] = useState("");
|
||||||
|
|
||||||
|
|
||||||
const handleSend = () =>{
|
const handleSend = () =>{
|
||||||
if (!nameText.trim()) return;
|
if (!nameText.trim()) return;
|
||||||
|
|
||||||
onSend(nameText);
|
onSend(nameText);
|
||||||
|
|
||||||
setNameText("");
|
setNameText("");
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="createConvBox">
|
<div className="createConvBox">
|
||||||
<input
|
<input
|
||||||
value= {nameText}
|
value= {nameText}
|
||||||
|
autoFocus
|
||||||
onChange= {element => setNameText(element.target.value)}
|
onChange= {element => setNameText(element.target.value)}
|
||||||
onKeyDown={e => e.key === "Enter" && handleSend() }
|
onKeyDown={e => e.key === "Enter" && handleSend() }
|
||||||
placeholder="Ma Conversation"
|
placeholder="Ma Conversation"
|
||||||
|
onBlur={exit}
|
||||||
/>
|
/>
|
||||||
<button onClick= {handleSend}>Send</button>
|
<button onClick= {handleSend}>Send</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ function ItemCard({id, name, amount}) {
|
|||||||
setEditing(false);
|
setEditing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeInput(){
|
||||||
|
setEdtiting(false);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="itemcard">
|
<div className="itemcard">
|
||||||
<h3>{name}</h3>
|
<h3>{name}</h3>
|
||||||
@@ -65,6 +69,7 @@ function ItemCard({id, name, amount}) {
|
|||||||
autoFocus
|
autoFocus
|
||||||
onChange={e => setItemAmount(e.target.value)}
|
onChange={e => setItemAmount(e.target.value)}
|
||||||
onKeyDown={e => e.key == "Enter" && submit(id, itemAmount)}
|
onKeyDown={e => e.key == "Enter" && submit(id, itemAmount)}
|
||||||
|
onBlur={closeInput}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ function RoomCard({ number, status ,id}) {
|
|||||||
setEdtiting(false);
|
setEdtiting(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeInput(){
|
||||||
|
setEdtiting(false);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card">
|
<div className="card">
|
||||||
<h3>Room {number}</h3>
|
<h3>Room {number}</h3>
|
||||||
@@ -51,6 +55,7 @@ function RoomCard({ number, status ,id}) {
|
|||||||
autoFocus
|
autoFocus
|
||||||
onChange={e => SetValue(e.target.value)}
|
onChange={e => SetValue(e.target.value)}
|
||||||
onKeyDown={e => e.key === "Enter" && submit()}
|
onKeyDown={e => e.key === "Enter" && submit()}
|
||||||
|
onBlur={closeInput}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user