diff --git a/site/interface/site/liveChat/showPrivateChat.js b/site/interface/site/liveChat/showPrivateChat.js index 6383059..b4217cb 100644 --- a/site/interface/site/liveChat/showPrivateChat.js +++ b/site/interface/site/liveChat/showPrivateChat.js @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* showPrivateChat.js :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: edbernar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/08/04 19:17:54 by edbernar #+# #+# */ -/* Updated: 2024/08/04 23:00:10 by edbernar ### ########.fr */ +/* Updated: 2024/08/05 16:51:04 by edbernar ### ########.fr */ /* */ /* ************************************************************************** */ @@ -120,7 +120,8 @@ async function displayInputBar(divMessageListChatHome, user) inputMessage.focus(); } -function sendMessage(user) { +function sendMessage(user) +{ const inputMessage = document.getElementById("inputMessage"); let message; diff --git a/site/interface/site/liveChat/showUserList.js b/site/interface/site/liveChat/showUserList.js index d4a9612..6fbc44a 100644 --- a/site/interface/site/liveChat/showUserList.js +++ b/site/interface/site/liveChat/showUserList.js @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* showUserList.js :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: edbernar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/08/04 19:21:10 by edbernar #+# #+# */ -/* Updated: 2024/08/04 22:54:30 by edbernar ### ########.fr */ +/* Updated: 2024/08/05 14:28:31 by edbernar ### ########.fr */ /* */ /* ************************************************************************** */ @@ -28,14 +28,17 @@ async function showListUser() { if (JSON.stringify(userList) !== "{}") { userList.forEach(element => { - divMessageListChatHome.innerHTML += ` -
-
- -
-

${element.name}

+ let user = document.createElement("div"); + user.classList.add("user"); + user.innerHTML = ` +
+
- `; +

