From e96354c6d214a3fc74b06a194760b2180b9056b1 Mon Sep 17 00:00:00 2001 From: bitsearch Date: Thu, 22 Jan 2026 15:03:54 +0100 Subject: [PATCH] ajout de boutton --- srcs/frontend/src/app.js | 22 ++++++++++++++-------- srcs/frontend/src/avatarWindows.js | 7 +++++++ srcs/frontend/src/index.html | 1 + 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 srcs/frontend/src/avatarWindows.js diff --git a/srcs/frontend/src/app.js b/srcs/frontend/src/app.js index f511867..555e56c 100644 --- a/srcs/frontend/src/app.js +++ b/srcs/frontend/src/app.js @@ -1,9 +1,8 @@ import {Element, MenuElement} from "./element.js"; -import {Grid} from "./grid.js"; import {fenetre} from "./windows.js"; import {LoginWindow} from "./login.js"; import { GlobalChat } from "./global_chat.js"; - +import {avatarWindows} from "./avatarWindows.js"; function direBonjour() { alert("clicked !"); @@ -16,15 +15,12 @@ const registeredElement = new MenuElement("registered"); const explorerElement = new MenuElement("explorer"); const accueilElement = new MenuElement("accueil"); const globalChatElement = new MenuElement("global_chat"); - -// Start of the grid (commented if we dont use it yet) -// const gridgreen = new Grid('#143a0fff', -1, 25, 0.12, "normal"); -// const gridReverseRed = new Grid('#3a0f0f75', -1, 12.5, 0.09, "reverse"); - +const avatarElement = new MenuElement("avatar"); // Windows and screens -const test = new fenetre(); const loginWindow = new LoginWindow(); const global_chat = new GlobalChat(); +const avatar_windows = new avatarWindows(); + // Actions UI document.getElementById("login").addEventListener("click", () => { @@ -44,3 +40,13 @@ document.getElementById("global_chat").addEventListener("click", () => { global_chat.show(); } }); + + +document.getElementById("avatar").addEventListener("click", () => { + // Toggle global chat visibility + if (avatarWindows.main && avatarWindows.main.style.display !== "none") { + avatarWindows.hide(); + } else { + avatarWindows.show(); + } +}); \ No newline at end of file diff --git a/srcs/frontend/src/avatarWindows.js b/srcs/frontend/src/avatarWindows.js new file mode 100644 index 0000000..f4cc3f4 --- /dev/null +++ b/srcs/frontend/src/avatarWindows.js @@ -0,0 +1,7 @@ +import {fenetre} from "./windows.js"; + +export class avatarWindows extends fenetre { + constructor(){ + super(320, 240, "Avatar"); + } +} \ No newline at end of file diff --git a/srcs/frontend/src/index.html b/srcs/frontend/src/index.html index 30d951c..54e2f12 100644 --- a/srcs/frontend/src/index.html +++ b/srcs/frontend/src/index.html @@ -17,6 +17,7 @@ +