Files
METH_Transcendence/docker-compose/requirements/nginx/static/javascript/liveChat/main.js
Kum1ta d29c58ae42 Site
- 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
2024-09-21 23:14:27 +02:00

57 lines
2.0 KiB
JavaScript

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.js :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:19:10 by edbernar #+# #+# */
/* Updated: 2024/09/21 22:41:48 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { infoPanel } from "/static/javascript/typeResponse/typePrivateListMessage.js";
import { showActualGameMessage } from "/static/javascript/liveChat/showActualGameMessage.js";
import { showListUser } from "/static/javascript/liveChat/showUserList.js";
import { userMeInfo } from "/static/javascript/typeResponse/typeLogin.js";
let chatButton = null;
let topChatHomeCross = null;
class LiveChat
{
static create()
{
chatButton = document.getElementById("chatButton");
topChatHomeCross = document.getElementById("topChatCross");
chatButton.addEventListener("click", showChatMenu);
topChatHomeCross.addEventListener("click", hideChatMenu);
}
static dispose()
{
chatButton.removeEventListener("click", showChatMenu);
topChatHomeCross.removeEventListener("click", hideChatMenu);
chatButton = null;
topChatHomeCross = null;
}
}
function showChatMenu()
{
const infoChat = document.getElementById("infoChat");
chatDiv.style.display = "flex";
if (userMeInfo.id !== -1)
showListUser();
}
function hideChatMenu()
{
chatDiv.style.display = "none";
infoPanel.isOpen = false;
}
export { LiveChat, showChatMenu };