diff --git a/src/api/opening/opening.ts b/src/api/opening/opening.ts index 8ac24884..d817bec0 100644 --- a/src/api/opening/opening.ts +++ b/src/api/opening/opening.ts @@ -1,59 +1,20 @@ import { buildUrl } from '../utils' // API Types for opening drill logging -export interface OpeningDrillSelection { + +export interface LogOpeningDrillRequest { opening_fen: string side_played: string -} - -export interface SelectOpeningDrillsRequest { - openings: OpeningDrillSelection[] opponent: string num_moves: number - num_drills: number -} - -export interface SelectOpeningDrillsResponse { - session_id: string -} - -export interface SubmitOpeningDrillRequest { - session_id: string - opening_fen: string - side_played: string moves_played_uci: string[] } -// API function to log opening drill selections and start a session -export const selectOpeningDrills = async ( - request: SelectOpeningDrillsRequest, -): Promise => { - const res = await fetch(buildUrl('opening/select_opening_drills'), { - method: 'POST', - headers: { - Accept: 'application/json', - 'Content-Type': 'application/json', - }, - body: JSON.stringify(request), - }) - - if (res.status === 401) { - throw new Error('Unauthorized') - } - - if (!res.ok) { - throw new Error(`Failed to select opening drills: ${res.statusText}`) - } - - const data = await res.json() - return data as SelectOpeningDrillsResponse -} - -// API function to submit a completed opening drill -export const submitOpeningDrill = async ( - request: SubmitOpeningDrillRequest, +// API function to log a completed opening drill +export const logOpeningDrill = async ( + request: LogOpeningDrillRequest, ): Promise => { - const res = await fetch(buildUrl('opening/record_opening_drill'), { + const res = await fetch(buildUrl('opening/log_opening_drill'), { method: 'POST', headers: { Accept: 'application/json', @@ -67,6 +28,6 @@ export const submitOpeningDrill = async ( } if (!res.ok) { - throw new Error(`Failed to submit opening drill: ${res.statusText}`) + throw new Error(`Failed to log opening drill: ${res.statusText}`) } } diff --git a/src/components/Analysis/MoveMap.tsx b/src/components/Analysis/MoveMap.tsx index 27b23b83..70ed1ab9 100644 --- a/src/components/Analysis/MoveMap.tsx +++ b/src/components/Analysis/MoveMap.tsx @@ -330,7 +330,7 @@ export const MoveMap: React.FC = ({ tickMargin={0} tickLine={false} tickFormatter={(value) => `${value}%`} - domain={([dataMin, dataMax]) => [0, dataMax > 60 ? 100 : 60]} + domain={([dataMin, dataMax]) => [0, dataMax > 40 ? 100 : 40]} >