From 0b5306c3cfa8abb6be445c239d4448eba82a148a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?AiDN=E2=84=A2?= <45371311+originalaidn@users.noreply.github.com> Date: Sat, 4 May 2024 09:21:50 +0200 Subject: [PATCH] truncating player's name in recent bans&mutes --- resources/js/dashboard/recent.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/resources/js/dashboard/recent.ts b/resources/js/dashboard/recent.ts index 811c325..3386b18 100755 --- a/resources/js/dashboard/recent.ts +++ b/resources/js/dashboard/recent.ts @@ -31,7 +31,7 @@ function constructTableRows(data: any[]): string { const progress = calculateProgress(item.created, item.ends); html += ` - ${item.player_name} + ${truncatePlayerName(item.player_name)} Profile ${formatDuration(item.created)} ${item.ends} @@ -50,7 +50,10 @@ function constructTableRows(data: any[]): string { return html; } - - - - +function truncatePlayerName(playerName: string): string { + if (playerName.length > 19) { + return playerName.substring(0, 16) + '...'; + } else { + return playerName; + } +}