@@ -2,7 +2,6 @@ import { useState } from 'react'
22import { Chess } from 'chess.ts'
33import toast from 'react-hot-toast'
44import { ModalContainer } from '../Misc/ModalContainer'
5- import { CloseIcon } from '../Icons/icons'
65
76interface Props {
87 onSubmit : ( type : 'pgn' | 'fen' , data : string , name ?: string ) => void
@@ -45,109 +44,127 @@ export const CustomAnalysisModal: React.FC<Props> = ({ onSubmit, onClose }) => {
4544
4645 return (
4746 < ModalContainer dismiss = { onClose } >
48- < div className = "flex w-[700px] max-w-[90vw] flex-col gap-4" >
49- < div className = "relative flex items-center justify-center" >
50- < h2 className = "text-2xl font-bold" > Custom Analysis</ h2 >
47+ < div className = "flex h-[550px] w-[600px] max-w-[90vw] flex-col overflow-hidden rounded-lg bg-background-1" >
48+ { /* Header */ }
49+ < div className = "relative border-b border-white/10 p-4" >
50+ < div className = "text-center" >
51+ < h2 className = "text-xl font-bold text-primary" > Custom Analysis</ h2 >
52+ < p className = "text-xs text-secondary" >
53+ Import a chess game from PGN notation or analyze a specific
54+ position using FEN notation
55+ </ p >
56+ </ div >
5157 < button
52- className = "absolute right-0 cursor-pointer border-none bg-none opacity-50 transition duration-200 hover:opacity-100 "
58+ className = "absolute right-4 top-4 text-secondary transition-colors hover:text-primary "
5359 title = "Close"
5460 onClick = { onClose }
5561 >
56- { CloseIcon }
62+ < span className = "material-symbols-outlined" > close </ span >
5763 </ button >
5864 </ div >
5965
60- < p className = "text-sm text-secondary" >
61- Import a chess game from PGN notation or analyze a specific position
62- using FEN notation.
63- </ p >
66+ { /* Content */ }
67+ < div className = "flex-1 overflow-y-auto p-4" >
68+ < div className = "space-y-4" >
69+ { /* Mode selector */ }
70+ < div >
71+ < label
72+ htmlFor = "import-type-selector"
73+ className = "mb-1 block text-sm font-medium text-primary"
74+ >
75+ Import Type:
76+ </ label >
77+ < div id = "import-type-selector" className = "flex gap-2" >
78+ < button
79+ className = { `flex-1 rounded px-4 py-2 text-sm font-medium transition-colors ${
80+ mode === 'pgn'
81+ ? 'bg-human-4 text-white'
82+ : 'bg-background-2 text-primary hover:bg-background-3'
83+ } `}
84+ onClick = { ( ) => setMode ( 'pgn' ) }
85+ >
86+ PGN Game
87+ </ button >
88+ < button
89+ className = { `flex-1 rounded px-4 py-2 text-sm font-medium transition-colors ${
90+ mode === 'fen'
91+ ? 'bg-human-4 text-white'
92+ : 'bg-background-2 text-primary hover:bg-background-3'
93+ } `}
94+ onClick = { ( ) => setMode ( 'fen' ) }
95+ >
96+ FEN Position
97+ </ button >
98+ </ div >
99+ </ div >
64100
65- { /* Mode selector */ }
66- < div className = "flex gap-2" >
67- < button
68- className = { `rounded px-4 py-2 transition duration-200 ${
69- mode === 'pgn'
70- ? 'bg-human-4 text-white'
71- : 'bg-background-2 text-primary hover:bg-background-3'
72- } `}
73- onClick = { ( ) => setMode ( 'pgn' ) }
74- >
75- Import PGN Game
76- </ button >
77- < button
78- className = { `rounded px-4 py-2 transition duration-200 ${
79- mode === 'fen'
80- ? 'bg-human-4 text-white'
81- : 'bg-background-2 text-primary hover:bg-background-3'
82- } `}
83- onClick = { ( ) => setMode ( 'fen' ) }
84- >
85- Analyze Position (FEN)
86- </ button >
87- </ div >
88-
89- < div >
90- < label
91- htmlFor = "analysis-name"
92- className = "mb-1 block text-sm font-medium"
93- >
94- Name (optional):
95- </ label >
96- < input
97- id = "analysis-name"
98- type = "text"
99- className = "w-full rounded border border-background-3 bg-background-2 p-2 text-primary focus:border-human-4 focus:outline-none"
100- placeholder = "Enter a name for this analysis"
101- value = { name }
102- onChange = { ( e ) => setName ( e . target . value ) }
103- />
104- </ div >
101+ < div >
102+ < label
103+ htmlFor = "analysis-name"
104+ className = "mb-1 block text-sm font-medium text-primary"
105+ >
106+ Name (optional):
107+ </ label >
108+ < input
109+ id = "analysis-name"
110+ type = "text"
111+ className = "w-full rounded border border-background-3 bg-background-2 px-3 py-2 text-sm text-primary placeholder-secondary focus:border-human-4 focus:outline-none focus:ring-1 focus:ring-human-4"
112+ placeholder = "Enter a name for this analysis"
113+ value = { name }
114+ onChange = { ( e ) => setName ( e . target . value ) }
115+ />
116+ </ div >
105117
106- < div >
107- < label
108- htmlFor = "analysis-data"
109- className = "mb-1 block text-sm font-medium"
110- >
111- { mode === 'pgn' ? 'PGN Data:' : 'FEN Position:' }
112- </ label >
113- < textarea
114- id = "analysis-data"
115- className = "h-32 w-full rounded border border-background-3 bg-background-2 p- 2 font-mono text-sm text-primary focus:border-human-4 focus:outline-none"
116- placeholder = { mode === 'pgn' ? examplePGN : exampleFEN }
117- value = { input }
118- onChange = { ( e ) => setInput ( e . target . value ) }
119- />
120- < p className = "mt-1 text-xs text-secondary" >
121- { mode === 'pgn'
122- ? 'Paste your PGN game notation here. Headers and variations are supported.'
123- : 'Enter a valid FEN position string. This will set up the board for analysis.' }
124- </ p >
125- </ div >
118+ < div >
119+ < label
120+ htmlFor = "analysis-data"
121+ className = "mb-1 block text-sm font-medium text-primary "
122+ >
123+ { mode === 'pgn' ? 'PGN Data:' : 'FEN Position:' }
124+ </ label >
125+ < textarea
126+ id = "analysis-data"
127+ className = "h-32 w-full rounded border border-background-3 bg-background-2 px-3 py- 2 font-mono text-sm text-primary placeholder-secondary focus:border-human-4 focus:outline-none focus:ring-1 focus:ring-human-4 "
128+ placeholder = { mode === 'pgn' ? examplePGN : exampleFEN }
129+ value = { input }
130+ onChange = { ( e ) => setInput ( e . target . value ) }
131+ />
132+ < p className = "mt-1 text-xs text-secondary" >
133+ { mode === 'pgn'
134+ ? 'Paste your PGN game notation here. Headers and variations are supported.'
135+ : 'Enter a valid FEN position string. This will set up the board for analysis.' }
136+ </ p >
137+ </ div >
126138
127- < div className = "flex gap-2" >
128- < button
129- className = "rounded bg-background-2 px-3 py-1 text-xs text-secondary hover:bg-background-3"
130- onClick = { ( ) => setInput ( mode === 'pgn' ? examplePGN : exampleFEN ) }
131- >
132- Use Example
133- </ button >
134- < button
135- className = "rounded bg-background-2 px-3 py-1 text-xs text-secondary hover:bg-background-3"
136- onClick = { ( ) => setInput ( '' ) }
137- >
138- Clear
139- </ button >
139+ < div className = "flex gap-2" >
140+ < button
141+ className = "rounded bg-background-2 px-3 py-1 text-xs text-primary transition-colors hover:bg-background-3"
142+ onClick = { ( ) =>
143+ setInput ( mode === 'pgn' ? examplePGN : exampleFEN )
144+ }
145+ >
146+ Use Example
147+ </ button >
148+ < button
149+ className = "rounded bg-background-2 px-3 py-1 text-xs text-primary transition-colors hover:bg-background-3"
150+ onClick = { ( ) => setInput ( '' ) }
151+ >
152+ Clear
153+ </ button >
154+ </ div >
155+ </ div >
140156 </ div >
141157
142- < div className = "flex justify-end gap-2" >
158+ { /* Actions */ }
159+ < div className = "flex gap-3 border-t border-white/10 p-4" >
143160 < button
144- className = "rounded bg-background-2 px-4 py-2 text-primary transition duration-200 hover:bg-background-3"
161+ className = "flex-1 rounded bg-background-2 py-2 text-sm font-medium text- primary transition-colors hover:bg-background-3"
145162 onClick = { onClose }
146163 >
147164 Cancel
148165 </ button >
149166 < button
150- className = "hover:bg-human-5 rounded bg-human-4 px-4 py-2 text-white transition duration-200 "
167+ className = "flex-1 rounded bg-human-4 py-2 text-sm font-medium text- white transition-colors hover:bg-human-4/80 "
151168 onClick = { validateAndSubmit }
152169 >
153170 Analyze
0 commit comments