-
Notifications
You must be signed in to change notification settings - Fork 0
A bunch of upgrades #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,22 +1,16 @@ | ||||||
| import { Game, Settings } from "../../types"; | ||||||
| import ChessBoard from "../Chess/ChessBoard"; | ||||||
| import { type PageProps } from "./page"; | ||||||
| import { type PageProps } from "./Page"; | ||||||
| import GameTitle from "../GameTitle"; | ||||||
| import ContentPage from "./ContentPage"; | ||||||
| import MoveListTable from "../Chess/MoveListTable"; | ||||||
| import MoveListInline from "../Chess/MoveListInline"; | ||||||
|
|
||||||
| function GameRow(props: { index: number; settings: Settings; game: Game }) { | ||||||
| function GameRow(props: { index: number; settings: Settings; game: Game, totalMoveRows: number, fullLength: Boolean }) { | ||||||
| const moves = props.game.moves.split(" "); | ||||||
|
|
||||||
| // Find the best variant to use to get the most out the move data. | ||||||
| let size = "text-xs"; | ||||||
| if (moves.length < 20 * 2) { | ||||||
| size = "text-xs"; | ||||||
| } else if (moves.length < 33 * 2) { | ||||||
| size = "text-xs"; | ||||||
| } else { | ||||||
| size = "text-xs"; | ||||||
| } | ||||||
|
|
||||||
| return ( | ||||||
| <div> | ||||||
|
|
@@ -28,21 +22,46 @@ function GameRow(props: { index: number; settings: Settings; game: Game }) { | |||||
| white={props.game.white} | ||||||
| /> | ||||||
| </div> | ||||||
| <MoveListTable moves={moves} highlightedPly={props.game.board.ply} size={size} columns="columns-2 gap-4" /> | ||||||
| {props.totalMoveRows > 35 * (Number(props.fullLength) + 1) && moves.length > 40 * (Number(props.fullLength) + 1) | ||||||
| ? ( | ||||||
| <MoveListInline moves={moves} highlightedPly={props.game.board.ply} size={size} /> | ||||||
| ) | ||||||
| : ( | ||||||
| <MoveListTable moves={moves} highlightedPly={props.game.board.ply} size={size} columns="columns-2 gap-4" /> | ||||||
| )} | ||||||
| </div> | ||||||
| ); | ||||||
| } | ||||||
|
|
||||||
| export default function SixGamePage(props: PageProps & { games: Game[] }) { | ||||||
| const sortedByMoveCountGames = [...props.games].sort((a, b) => { | ||||||
| return b.movesCount - a.movesCount; | ||||||
| }); | ||||||
|
|
||||||
| const totalMoveRows = sortedByMoveCountGames[0].movesCount + (sortedByMoveCountGames[3]?.movesCount ?? 0) / 2; | ||||||
|
|
||||||
| let yGap = 'gap-y-4'; | ||||||
|
||||||
| let yGap = 'gap-y-4'; | |
| let yGap; |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class string includes ${totalMoveRows} which outputs a number directly into the className. This appears to be a debugging artifact and will create an invalid CSS class. Consider removing this debug value from the className.
| <div className={`grid grid-cols-3 gap-x-4 ${yGap} ${totalMoveRows}`}> | |
| <div className={`grid grid-cols-3 gap-x-4 ${yGap}`}> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -21,8 +21,8 @@ export default function MoveListTable(props: { moves: string[], highlightedPly: | |||||
| <td className="text-gray-400 w-6 font-anton"> | ||||||
| {i + 1} | ||||||
| </td> | ||||||
| <td><span className={i * 2 == props.highlightedPly - 1 ? highlightedStyle : ''}>{moves[0]}</span></td> | ||||||
| <td><span className={i * 2 + 1 === props.highlightedPly - 1 ? highlightedStyle : ''}>{moves[1]}</span></td> | ||||||
| <td><span className={i * 2 == props.highlightedPly ? highlightedStyle : ''}>{moves[0]}</span></td> | ||||||
|
||||||
| <td><span className={i * 2 == props.highlightedPly ? highlightedStyle : ''}>{moves[0]}</span></td> | |
| <td><span className={i * 2 === props.highlightedPly ? highlightedStyle : ''}>{moves[0]}</span></td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeScript primitive type
booleanshould be lowercase, notBoolean(which refers to the Boolean object wrapper).