From 2984d4ff585e6054ef6bb1a44762dcd2bef64a8b Mon Sep 17 00:00:00 2001 From: "Benjamin P. Jones" Date: Fri, 2 Feb 2024 23:21:23 -0800 Subject: [PATCH] Don't show the "show all" button if the log is small --- src/views/ReportsCenter/ReportedGame.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/views/ReportsCenter/ReportedGame.tsx b/src/views/ReportsCenter/ReportedGame.tsx index f593f2bdd4..903016758f 100644 --- a/src/views/ReportsCenter/ReportedGame.tsx +++ b/src/views/ReportsCenter/ReportedGame.tsx @@ -43,6 +43,8 @@ import { socket } from "sockets"; import { Player } from "Player"; import { useUser } from "hooks"; +const TRUNCATED_GAME_LOG_LENGTH = 25; + export function ReportedGame({ game_id, reported_at, @@ -309,7 +311,10 @@ function GameLog({ goban }: { goban: Goban }): JSX.Element { {log - .filter((_, idx) => shouldDisplayFullLog || idx < 25) + .filter( + (_, idx) => + shouldDisplayFullLog || idx < TRUNCATED_GAME_LOG_LENGTH, + ) .map((entry, idx) => ( @@ -328,7 +333,7 @@ function GameLog({ goban }: { goban: Goban }): JSX.Element { ))} - {!shouldDisplayFullLog && ( + {!shouldDisplayFullLog && log.length > TRUNCATED_GAME_LOG_LENGTH && (