fix: Resolve build errors after merging feature branches

- Fix TypeScript errors in analysis page with non-null assertions
- Fix Chessboard component API usage to use options prop
- Fix Analyze Game button placement to be always visible
This commit is contained in:
Stefan
2025-11-27 09:52:36 +01:00
parent 95692ce8f8
commit af2ea1c39e
2 changed files with 27 additions and 21 deletions
+13 -8
View File
@@ -212,9 +212,9 @@ export default function AnalysisPage() {
try { try {
const model = getGenAIModel(apiKey, "gemini-2.5-flash"); const model = getGenAIModel(apiKey, "gemini-2.5-flash");
const delta = details.cpLoss ?? 0; const delta = details.cpLoss ?? 0;
const evalBefore = details.evalBefore.score / 100; const evalBefore = details.evalBefore!.score / 100;
const evalAfter = details.evalAfter.score / 100; const evalAfter = details.evalAfter!.score / 100;
const mateInfo = details.evalAfter.mate !== null ? `Mate in ${details.evalAfter.mate}` : "No mate detected"; const mateInfo = details.evalAfter!.mate !== null ? `Mate in ${details.evalAfter!.mate}` : "No mate detected";
const tactics = (details.missedTactics || []) const tactics = (details.missedTactics || [])
.filter(t => t.tactic_type !== "none") .filter(t => t.tactic_type !== "none")
.map(t => `${t.tactic_type}${t.material_delta ? ` (~${(t.material_delta / 100).toFixed(1)} pawns)` : ""}`) .map(t => `${t.tactic_type}${t.material_delta ? ` (~${(t.material_delta / 100).toFixed(1)} pawns)` : ""}`)
@@ -231,7 +231,7 @@ DATA:
- Move played (SAN): ${step.san} - Move played (SAN): ${step.san}
- Evaluation before move: ${evalBefore.toFixed(2)} pawns - Evaluation before move: ${evalBefore.toFixed(2)} pawns
- Evaluation after move: ${evalAfter.toFixed(2)} pawns - Evaluation after move: ${evalAfter.toFixed(2)} pawns
- Best move suggestion: ${details.bestMoveSan ?? details.evalBefore.bestMove} - Best move suggestion: ${details.bestMoveSan ?? details.evalBefore!.bestMove}
- Evaluation shift (centipawns): ${delta} - Evaluation shift (centipawns): ${delta}
- Opening context: ${openingInfo ? `${openingInfo.name} (${openingInfo.eco})` : "Unknown"} - Opening context: ${openingInfo ? `${openingInfo.name} (${openingInfo.eco})` : "Unknown"}
- Missed tactics: ${tactics} - Missed tactics: ${tactics}
@@ -342,10 +342,15 @@ INSTRUCTIONS:
<div className="bg-gray-50 dark:bg-gray-900 rounded-xl p-4 flex flex-col items-center gap-3 border border-gray-200 dark:border-gray-700"> <div className="bg-gray-50 dark:bg-gray-900 rounded-xl p-4 flex flex-col items-center gap-3 border border-gray-200 dark:border-gray-700">
<Chessboard <Chessboard
position={currentFen} options={{
boardOrientation={orientation} position: currentFen,
arePiecesDraggable={false} boardOrientation: orientation,
customBoardStyle={{ borderRadius: "12px", boxShadow: "0 8px 30px rgba(0,0,0,0.12)" }} allowDragging: false,
darkSquareStyle: { backgroundColor: '#779954' },
lightSquareStyle: { backgroundColor: '#e9edcc' },
animationDurationInMs: 200,
boardStyle: { borderRadius: "12px", boxShadow: "0 8px 30px rgba(0,0,0,0.12)" }
}}
/> />
<div className="flex items-center gap-4"> <div className="flex items-center gap-4">
<button <button
+14 -13
View File
@@ -319,20 +319,21 @@ export default function StartScreen({ onStartGame, onResumeGame, savedGames, onD
</button> </button>
)} )}
</div> </div>
<div className="border-t border-gray-200 dark:border-gray-700 pt-6">
<p className="text-sm font-bold text-gray-700 dark:text-gray-300 mb-3 uppercase tracking-wide">
{t.start.analyzeGame}
</p>
<button
onClick={() => router.push("/analysis")}
className="w-full py-4 px-4 bg-purple-600 text-white rounded-xl hover:bg-purple-700 font-semibold shadow-lg transition-transform transform hover:scale-[1.02] flex items-center justify-center gap-2"
>
<Brain size={18} />
{t.start.analyzeGame}
</button>
</div>
)} )}
{/* Analysis Mode - Always Visible */}
<div className="border-t border-gray-200 dark:border-gray-700 pt-6">
<p className="text-sm font-bold text-gray-700 dark:text-gray-300 mb-3 uppercase tracking-wide">
{t.start.analyzeGame}
</p>
<button
onClick={() => router.push("/analysis")}
className="w-full py-4 px-4 bg-purple-600 text-white rounded-xl hover:bg-purple-700 font-semibold shadow-lg transition-transform transform hover:scale-[1.02] flex items-center justify-center gap-2"
>
<Brain size={18} />
{t.start.analyzeGame}
</button>
</div>
</div> </div>
</div> </div>
</div> </div>