Skip to content

Commit 7d81cf6

Browse files
Merge pull request #292 from CSSLab/codex/round8-candidates-challenges
Add round 8 candidates challenges
2 parents fd63ee8 + 0f31232 commit 7d81cf6

2 files changed

Lines changed: 85 additions & 6 deletions

File tree

src/constants/candidates.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,51 @@ export const CANDIDATES_EXTRA_IDEAS: CandidateIdea[] = [
7373

7474
// Drop live tournament moments here as PGN or FEN during the event.
7575
export const CANDIDATES_FEATURED_POSITIONS: CandidatePosition[] = [
76+
{
77+
id: 'rd8-hikaru-technique',
78+
title: "Rd8 Challenge 1: Hikaru's Technique",
79+
subtitle:
80+
'Fabi blundered and it became "a matter of technique" for Hikaru to convert. Can you finish the job? (Nakamura—Caruana)',
81+
summary:
82+
'Hikaru has a winning rook ending. White to move and convert cleanly.',
83+
tag: 'Featured',
84+
accent: 'red',
85+
fen: '7k/R5R1/2p2p2/p6p/2P1P3/7P/r4rP1/6K1 w - - 1 33',
86+
playerColor: 'white',
87+
maiaVersion: 'maia_kdd_1900',
88+
targetMoveNumber: 8,
89+
},
90+
{
91+
id: 'rd8-press-like-lagno',
92+
title: 'Rd8 Challenge 2: Press like Lagno',
93+
subtitle:
94+
"Black didn't take on e5 when she could have. Try to press the advantage with White. (Lagno—Goryachkina)",
95+
summary:
96+
'White has the initiative after Black declined a central capture. Keep pressing and convert the edge.',
97+
tag: 'Featured',
98+
accent: 'amber',
99+
fen: 'r3r1k1/p1pp2bp/bnp3p1/2q1Pp2/2P5/1P4P1/P1QN1PBP/R1B1R1K1 w - f6 0 16',
100+
playerColor: 'white',
101+
maiaVersion: 'maia_kdd_1800',
102+
targetMoveNumber: 8,
103+
},
104+
{
105+
id: 'rd8-knights-over-bishops',
106+
title: 'Rd8 Challenge 3: Knights over Bishops',
107+
subtitle:
108+
'Black has two knights and an extra pawn versus two bishops. Use them to win like Zhu did! (Tan–Zhu)',
109+
summary:
110+
'A complex minor-piece ending with Black pressing. Coordinate the knights and convert.',
111+
tag: 'Featured',
112+
accent: 'blue',
113+
fen: '1r6/4k1p1/1pR1np2/p3p2P/P3B1n1/6B1/1P6/5K2 b - - 3 50',
114+
playerColor: 'black',
115+
maiaVersion: 'maia_kdd_1900',
116+
targetMoveNumber: 8,
117+
},
118+
]
119+
120+
export const CANDIDATES_ROUND_FOUR_POSITIONS: CandidatePosition[] = [
76121
{
77122
id: 'rd4-sindarov-breakthrough',
78123
title: "Rd4 Challenge 1: Sindarov's Breakthrough",

src/pages/candidates.tsx

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useEffect, useMemo, useState } from 'react'
66

77
import {
88
CANDIDATES_FEATURED_POSITIONS,
9+
CANDIDATES_ROUND_FOUR_POSITIONS,
910
CANDIDATES_ROUND_THREE_POSITIONS,
1011
CANDIDATES_ROUND_TWO_POSITIONS,
1112
CANDIDATES_WARMUP_POSITIONS,
@@ -63,6 +64,9 @@ const ChallengeSectionTitle: React.FC<{ title: string }> = ({ title }) => (
6364
</div>
6465
)
6566

67+
const shouldCompactTitles = (positions: CandidatePosition[]) =>
68+
positions.every((position) => position.title.length <= 38)
69+
6670
const PositionBoard: React.FC<{
6771
position: CandidatePosition
6872
completed?: boolean
@@ -136,14 +140,14 @@ const PositionPill: React.FC<{
136140
<div className="flex h-full flex-col gap-4">
137141
<div
138142
className={`min-w-0 ${
139-
compactTitle ? 'xl:min-h-[132px]' : 'xl:min-h-[150px]'
143+
compactTitle ? 'xl:min-h-[122px]' : 'xl:min-h-[150px]'
140144
}`}
141145
>
142146
<h2
143-
className={`overflow-hidden text-lg font-semibold text-primary md:text-xl ${
147+
className={`text-lg font-semibold leading-[1.5rem] text-primary md:text-xl md:leading-[1.75rem] ${
144148
compactTitle
145-
? 'h-[1.5rem] leading-[1.5rem] md:h-[1.75rem] md:leading-[1.75rem]'
146-
: 'h-[3rem] leading-[1.5rem] md:h-[3.5rem] md:leading-[1.75rem]'
149+
? 'xl:h-[1.75rem]'
150+
: 'xl:h-[3.5rem] xl:overflow-hidden'
147151
}`}
148152
>
149153
{position.title}
@@ -203,6 +207,19 @@ export default function CandidatesPage() {
203207
const [completedChallengeIds, setCompletedChallengeIds] = useState<string[]>(
204208
[],
205209
)
210+
const compactFeaturedTitles = shouldCompactTitles(
211+
CANDIDATES_FEATURED_POSITIONS,
212+
)
213+
const compactRoundFourTitles = shouldCompactTitles(
214+
CANDIDATES_ROUND_FOUR_POSITIONS,
215+
)
216+
const compactRoundThreeTitles = shouldCompactTitles(
217+
CANDIDATES_ROUND_THREE_POSITIONS,
218+
)
219+
const compactRoundTwoTitles = shouldCompactTitles(
220+
CANDIDATES_ROUND_TWO_POSITIONS,
221+
)
222+
const compactRoundOneTitles = shouldCompactTitles(CANDIDATES_WARMUP_POSITIONS)
206223
const completedChallengeId =
207224
typeof router.query.completedChallenge === 'string'
208225
? router.query.completedChallenge
@@ -257,7 +274,7 @@ export default function CandidatesPage() {
257274
FIDE Candidates Tournament 2026
258275
</h1>
259276
<p className="mt-2 text-sm uppercase tracking-[0.2em] text-white/45">
260-
Round 4
277+
Round 8
261278
</p>
262279
<div className="mt-4 flex flex-wrap gap-3">
263280
<Link
@@ -282,12 +299,26 @@ export default function CandidatesPage() {
282299
</header>
283300
{CANDIDATES_FEATURED_POSITIONS.length > 0 ? (
284301
<>
285-
<ChallengeSectionTitle title="Round 4 Challenges" />
302+
<ChallengeSectionTitle title="Round 8 Challenges" />
286303
{CANDIDATES_FEATURED_POSITIONS.map((position) => (
287304
<PositionPill
288305
key={position.id}
289306
position={position}
290307
completed={completedChallengeIds.includes(position.id)}
308+
compactTitle={compactFeaturedTitles}
309+
/>
310+
))}
311+
</>
312+
) : null}
313+
{CANDIDATES_ROUND_FOUR_POSITIONS.length > 0 ? (
314+
<>
315+
<ChallengeSectionTitle title="Round 4 Challenges" />
316+
{CANDIDATES_ROUND_FOUR_POSITIONS.map((position) => (
317+
<PositionPill
318+
key={position.id}
319+
position={position}
320+
completed={completedChallengeIds.includes(position.id)}
321+
compactTitle={compactRoundFourTitles}
291322
/>
292323
))}
293324
</>
@@ -300,6 +331,7 @@ export default function CandidatesPage() {
300331
key={position.id}
301332
position={position}
302333
completed={completedChallengeIds.includes(position.id)}
334+
compactTitle={compactRoundThreeTitles}
303335
/>
304336
))}
305337
</>
@@ -312,6 +344,7 @@ export default function CandidatesPage() {
312344
key={position.id}
313345
position={position}
314346
completed={completedChallengeIds.includes(position.id)}
347+
compactTitle={compactRoundTwoTitles}
315348
/>
316349
))}
317350
</>
@@ -324,6 +357,7 @@ export default function CandidatesPage() {
324357
key={position.id}
325358
position={position}
326359
completed={completedChallengeIds.includes(position.id)}
360+
compactTitle={compactRoundOneTitles}
327361
/>
328362
))}
329363
</>

0 commit comments

Comments
 (0)