Skip to content

Commit 20b53a4

Browse files
Merge branch 'main' into codex/practice-modal-queue-wip
2 parents 44cab04 + f83e9c0 commit 20b53a4

8 files changed

Lines changed: 1627 additions & 302 deletions

File tree

src/api/play.ts

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import { buildUrl } from './utils'
22
import { Color, TimeControl } from 'src/types'
33

4+
const normalizeOpeningBookFen = (fen: string) => {
5+
const parts = fen.trim().split(/\s+/)
6+
if (parts.length >= 4) {
7+
return parts.slice(0, 4).join(' ')
8+
}
9+
return fen.trim()
10+
}
11+
412
export const startGame = async (
513
playerColor: Color,
614
maiaVersion: string,
@@ -107,27 +115,36 @@ export const fetchGameMove = async (
107115
}
108116

109117
export const fetchOpeningBookMoves = async (fen: string) => {
110-
const res = await fetch(buildUrl(`play/get_book_moves?fen=${fen}`), {
111-
method: 'POST',
112-
headers: {
113-
Accept: 'application/json',
114-
'Content-Type': 'application/json',
118+
const normalizedFen = normalizeOpeningBookFen(fen)
119+
const res = await fetch(
120+
buildUrl(
121+
'play/get_book_moves?' +
122+
new URLSearchParams({
123+
fen: normalizedFen,
124+
}),
125+
),
126+
{
127+
method: 'POST',
128+
headers: {
129+
Accept: 'application/json',
130+
'Content-Type': 'application/json',
131+
},
132+
body: JSON.stringify({
133+
moves: [],
134+
maia_names: [
135+
'maia_kdd_1100',
136+
'maia_kdd_1200',
137+
'maia_kdd_1300',
138+
'maia_kdd_1400',
139+
'maia_kdd_1500',
140+
'maia_kdd_1600',
141+
'maia_kdd_1700',
142+
'maia_kdd_1800',
143+
'maia_kdd_1900',
144+
],
145+
}),
115146
},
116-
body: JSON.stringify({
117-
moves: [],
118-
maia_names: [
119-
'maia_kdd_1100',
120-
'maia_kdd_1200',
121-
'maia_kdd_1300',
122-
'maia_kdd_1400',
123-
'maia_kdd_1500',
124-
'maia_kdd_1600',
125-
'maia_kdd_1700',
126-
'maia_kdd_1800',
127-
'maia_kdd_1900',
128-
],
129-
}),
130-
})
147+
)
131148

132149
return res.json()
133150
}

src/components/Common/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export const Header: React.FC = () => {
212212
href="/openings"
213213
className={`px-2 py-1 transition-all duration-200 hover:!text-primary ${router.pathname.startsWith('/openings') ? '!text-primary' : '!text-primary/80'}`}
214214
>
215-
OPENINGS
215+
PRACTICE
216216
</Link>
217217
<Link
218218
href="/turing"
@@ -392,7 +392,7 @@ export const Header: React.FC = () => {
392392
Puzzles
393393
</Link>
394394
<Link href="/openings" className="uppercase">
395-
Openings
395+
Practice
396396
</Link>
397397
<Link href="/turing" className="uppercase">
398398
Bot-or-not

src/components/Home/HomeHero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export const HomeHero: React.FC<Props> = ({ scrollHandler }: Props) => {
229229
/>
230230
<FeatureCard
231231
icon="play_lesson"
232-
title="Openings"
232+
title="Practice"
233233
description="Learn and practice chess openings with Maia"
234234
href="/openings"
235235
index={4}

src/components/Home/Sections/AdditionalFeaturesSection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ export const AdditionalFeaturesSection = ({
135135
const features: Feature[] = [
136136
{
137137
icon: <StarIcon />,
138-
title: 'Openings Practice',
138+
title: 'Practice',
139139
description:
140140
"Drill chess openings against Maia models calibrated to specific rating levels, allowing you to practice against opponents similar to those you'll face.",
141-
action: { type: 'link', href: '/openings', label: 'Practice Openings' },
141+
action: { type: 'link', href: '/openings', label: 'Practice' },
142142
iconBgColor: 'bg-human-3/10',
143143
iconTextColor: 'text-human-3',
144144
},

src/components/Openings/OpeningDrillSidebar.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ interface Props {
1616
analysisEnabled?: boolean
1717
continueAnalyzingMode?: boolean
1818
drillTerminationNote?: string
19+
showBottomNavigation?: boolean
1920
}
2021

2122
export const OpeningDrillSidebar: React.FC<Props> = ({
@@ -28,6 +29,7 @@ export const OpeningDrillSidebar: React.FC<Props> = ({
2829
analysisEnabled,
2930
continueAnalyzingMode,
3031
drillTerminationNote,
32+
showBottomNavigation = true,
3133
}) => {
3234
const containerClass = embedded
3335
? 'flex h-full w-full max-w-full flex-col'
@@ -304,7 +306,7 @@ export const OpeningDrillSidebar: React.FC<Props> = ({
304306
</div>
305307

306308
{/* Bottom: Moves + Controller (embedded) */}
307-
{tree?.gameTree && currentDrill && (
309+
{showBottomNavigation && tree?.gameTree && currentDrill && (
308310
<div className="flex w-full flex-1 flex-col overflow-hidden border-t border-glass-border">
309311
<div className="red-scrollbar flex w-full flex-1 flex-col overflow-y-auto overflow-x-hidden">
310312
<MovesContainer

src/components/Openings/OpeningSelectionModal.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ const BrowsePanel: React.FC<{
434434
const searchPlaceholder = `Search ${categoryLabelPlural.toLowerCase()}...`
435435

436436
const renderTabs = () => (
437-
<div className="grid w-full select-none grid-cols-3 items-center justify-between border-b border-glass-border bg-white/[0.02]">
437+
<div className="grid w-full select-none grid-cols-3 items-center justify-between border-b border-glass-border bg-white/[0.04]">
438438
{[
439439
{ label: 'Openings', value: 'openings' as const },
440440
{ label: 'Endgames', value: 'endgames' as const },
@@ -2548,13 +2548,13 @@ export const OpeningSelectionModal: React.FC<Props> = ({
25482548
initial={{ opacity: 0 }}
25492549
animate={{ opacity: 1 }}
25502550
exit={{ opacity: 0 }}
2551-
className="relative flex h-[90vh] max-h-[900px] w-[98vw] max-w-[1320px] flex-col items-start justify-start overflow-hidden rounded-xl border border-glass-border bg-[#231d1a] backdrop-blur-md md:h-[90vh]"
2551+
className="relative flex h-[90vh] max-h-[900px] w-[98vw] max-w-[1320px] flex-col items-start justify-start overflow-hidden rounded-xl border border-glass-border bg-[#171513] shadow-[0_30px_90px_rgba(0,0,0,0.5)] backdrop-blur-md md:h-[90vh]"
25522552
>
25532553
<div
25542554
className="pointer-events-none absolute inset-0"
25552555
style={{
25562556
background:
2557-
'linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.00) 20%), radial-gradient(ellipse 180% 160% at 0% 100%, rgba(239, 68, 68, 0.08) 0%, transparent 72%)',
2557+
'linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01) 22%, rgba(255,255,255,0) 38%), radial-gradient(ellipse 140% 120% at 50% -10%, rgba(255,255,255,0.06) 0%, transparent 48%), radial-gradient(ellipse 180% 160% at 0% 100%, rgba(127, 29, 29, 0.09) 0%, transparent 70%)',
25582558
}}
25592559
/>
25602560
<button
@@ -2571,7 +2571,7 @@ export const OpeningSelectionModal: React.FC<Props> = ({
25712571
>
25722572
<div>
25732573
<h1 className="text-[19px] font-semibold text-primary">
2574-
Maia Drill Studio
2574+
Practice with Maia
25752575
</h1>
25762576
<p className="mt-0.5 text-[13px] text-secondary">
25772577
Select drills, configure settings, practice against Maia 3.

0 commit comments

Comments
 (0)