- Add notif for new message
    - remove buttons "private" and "game" in chat
    - add function on button newConv in profilPage
    - fix camera who change position (2 to 1.5 in z axe) when a goal is scored
    - fix some bug in responses functions
    - add button chat in profil page and lobby page
This commit is contained in:
Kum1ta
2024-09-21 23:14:27 +02:00
parent 696447a0d1
commit d29c58ae42
17 changed files with 161 additions and 167 deletions

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:19:10 by edbernar #+# #+# */
/* Updated: 2024/09/17 23:10:22 by edbernar ### ########.fr */
/* Updated: 2024/09/21 22:41:48 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,13 +15,6 @@ import { showActualGameMessage } from "/static/javascript/liveChat/showActualGam
import { showListUser } from "/static/javascript/liveChat/showUserList.js";
import { userMeInfo } from "/static/javascript/typeResponse/typeLogin.js";
/*
Todo (Eddy) :
- add a function to "New conversation +"
- game message when game will be implemented
*/
let chatContent = null;
let chatButton = null;
let topChatHomeCross = null;
@ -46,66 +39,19 @@ class LiveChat
}
function addDefaultButton()
{
const newDiv = document.createElement("div");
const newPrivateButton = document.createElement("h2");
const newGameButton = document.createElement("h2");
const divMessageListChatHome = document.createElement("div");
newDiv.setAttribute("id", "buttonTypeChatHome");
newPrivateButton.textContent = "Private";
newGameButton.textContent = "Game";
newPrivateButton.setAttribute("id", "selected");
newDiv.appendChild(newPrivateButton);
newDiv.appendChild(newGameButton);
document.getElementById("chatDiv").appendChild(newDiv);
divMessageListChatHome.setAttribute("id", "messageListChatHome");
document.getElementById("chatDiv").appendChild(divMessageListChatHome);
newPrivateButton.addEventListener("click", async () => {
newGameButton.removeAttribute("id");
newPrivateButton.setAttribute("id", "selected");
await showListUser();
});
newGameButton.addEventListener("click", () => {
newPrivateButton.removeAttribute("id");
newGameButton.setAttribute("id", "selected");
showActualGameMessage();
});
}
function removeButtonIfExist()
{
const divButtonTypeChatHome = document.getElementById("buttonTypeChatHome");
if (divButtonTypeChatHome)
{
divButtonTypeChatHome.remove();
document.getElementById("messageListChatHome").remove();
}
}
async function showChatMenu()
function showChatMenu()
{
const infoChat = document.getElementById("infoChat");
chatDiv.style.display = "flex";
if (userMeInfo.id !== -1)
{
if (infoChat)
infoChat.remove();
removeButtonIfExist();
addDefaultButton();
await showListUser();
}
showListUser();
}
function hideChatMenu()
{
console.log("hideChatMenu");
chatDiv.style.display = "none";
infoPanel.isOpen = false;
}
export { LiveChat };
export { LiveChat, showChatMenu };