Skip to content

Commit eb7ebf5

Browse files
fix: make analysis components responsive
1 parent 766d7fb commit eb7ebf5

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

src/components/Analysis/Highlight.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,65 +118,65 @@ export const Highlight: React.FC<Props> = ({
118118
<div className="flex h-full w-full flex-col items-start gap-1 overflow-hidden md:flex-row md:gap-0 md:rounded md:border-[0.5px] md:border-white/40">
119119
<div className="flex h-full w-full flex-col border-white/40 bg-background-1 md:w-auto md:min-w-[40%] md:max-w-[40%] md:border-r-[0.5px]">
120120
<div className="grid grid-cols-2">
121-
<div className="flex flex-col items-center justify-center gap-1 bg-human-3/5 py-2 md:py-3">
122-
<p className="text-center text-xs text-human-2 md:text-sm">
121+
<div className="flex flex-col items-center justify-center gap-0.5 bg-human-3/5 py-1.5 xl:gap-1 xl:py-2 2xl:py-3">
122+
<p className="text-center text-[10px] text-human-2 xl:text-xs 2xl:text-sm">
123123
Maia {currentMaiaModel.slice(-4)}
124124
<br />
125125
White Win %
126126
</p>
127-
<p className="text-xl font-bold text-human-1 md:text-2xl">
127+
<p className="text-lg font-bold text-human-1 xl:text-xl 2xl:text-2xl">
128128
{moveEvaluation?.maia
129129
? `${Math.round(moveEvaluation.maia?.value * 1000) / 10}%`
130130
: '...'}
131131
</p>
132132
</div>
133-
<div className="flex flex-col items-center justify-center gap-1 bg-engine-3/5 py-2 md:py-3">
134-
<p className="text-center text-xs text-engine-2 md:text-sm">
133+
<div className="flex flex-col items-center justify-center gap-0.5 bg-engine-3/5 py-1.5 xl:py-2 2xl:gap-1 2xl:py-3">
134+
<p className="text-center text-[10px] text-engine-2 xl:text-xs 2xl:text-sm">
135135
SF Eval
136136
<br />
137137
{moveEvaluation?.stockfish?.depth
138138
? ` (Depth ${moveEvaluation.stockfish?.depth})`
139139
: ''}
140140
</p>
141-
<p className="text-xl font-bold text-engine-1 md:text-2xl">
141+
<p className="text-lg font-bold text-engine-1 xl:text-xl 2xl:text-2xl">
142142
{moveEvaluation?.stockfish
143143
? `${moveEvaluation.stockfish.model_optimal_cp > 0 ? '+' : ''}${moveEvaluation.stockfish.model_optimal_cp / 100}`
144144
: '...'}
145145
</p>
146146
</div>
147147
</div>
148148
<div className="grid grid-cols-2">
149-
<div className="grid grid-rows-2 items-center justify-center p-3">
149+
<div className="grid grid-rows-2 items-center justify-center p-1.5 xl:p-2 2xl:p-3">
150150
{recommendations.maia?.slice(0, 4).map(({ move, prob }, index) => {
151151
return (
152152
<button
153153
key={index}
154-
className="grid cursor-pointer grid-cols-2 gap-3 hover:underline"
154+
className="grid cursor-pointer grid-cols-2 gap-1.5 hover:underline xl:gap-2 2xl:gap-3"
155155
style={{
156156
color: colorSanMapping[move]?.color ?? '#fff',
157157
}}
158158
onMouseLeave={handleMouseLeave}
159159
onMouseEnter={(e) => handleMouseEnter(move, 'maia', e, prob)}
160160
onClick={() => makeMove(move)}
161161
>
162-
<p className="text-right font-mono text-xs md:text-sm">
162+
<p className="text-right font-mono text-[10px] xl:text-xs 2xl:text-sm">
163163
{(Math.round(prob * 1000) / 10).toFixed(1)}%
164164
</p>
165-
<p className="text-left font-mono text-xs md:text-sm">
165+
<p className="text-left font-mono text-[10px] xl:text-xs 2xl:text-sm">
166166
{colorSanMapping[move]?.san ?? move}
167167
</p>
168168
</button>
169169
)
170170
})}
171171
</div>
172-
<div className="grid grid-rows-2 flex-col items-center justify-center p-3">
172+
<div className="grid grid-rows-2 flex-col items-center justify-center p-1.5 xl:p-2 2xl:p-3">
173173
{recommendations.stockfish
174174
?.slice(0, 4)
175175
.map(({ move, cp, winrate, winrate_loss }, index) => {
176176
return (
177177
<button
178178
key={index}
179-
className="grid cursor-pointer grid-cols-2 gap-3 hover:underline"
179+
className="grid cursor-pointer grid-cols-2 gap-1.5 hover:underline xl:gap-2 2xl:gap-3"
180180
style={{
181181
color: colorSanMapping[move]?.color ?? '#fff',
182182
}}
@@ -194,19 +194,19 @@ export const Highlight: React.FC<Props> = ({
194194
}
195195
onClick={() => makeMove(move)}
196196
>
197-
<p className="w-[42px] text-right font-mono text-xs md:text-sm">
197+
<p className="w-[32px] text-right font-mono text-[10px] xl:w-[36px] xl:text-xs 2xl:w-[42px] 2xl:text-sm">
198198
{cp > 0 ? '+' : null}
199199
{`${(cp / 100).toFixed(2)}`}
200200
</p>
201-
<p className="text-left font-mono text-xs md:text-sm">
201+
<p className="text-left font-mono text-[10px] xl:text-xs 2xl:text-sm">
202202
{colorSanMapping[move]?.san ?? move}
203203
</p>
204204
</button>
205205
)
206206
})}
207207
</div>
208208
</div>
209-
<div className="flex flex-col items-start justify-start gap-1 bg-background-1/80 px-3 pb-3 text-sm md:py-1.5">
209+
<div className="flex flex-col items-start justify-start gap-0.5 bg-background-1/80 px-2 pb-2 text-sm xl:gap-1 xl:px-3 xl:pb-3 2xl:py-1.5">
210210
<AnimatePresence mode="wait">
211211
{boardDescription ? (
212212
<motion.div
@@ -217,7 +217,7 @@ export const Highlight: React.FC<Props> = ({
217217
transition={{ duration: 0.1 }}
218218
className="w-full"
219219
>
220-
<p className="w-full whitespace-normal break-words text-xs text-secondary">
220+
<p className="w-full whitespace-normal break-words text-[10px] leading-tight text-secondary xl:text-xs xl:leading-tight">
221221
{boardDescription}
222222
</p>
223223
</motion.div>

0 commit comments

Comments
 (0)