- on popup chat, point on end line for see if you have seen the last message
    - on chat buttton, red point for know if you have a new message
    - fix image in live chat
This commit is contained in:
Kum1ta
2024-09-29 03:52:10 +02:00
parent 4ef459e2cc
commit 24fe748130
8 changed files with 104 additions and 48 deletions

View File

@ -6,12 +6,12 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:19:10 by edbernar #+# #+# */
/* Updated: 2024/09/21 22:41:48 by edbernar ### ########.fr */
/* Updated: 2024/09/29 03:43:31 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { userListUnread } from "/static/javascript/typeResponse/typePrivateListUser.js";
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";
@ -50,8 +50,14 @@ function showChatMenu()
function hideChatMenu()
{
const notifBadgeChat = document.getElementsByClassName('notification-badge')[0];
chatDiv.style.display = "none";
infoPanel.isOpen = false;
if (!userListUnread.length)
notifBadgeChat.style.display = 'none';
else
notifBadgeChat.style.display = 'flex';
}
export { LiveChat, showChatMenu };

View File

@ -6,30 +6,33 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:17:54 by edbernar #+# #+# */
/* Updated: 2024/09/22 17:16:00 by edbernar ### ########.fr */
/* Updated: 2024/09/29 03:46:37 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import { messageList, infoPanel, waitForMessageList } from "/static/javascript/typeResponse/typePrivateListMessage.js";
import { userListUnread } from "/static/javascript/typeResponse/typePrivateListUser.js";
import { userMeInfo } from "/static/javascript/typeResponse/typeLogin.js";
import { showListUser } from "/static/javascript/liveChat/showUserList.js";
import { sendRequest } from "/static/javascript/websocket.js";
let savedButtons = [];
function showPrivateChat(user)
{
const divMessageListChatHome = document.getElementById("messageListChatHome");
sendRequest("get_private_list_message", {id: user.id});
waitForMessageList().then(() => {
try {
userListUnread.splice(userListUnread.indexOf(user.id), 1);
}
catch (e) {};
infoPanel.id = user.id;
infoPanel.isOpen = true;
infoPanel.divMessage = divMessageListChatHome;
sendRequest("read_message", {id: user.id});
changeButton(user);
displayAllMessage(divMessageListChatHome);
displayInputBar(divMessageListChatHome, user);
})
}

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/04 19:21:10 by edbernar #+# #+# */
/* Updated: 2024/09/25 08:50:20 by edbernar ### ########.fr */
/* Updated: 2024/09/29 03:09:29 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -45,10 +45,15 @@ function showListUser() {
user.classList.add("user");
user.innerHTML = `
<div class="status ${element.status}">
<img>
<img>
</div>
<h3></h3>
`
if (element.haveUnread)
{
user.innerHTML += `<span></span>`;
user.querySelector("span").style.marginLeft = "auto";
}
user.querySelector("img").src = element.pfp;
user.querySelector("h3").innerText = element.name;
divMessageListChatHome.appendChild(user);