+ ` + user.querySelector("img").src = element.pfp; + user.querySelector("h3").innerText = element.name; + divMessageListChatHome.appendChild(user); }); } divMessageListChatHome.innerHTML += "

New conversation +

"; diff --git a/site/interface/site/main.js b/site/interface/site/main.js index f097f48..71f2e6b 100644 --- a/site/interface/site/main.js +++ b/site/interface/site/main.js @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* main.js :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: edbernar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/30 13:50:35 by edbernar #+# #+# */ -/* Updated: 2024/08/04 23:47:45 by edbernar ### ########.fr */ +/* Updated: 2024/08/05 18:10:32 by edbernar ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,10 +20,6 @@ document.addEventListener('DOMContentLoaded', () => { document.addEventListener("keydown", (e) => { - if (e.key === "/") - createNotification.info("Hello"); - if (e.key === "*") - createNotification.success("Hello"); - if (e.key === "-") - createNotification.error("Hello"); + if (e.key === "+") + createNotification.new("Server", "Server dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkver dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkver dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkver dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkver dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkver dsalj dhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dkasjdl jsahkjd ashkjddhsakj hdsakjh dasjdl jsahkjd ashkjd shakjdh sakjhd askjhd aksjhd kjsahd jsk is slow"); }); \ No newline at end of file diff --git a/site/interface/site/notification/ico/error.png b/site/interface/site/notification/ico/error.png new file mode 100644 index 0000000..b4dc6b8 Binary files /dev/null and b/site/interface/site/notification/ico/error.png differ diff --git a/site/interface/site/notification/ico/info.png b/site/interface/site/notification/ico/info.png new file mode 100644 index 0000000..5b9754d Binary files /dev/null and b/site/interface/site/notification/ico/info.png differ diff --git a/site/interface/site/notification/ico/success.png b/site/interface/site/notification/ico/success.png new file mode 100644 index 0000000..d31d26b Binary files /dev/null and b/site/interface/site/notification/ico/success.png differ diff --git a/site/interface/site/notification/ico/warning.png b/site/interface/site/notification/ico/warning.png new file mode 100644 index 0000000..e34ef61 Binary files /dev/null and b/site/interface/site/notification/ico/warning.png differ diff --git a/site/interface/site/notification/main.js b/site/interface/site/notification/main.js index d6a2abf..6b59f74 100644 --- a/site/interface/site/notification/main.js +++ b/site/interface/site/notification/main.js @@ -3,16 +3,17 @@ /* ::: :::::::: */ /* main.js :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: edbernar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/08/04 23:32:52 by edbernar #+# #+# */ -/* Updated: 2024/08/05 00:24:52 by edbernar ### ########.fr */ +/* Updated: 2024/08/05 18:29:04 by edbernar ### ########.fr */ /* */ /* ************************************************************************** */ /* Todo (Eddy) : - Image but not necessary + - icon - Title - Message - Action button @@ -21,55 +22,80 @@ - pause when hover */ -function newNotification(type, timer) +function createHeader(title) { - const divNotification = document.getElementById("divNotification"); - const newNotification = document.createElement("div"); + const divHeader = document.createElement("div"); + const icon = document.createElement("img"); + const h1Title = document.createElement("h1"); + const cross = document.createElement("p"); + + divHeader.classList.add("header"); + icon.style.width = "20px"; + icon.style.height = "20px"; + icon.style.position = 'absolute'; + icon.style.left = '10px'; + icon.style.top = '15px'; + h1Title.innerHTML = title; + h1Title.style.textAlign = "center"; + h1Title.style.width = "100%"; + h1Title.style.marginTop = "5px"; + cross.innerHTML = "X"; + cross.style.position = 'absolute'; + cross.style.right = '10px'; + cross.style.top = '20px'; + cross.style.cursor = 'pointer'; + cross.style.margin = '0'; + divHeader.appendChild(icon); + divHeader.appendChild(h1Title); + divHeader.appendChild(cross); + return (divHeader); +} + +function createContent(message) +{ + const divContent = document.createElement("div"); + const pMessage = document.createElement("p"); + const limit = 100; + + divContent.classList.add("content"); + pMessage.style.textAlign = "center"; + if (message.length > limit) + message = message.substring(0, limit) + "..."; + pMessage.innerHTML = message; + divContent.appendChild(pMessage); + return (divContent); +} + +function newNotification(title, message, img, action, timer) +{ + const divNotification = document.getElementById("divNotification"); + const newNotification = document.createElement("div"); + const header = createHeader(title); + const content = createContent(message, img); newNotification.classList.add("notification"); - - newNotification.innerHTML = "This is a " + type + " notification"; newNotification.style.width = "100%"; + newNotification.appendChild(header); divNotification.appendChild(newNotification); - setInterval(() => { - newNotification.style.opacity = 1; - }, 100); + newNotification.appendChild(content); setTimeout(() => { setTimeout(() => { divNotification.removeChild(newNotification); - }, 99); - newNotification.style.animation = "slideOut 0.11s"; + }, 199); + newNotification.style.animation = "slideOut 0.21s"; }, timer); } class notification { - timer = 2000; + timer = 5000; constructor() {} - info(message, action=null) + new(title, message, img=null, action=null) { - console.log("New info notification: " + message); - newNotification("info", this.timer); - } - - success(message, action=null) - { - console.log("New success notification: " + message); - newNotification("success", this.timer); - } - - warning(message, action=null) - { - console.log("New warning notification: " + message); - newNotification("warning", this.timer); - } - - error(message, action=null) - { - console.log("New error notification: " + message); - newNotification("error", this.timer); + console.log("New notification: " + message); + newNotification(title, message, img, action, this.timer); } } diff --git a/site/interface/site/style/notification.css b/site/interface/site/style/notification.css index 2ea1e49..e4b94c0 100644 --- a/site/interface/site/style/notification.css +++ b/site/interface/site/style/notification.css @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* notification.css :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: edbernar +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/08/04 23:44:17 by edbernar #+# #+# */ -/* Updated: 2024/08/05 00:15:17 by edbernar ### ########.fr */ +/* Updated: 2024/08/05 18:17:02 by edbernar ### ########.fr */ /* */ /* ************************************************************************** */ @@ -36,10 +36,9 @@ #divNotification { position: fixed; overflow: hidden; - top: 10px; - right: 0; - width: 300px; - height: 100%; + font-family: 'Poppins'; + top: 0px; + right: 10px; display: flex; flex-direction: column; z-index: 1000; @@ -48,10 +47,41 @@ #divNotification .notification { background-color: #222222; color: white; - padding: 10px; - margin: 10px; - border-radius: 5px; - height: 100px; + margin-top: 10px; min-height: 100px; + min-width: 150px; + max-width: 400px; animation: slideIn 0.1s; } + +#divNotification .header { + display: flex; + flex-direction: row; +} + +#divNotification .header h1 { + font-size: 1.2em; + margin: 0; +} + +#divNotification .header img { + background-color: #222222; + color: white; + border: none; + margin-right: 6px; + margin-top: 4px; +} + +#divNotification .content { + margin: 0; + width: 95%; + padding: 2.5%; +} + +#divNotification .content img { + object-fit: cover; object-position: 100% 0; +} + +#divNotification .content p { + word-wrap: break-word; +} \ No newline at end of file diff --git a/websocket-server/Class/__pycache__/User.cpython-310.pyc b/websocket-server/Class/__pycache__/User.cpython-310.pyc new file mode 100644 index 0000000..3d2c99d Binary files /dev/null and b/websocket-server/Class/__pycache__/User.cpython-310.pyc differ diff --git a/websocket-server/typeRequets/__pycache__/getPrivateListMessage.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/getPrivateListMessage.cpython-310.pyc new file mode 100644 index 0000000..b018eec Binary files /dev/null and b/websocket-server/typeRequets/__pycache__/getPrivateListMessage.cpython-310.pyc differ diff --git a/websocket-server/typeRequets/__pycache__/getPrivateListUser.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/getPrivateListUser.cpython-310.pyc new file mode 100644 index 0000000..d176516 Binary files /dev/null and b/websocket-server/typeRequets/__pycache__/getPrivateListUser.cpython-310.pyc differ diff --git a/websocket-server/typeRequets/__pycache__/login.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/login.cpython-310.pyc new file mode 100644 index 0000000..479b869 Binary files /dev/null and b/websocket-server/typeRequets/__pycache__/login.cpython-310.pyc differ diff --git a/websocket-server/typeRequets/__pycache__/sendPrivateMessage.cpython-310.pyc b/websocket-server/typeRequets/__pycache__/sendPrivateMessage.cpython-310.pyc new file mode 100644 index 0000000..c696138 Binary files /dev/null and b/websocket-server/typeRequets/__pycache__/sendPrivateMessage.cpython-310.pyc differ diff --git a/websocket-server/typeRequets/getPrivateListUser.py b/websocket-server/typeRequets/getPrivateListUser.py index ecca5f2..3d3bc50 100644 --- a/websocket-server/typeRequets/getPrivateListUser.py +++ b/websocket-server/typeRequets/getPrivateListUser.py @@ -3,10 +3,10 @@ # ::: :::::::: # # getPrivateListUser.py :+: :+: :+: # # +:+ +:+ +:+ # -# By: edbernar +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2024/08/03 15:10:23 by edbernar #+# #+# # -# Updated: 2024/08/04 14:00:44 by edbernar ### ########.fr # +# Updated: 2024/08/05 16:36:53 by edbernar ### ########.fr # # # # **************************************************************************** # @@ -50,7 +50,7 @@ data = [ "status": "offline", "pfp": "https://pbs.twimg.com/media/EscE6ckU0AA-Uhe.png", "id": 654123 - }, + } ] async def getPrivateListUser(userClass, content=None):