Fix homepage layout and add Polish language support

- Reorganize StartScreen: Start New Game button always visible at top
- Move unfinished games section below the start button
- Remove '2.' prefix from startGame translations (all languages)
- Update startNewGame translations to be button-appropriate
- Fix TypeScript errors: Update GameImportModal, GameAnalysisModal, and GameOverModal to use SupportedLanguage type instead of hardcoded language union
- Delete local branches: codex/add-polish-as-ui-language and codex/add-option-to-continue-game-from-position
This commit is contained in:
Stefan
2025-12-01 11:49:12 +01:00
parent 13210c61ee
commit 6acc7ecc1c
5 changed files with 37 additions and 34 deletions
+2 -1
View File
@@ -5,12 +5,13 @@ import { Stockfish, StockfishEvaluation } from "@/lib/stockfish";
import { OpeningMetadata, lookupOpening } from "@/lib/openings";
import { getGenAIModel } from "@/lib/gemini";
import { Loader2, X, Brain, Trophy, AlertTriangle } from "lucide-react";
import { SupportedLanguage } from "@/lib/i18n/translations";
interface GameAnalysisModalProps {
fen: string;
stockfish: Stockfish | null;
apiKey: string | null;
language: 'en' | 'de' | 'fr' | 'it';
language: SupportedLanguage;
onClose: () => void;
}
+2 -1
View File
@@ -4,11 +4,12 @@ import { useState, useEffect } from "react";
import { Chessboard } from "react-chessboard";
import { X, Loader2, Download, ExternalLink } from "lucide-react";
import { fetchChessComGames, fetchLichessGames, GameMetadata, Platform } from "@/lib/gameImport";
import { SupportedLanguage } from "@/lib/i18n/translations";
interface GameImportModalProps {
onClose: () => void;
onSelectGame: (pgn: string) => void;
language: 'en' | 'de' | 'fr' | 'it';
language: SupportedLanguage;
}
export function GameImportModal({ onClose, onSelectGame, language }: GameImportModalProps) {
+2 -1
View File
@@ -6,6 +6,7 @@ import { Loader2, X, Trophy, AlertTriangle, RefreshCw } from "lucide-react";
import { StockfishEvaluation } from "@/lib/stockfish";
import { DetectedTactic } from "@/lib/tacticDetection";
import ReactMarkdown from "react-markdown";
import { SupportedLanguage } from "@/lib/i18n/translations";
export interface MoveHistoryItem {
moveNumber: number;
@@ -50,7 +51,7 @@ interface GameOverModalProps {
winner: "White" | "Black" | "Draw";
history: MoveHistoryItem[];
apiKey: string | null;
language: 'en' | 'de' | 'fr' | 'it';
language: SupportedLanguage;
onClose: () => void;
onNewGame: () => void;
}
+21 -21
View File
@@ -85,11 +85,7 @@ export default function StartScreen({ onStartGame, onResumeGame, savedGames, onD
return t.start.noEvaluation;
};
useEffect(() => {
if (!hasSavedGames) {
setShowNewGameOptions(true);
}
}, [hasSavedGames]);
if (!mounted) return null;
@@ -118,18 +114,24 @@ export default function StartScreen({ onStartGame, onResumeGame, savedGames, onD
</h2>
<div className="space-y-6">
{hasSavedGames && (
{/* Start New Game Button - Always visible at top */}
<div>
<button
onClick={() => setShowNewGameOptions(!showNewGameOptions)}
className="w-full py-4 px-4 bg-blue-600 text-white rounded-xl hover:bg-blue-700 font-semibold shadow-lg transition-transform transform hover:scale-[1.02] flex items-center justify-center gap-2"
>
<Brain size={18} />
{t.start.startNewGame}
</button>
</div>
{/* Unfinished Games Section */}
{hasSavedGames && !showNewGameOptions && (
<div className="space-y-4">
<div className="flex items-center justify-between">
<h3 className="text-lg font-semibold text-gray-900 dark:text-white">
{t.start.savedGamesTitle}
</h3>
<button
onClick={() => setShowNewGameOptions(true)}
className="text-sm text-blue-600 dark:text-blue-400 hover:underline"
>
{t.start.startNewGame}
</button>
</div>
{sortedSavedGames.length === 0 && (
@@ -210,7 +212,7 @@ export default function StartScreen({ onStartGame, onResumeGame, savedGames, onD
)}
{/* New Game Options */}
{(!hasSavedGames || showNewGameOptions) && (
{showNewGameOptions && (
<div className="space-y-8 animate-in fade-in slide-in-from-top-4 duration-300">
{/* Color Selection */}
<div>
@@ -326,14 +328,12 @@ export default function StartScreen({ onStartGame, onResumeGame, savedGames, onD
)}
</div>
{hasSavedGames && (
<button
onClick={() => setShowNewGameOptions(false)}
className="w-full py-3 text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"
>
{t.common.cancel}
</button>
)}
<button
onClick={() => setShowNewGameOptions(false)}
className="w-full py-3 text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors"
>
{t.common.cancel}
</button>
</div>
)}