Skip to content

Commit

Permalink
Merge pull request online-go#2547 from benjaminpjones/short-log-no-sh…
Browse files Browse the repository at this point in the history
…ow-all

Don't show the "show all" button if the log is small
  • Loading branch information
anoek authored Feb 3, 2024
2 parents 4a6f2fa + 2984d4f commit 7fcd8f3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/views/ReportsCenter/ReportedGame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -309,7 +311,10 @@ function GameLog({ goban }: { goban: Goban }): JSX.Element {
</thead>
<tbody>
{log
.filter((_, idx) => shouldDisplayFullLog || idx < 25)
.filter(
(_, idx) =>
shouldDisplayFullLog || idx < TRUNCATED_GAME_LOG_LENGTH,
)
.map((entry, idx) => (
<tr key={entry.timestamp + ":" + idx} className="entry">
<td className="timestamp">
Expand All @@ -328,7 +333,7 @@ function GameLog({ goban }: { goban: Goban }): JSX.Element {
))}
</tbody>
</table>
{!shouldDisplayFullLog && (
{!shouldDisplayFullLog && log.length > TRUNCATED_GAME_LOG_LENGTH && (
<button onClick={() => setShouldDisplayFullLog(true)}>
{`${_("Show all")} (${log.length})`}
</button>
Expand Down

0 comments on commit 7fcd8f3

Please sign in to comment.