Skip to content

Commit 12f256c

Browse files
fix: format puzzle post-analysis page
1 parent f89dc31 commit 12f256c

1 file changed

Lines changed: 20 additions & 24 deletions

File tree

src/pages/puzzles.tsx

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ const TrainPage: NextPage = () => {
162162
const solutionMoveUci = response.correct_moves?.[0]
163163
const solutionSan =
164164
solutionMoveUci && trainingGames[puzzleIdx]
165-
? trainingGames[puzzleIdx].availableMoves?.[solutionMoveUci]?.san ??
166-
null
165+
? (trainingGames[puzzleIdx].availableMoves?.[solutionMoveUci]?.san ??
166+
null)
167167
: null
168168

169169
if (solutionSan) {
@@ -506,7 +506,8 @@ const Train: React.FC<Props> = ({
506506
smoothedEvalPosition,
507507
])
508508

509-
const currentTurnForBars: 'w' | 'b' = analysisController.currentNode?.turn || 'w'
509+
const currentTurnForBars: 'w' | 'b' =
510+
analysisController.currentNode?.turn || 'w'
510511

511512
const isCurrentPositionCheckmateForBars = useMemo(() => {
512513
if (!analysisController.currentNode) return false
@@ -1040,7 +1041,7 @@ const Train: React.FC<Props> = ({
10401041
exit="exit"
10411042
style={{ willChange: 'transform, opacity' }}
10421043
>
1043-
<div className="flex h-full flex-row gap-4 w-[92%] xl:w-[94%] xl:gap-5 2xl:w-[97%]">
1044+
<div className="flex h-full w-[92%] flex-row gap-4 xl:w-[94%] xl:gap-5 2xl:w-[97%]">
10441045
<motion.div
10451046
className="desktop-left-column-container flex min-h-0 flex-col gap-2"
10461047
variants={itemVariants}
@@ -1067,7 +1068,9 @@ const Train: React.FC<Props> = ({
10671068
</GameInfo>
10681069
</div>
10691070

1070-
<div className="flex min-h-0 flex-1 overflow-hidden">{gamesController}</div>
1071+
<div className="flex min-h-0 flex-1 overflow-hidden">
1072+
{gamesController}
1073+
</div>
10711074

10721075
<Feedback
10731076
status={status}
@@ -1136,9 +1139,7 @@ const Train: React.FC<Props> = ({
11361139
<AnalysisMaiaWinrateBar
11371140
hasValue={renderedMaiaWhiteWinBar.hasValue}
11381141
displayText={renderedMaiaWhiteWinBar.label}
1139-
labelPositionTop={
1140-
smoothedMaiaWhiteWinVerticalPositionLabel
1141-
}
1142+
labelPositionTop={smoothedMaiaWhiteWinVerticalPositionLabel}
11421143
disabled={!analysisEnabled}
11431144
variant="desktop"
11441145
/>
@@ -1201,7 +1202,10 @@ const Train: React.FC<Props> = ({
12011202
/>
12021203
</div>
12031204
</div>
1204-
<div ref={desktopBlunderMeterSectionRef} className="shrink-0 pt-3">
1205+
<div
1206+
ref={desktopBlunderMeterSectionRef}
1207+
className="shrink-0 pt-3"
1208+
>
12051209
<AnalysisCompactBlunderMeter
12061210
variant="desktop"
12071211
data={compactBlunderMeterData}
@@ -1213,7 +1217,7 @@ const Train: React.FC<Props> = ({
12131217
playedMove={
12141218
analysisEnabled && showAnalysis
12151219
? (analysisController.currentNode?.mainChild?.move ??
1216-
undefined)
1220+
undefined)
12171221
: undefined
12181222
}
12191223
hover={analysisEnabled ? hover : mockHover}
@@ -1383,9 +1387,7 @@ const Train: React.FC<Props> = ({
13831387
? `${Math.round(renderedMaiaWhiteWinBar.percent)}%`
13841388
: '--'
13851389
}
1386-
labelPositionTop={
1387-
smoothedMaiaWhiteWinVerticalPositionLabel
1388-
}
1390+
labelPositionTop={smoothedMaiaWhiteWinVerticalPositionLabel}
13891391
disabled={!analysisEnabled}
13901392
variant="mobile"
13911393
/>
@@ -1462,7 +1464,7 @@ const Train: React.FC<Props> = ({
14621464
playedMove={
14631465
analysisEnabled && showAnalysis
14641466
? (analysisController.currentNode?.mainChild?.move ??
1465-
undefined)
1467+
undefined)
14661468
: undefined
14671469
}
14681470
hover={analysisEnabled ? hover : mockHover}
@@ -1593,12 +1595,9 @@ const Train: React.FC<Props> = ({
15931595
analysisEnabled && showAnalysis
15941596
? analysisController.setCurrentMaiaModel
15951597
: () => void 0,
1596-
hover:
1597-
analysisEnabled && showAnalysis ? hover : mockHover,
1598+
hover: analysisEnabled && showAnalysis ? hover : mockHover,
15981599
makeMove:
1599-
analysisEnabled && showAnalysis
1600-
? makeMove
1601-
: mockMakeMove,
1600+
analysisEnabled && showAnalysis ? makeMove : mockMakeMove,
16021601
currentMaiaModel:
16031602
analysisEnabled && showAnalysis
16041603
? analysisController.currentMaiaModel
@@ -1639,12 +1638,9 @@ const Train: React.FC<Props> = ({
16391638
hideStockfishEvalSummary: true,
16401639
}}
16411640
blunderMeterProps={{
1642-
hover:
1643-
analysisEnabled && showAnalysis ? hover : mockHover,
1641+
hover: analysisEnabled && showAnalysis ? hover : mockHover,
16441642
makeMove:
1645-
analysisEnabled && showAnalysis
1646-
? makeMove
1647-
: mockMakeMove,
1643+
analysisEnabled && showAnalysis ? makeMove : mockMakeMove,
16481644
data:
16491645
analysisEnabled && showAnalysis
16501646
? analysisController.blunderMeter

0 commit comments

Comments
 (0)