From 69ba60b03d211e548742cb5ac013bf6b09d56186 Mon Sep 17 00:00:00 2001 From: Maieul BOYER Date: Sun, 4 Jan 2026 16:36:34 +0100 Subject: [PATCH] feat(chat): fixed typo in profile command and improved profile in chat --- frontend/src/pages/chat/chat.css | 12 ++++++++++++ frontend/src/pages/chat/chat.ts | 6 +++--- .../src/pages/chat/chatHelperFunctions/getProfil.ts | 2 +- .../chat/chatHelperFunctions/openProfilePopup.ts | 10 +++++----- src/chat/src/chatBackHelperFunctions/makeProfil.ts | 8 ++++---- src/pong/src/game.ts | 6 +++--- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/frontend/src/pages/chat/chat.css b/frontend/src/pages/chat/chat.css index 2711959..720fbdc 100644 --- a/frontend/src/pages/chat/chat.css +++ b/frontend/src/pages/chat/chat.css @@ -6,6 +6,18 @@ @tailwind utilities; +.recessed { + @apply + inline-block + bg-gray-100 + text-gray-800 + p-2 + rounded-md + shadow-inner + border + border-gray-300; +} + .btn-style { @apply w-25 diff --git a/frontend/src/pages/chat/chat.ts b/frontend/src/pages/chat/chat.ts index 495e1bb..93d82d1 100644 --- a/frontend/src/pages/chat/chat.ts +++ b/frontend/src/pages/chat/chat.ts @@ -103,7 +103,7 @@ function parseCmdMsg(msgText: string): string[] | undefined { return command; } - const ArgCommands = ['@profil', '@block']; + const ArgCommands = ['@profile', '@block']; const userName = msgText.indexOf(" "); const cmd2 = msgText.slice(0, userName).trim() ?? ""; const user = msgText.slice(userName + 1).trim(); @@ -426,7 +426,7 @@ function handleChat(_url: string, _args: RouteHandlerParams): RouteHandlerReturn inviteMsgFlag = false; } break; - case '@profil': + case '@profile': if (msgCommand[1] === '') {break;}; getProfil(socket, msgCommand[1]); break; @@ -437,7 +437,7 @@ function handleChat(_url: string, _args: RouteHandlerParams): RouteHandlerReturn addMessage('*'); addMessage('** ********** List of @cmds ********** **'); addMessage('\'@cls\' - clear chat screen conversations'); - addMessage('\'@profil \' - pulls ups user profil'); + addMessage('\'@profile \' - pulls ups user profile'); addMessage('\'@notify\' - toggles notifications on / off'); addMessage('\'@quit\' - disconnect user from the chat'); addMessage('** *********************************** **'); diff --git a/frontend/src/pages/chat/chatHelperFunctions/getProfil.ts b/frontend/src/pages/chat/chatHelperFunctions/getProfil.ts index dc7465b..291f285 100644 --- a/frontend/src/pages/chat/chatHelperFunctions/getProfil.ts +++ b/frontend/src/pages/chat/chatHelperFunctions/getProfil.ts @@ -10,7 +10,7 @@ import { Socket } from 'socket.io-client'; export function getProfil(socket: Socket, user: string) { if (!socket.connected) return; const profil = { - command: '@profil', + command: '@profile', destination: 'profilMessage', type: "chat", user: user, diff --git a/frontend/src/pages/chat/chatHelperFunctions/openProfilePopup.ts b/frontend/src/pages/chat/chatHelperFunctions/openProfilePopup.ts index 23e3d72..3f758a4 100644 --- a/frontend/src/pages/chat/chatHelperFunctions/openProfilePopup.ts +++ b/frontend/src/pages/chat/chatHelperFunctions/openProfilePopup.ts @@ -6,17 +6,17 @@ export async function openProfilePopup(profil: ClientProfil) { modalname.innerHTML = `
- Profil of ${profil.user}
- Login status: '${profil.loginName ?? 'Guest'}' + Profile of ${profil.user} + Login status: ${profil.loginName ?? 'Guest'}
- Login ID: '${profil.userID ?? ''}' + Login ID: ${profil.userID ?? ''}
-
About: '${profil.text}'
+
About: ${profil.text}
`; const profilList = document.getElementById("profile-modal") ?? null; if (profilList) profilList.classList.remove("hidden"); -} \ No newline at end of file +} diff --git a/src/chat/src/chatBackHelperFunctions/makeProfil.ts b/src/chat/src/chatBackHelperFunctions/makeProfil.ts index 3324135..3fe3465 100644 --- a/src/chat/src/chatBackHelperFunctions/makeProfil.ts +++ b/src/chat/src/chatBackHelperFunctions/makeProfil.ts @@ -20,10 +20,10 @@ export async function makeProfil(fastify: FastifyInstance, user: string, socket: const users: User[] = fastify.db.getAllUsers() ?? []; const allUsers: User | null = getUserByName(users, user); if (user === allUsers?.name) { - let loginState = `${allUsers?.login ?? 'Guest'}`; - if (loginState !== 'Guest') { - loginState = 'Member'; - } + let loginState = 'Guest'; + if (allUsers?.login) { loginState = 'Member'; } + if (allUsers.provider_unique) { loginState = 'External Member'; } + clientProfil = { command: 'makeProfil', diff --git a/src/pong/src/game.ts b/src/pong/src/game.ts index d042f5c..59675ca 100644 --- a/src/pong/src/game.ts +++ b/src/pong/src/game.ts @@ -1,7 +1,7 @@ import { UserId } from '@shared/database/mixin/user'; export class Paddle { - public static readonly DEFAULT_SPEED = 20; + public static readonly DEFAULT_SPEED = 10; public static readonly DEFAULT_HEIGHT = 80; public static readonly DEFAULT_WIDTH = 12; @@ -30,7 +30,7 @@ class Ball { public static readonly DEFAULT_SIZE = 16; public static readonly DEFAULT_MAX_SPEED = 15; public static readonly DEFAULT_MIN_SPEED = Ball.DEFAULT_SPEED; - public static readonly DEFAULT_ACCEL_FACTOR = 1.2; + public static readonly DEFAULT_ACCEL_FACTOR = 1.1; public speed: number = Ball.DEFAULT_SPEED; public size: number = Ball.DEFAULT_SIZE; @@ -51,7 +51,7 @@ class Ball { walls: { [k in typeof side]: number }, snap: boolean = true, ) { - // this.speed *= this.accel_factor; + this.speed *= this.accel_factor; this.speed = Math.max( Math.min(this.speed, this.max_speed), this.min_speed,