feat(chat): fixed typo in profile command and improved profile in chat
This commit is contained in:
parent
3e1dd0fdd9
commit
69ba60b03d
6 changed files with 28 additions and 16 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <name>\' - pulls ups user profil');
|
||||
addMessage('\'@profile <name>\' - pulls ups user profile');
|
||||
addMessage('\'@notify\' - toggles notifications on / off');
|
||||
addMessage('\'@quit\' - disconnect user from the chat');
|
||||
addMessage('** *********************************** **');
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@ export async function openProfilePopup(profil: ClientProfil) {
|
|||
modalname.innerHTML =
|
||||
`
|
||||
<div class="profile-info">
|
||||
<div-profil-name id="profilName" class="text-xl font-bold text-blue-500"> Profil of ${profil.user} </div>
|
||||
<div-login-name id="loginName"> Login status: '${profil.loginName ?? 'Guest'}' </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: <span class="recessed">${profil.loginName ?? 'Guest'}</span> </div>
|
||||
</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>
|
||||
<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>
|
||||
<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>
|
||||
`;
|
||||
const profilList = document.getElementById("profile-modal") ?? null;
|
||||
if (profilList)
|
||||
profilList.classList.remove("hidden");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue