feat(chat): fixed typo in profile command and improved profile in chat

This commit is contained in:
Maieul BOYER 2026-01-04 16:36:34 +01:00 committed by Maix0
parent 3e1dd0fdd9
commit 69ba60b03d
6 changed files with 28 additions and 16 deletions

View file

@ -6,6 +6,18 @@
@tailwind utilities; @tailwind utilities;
.recessed {
@apply
inline-block
bg-gray-100
text-gray-800
p-2
rounded-md
shadow-inner
border
border-gray-300;
}
.btn-style { .btn-style {
@apply @apply
w-25 w-25

View file

@ -103,7 +103,7 @@ function parseCmdMsg(msgText: string): string[] | undefined {
return command; return command;
} }
const ArgCommands = ['@profil', '@block']; const ArgCommands = ['@profile', '@block'];
const userName = msgText.indexOf(" "); const userName = msgText.indexOf(" ");
const cmd2 = msgText.slice(0, userName).trim() ?? ""; const cmd2 = msgText.slice(0, userName).trim() ?? "";
const user = msgText.slice(userName + 1).trim(); const user = msgText.slice(userName + 1).trim();
@ -426,7 +426,7 @@ function handleChat(_url: string, _args: RouteHandlerParams): RouteHandlerReturn
inviteMsgFlag = false; inviteMsgFlag = false;
} }
break; break;
case '@profil': case '@profile':
if (msgCommand[1] === '') {break;}; if (msgCommand[1] === '') {break;};
getProfil(socket, msgCommand[1]); getProfil(socket, msgCommand[1]);
break; break;
@ -437,7 +437,7 @@ function handleChat(_url: string, _args: RouteHandlerParams): RouteHandlerReturn
addMessage('*'); addMessage('*');
addMessage('** ********** List of @cmds ********** **'); addMessage('** ********** List of @cmds ********** **');
addMessage('\'@cls\' - clear chat screen conversations'); addMessage('\'@cls\' - clear chat screen conversations');
addMessage('\'@profil <name>\' - pulls ups user profil'); addMessage('\'@profile <name>\' - pulls ups user profile');
addMessage('\'@notify\' - toggles notifications on / off'); addMessage('\'@notify\' - toggles notifications on / off');
addMessage('\'@quit\' - disconnect user from the chat'); addMessage('\'@quit\' - disconnect user from the chat');
addMessage('** *********************************** **'); addMessage('** *********************************** **');

View file

@ -10,7 +10,7 @@ import { Socket } from 'socket.io-client';
export function getProfil(socket: Socket, user: string) { export function getProfil(socket: Socket, user: string) {
if (!socket.connected) return; if (!socket.connected) return;
const profil = { const profil = {
command: '@profil', command: '@profile',
destination: 'profilMessage', destination: 'profilMessage',
type: "chat", type: "chat",
user: user, user: user,

View file

@ -6,17 +6,17 @@ export async function openProfilePopup(profil: ClientProfil) {
modalname.innerHTML = modalname.innerHTML =
` `
<div class="profile-info"> <div class="profile-info">
<div-profil-name id="profilName" class="text-xl font-bold text-blue-500"> Profil of ${profil.user} </div> <div-profil-name id="profilName" class="text-xl font-bold text-blue-500"> Profile of ${profil.user} </div>
<div-login-name id="loginName"> Login status: '${profil.loginName ?? 'Guest'}' </div> <div-login-name id="loginName"> Login status: <span class="recessed">${profil.loginName ?? 'Guest'}</span> </div>
</br> </br>
<div-login-name id="loginName"> Login ID: '${profil.userID ?? ''}' </div> <div-login-name id="loginName"> Login ID: <span class="recessed">${profil.userID ?? ''}</span> </div>
</br> </br>
<button id="popup-b-invite" class="btn-style popup-b-invite">U Game ?</button> <button id="popup-b-invite" class="btn-style popup-b-invite">U Game ?</button>
<button id="popup-b-block" class="btn-style popup-b-block">Block User</button> <button id="popup-b-block" class="btn-style popup-b-block">Block User</button>
<div id="profile-about" class="text-2xl text-amber-500">About: '${profil.text}' </div> <div id="profile-about" class="text-2xl">About: <span class="recessed text-amber-500">${profil.text}</span> </div>
</div> </div>
`; `;
const profilList = document.getElementById("profile-modal") ?? null; const profilList = document.getElementById("profile-modal") ?? null;
if (profilList) if (profilList)
profilList.classList.remove("hidden"); profilList.classList.remove("hidden");
} }

View file

@ -20,10 +20,10 @@ export async function makeProfil(fastify: FastifyInstance, user: string, socket:
const users: User[] = fastify.db.getAllUsers() ?? []; const users: User[] = fastify.db.getAllUsers() ?? [];
const allUsers: User | null = getUserByName(users, user); const allUsers: User | null = getUserByName(users, user);
if (user === allUsers?.name) { if (user === allUsers?.name) {
let loginState = `${allUsers?.login ?? 'Guest'}`; let loginState = 'Guest';
if (loginState !== 'Guest') { if (allUsers?.login) { loginState = 'Member'; }
loginState = 'Member'; if (allUsers.provider_unique) { loginState = 'External Member'; }
}
clientProfil = clientProfil =
{ {
command: 'makeProfil', command: 'makeProfil',

View file

@ -1,7 +1,7 @@
import { UserId } from '@shared/database/mixin/user'; import { UserId } from '@shared/database/mixin/user';
export class Paddle { 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_HEIGHT = 80;
public static readonly DEFAULT_WIDTH = 12; public static readonly DEFAULT_WIDTH = 12;
@ -30,7 +30,7 @@ class Ball {
public static readonly DEFAULT_SIZE = 16; public static readonly DEFAULT_SIZE = 16;
public static readonly DEFAULT_MAX_SPEED = 15; public static readonly DEFAULT_MAX_SPEED = 15;
public static readonly DEFAULT_MIN_SPEED = Ball.DEFAULT_SPEED; 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 speed: number = Ball.DEFAULT_SPEED;
public size: number = Ball.DEFAULT_SIZE; public size: number = Ball.DEFAULT_SIZE;
@ -51,7 +51,7 @@ class Ball {
walls: { [k in typeof side]: number }, walls: { [k in typeof side]: number },
snap: boolean = true, snap: boolean = true,
) { ) {
// this.speed *= this.accel_factor; this.speed *= this.accel_factor;
this.speed = Math.max( this.speed = Math.max(
Math.min(this.speed, this.max_speed), Math.min(this.speed, this.max_speed),
this.min_speed, this.min_speed,