import React, { useState, useEffect, useMemo } from 'react';
import { motion, AnimatePresence } from 'framer-motion';
import { BookOpen, Trophy, X, Check, AlertCircle, ArrowRight, CornerRightDown, RefreshCw, Loader2, Search } from 'lucide-react'; // Added Loader2, Search
// --- Brand Colors (Updated) ---
const colors = {
navy: '#2C3E50',
gold: '#F1C40F',
bgLight: '#f9fafb', // УБРАН БЕЖЕВЫЙ. Заменен на оч. светлый серый (bg-gray-50)
white: '#FFFFFF',
text: '#2C3E50', // По умолчанию Navy
textLight: '#475569', // slate-600
redError: '#FF4D4D',
greenSuccess: '#22c55e',
// Старые цвета (olive, teal) больше не используются по умолчанию
olive: '#A9B388',
teal: '#569898',
};
// --- Helper Function to Highlight Endings ---
// ... (rest of the helper function)
// ... (rest of casesData)
// ... (rest of allPracticeQuestions)
// ... (rest of shuffleArray function)
const Highlight = ({ base, ending }) => (
{base}
{ending && (
{ending}
)}
);
const casesData = {
nominative: {
name: 'Nominative',
russian: 'Именительный',
question: 'Who? What?',
russianQuestion: 'Кто? Что?',
description: 'The basic form, used for the subject of the sentence.',
prepositions: '---',
endings: {
singular: { masculine: '(-/cons.)', feminine: '-а / -я', neuter: '-о / -е' },
plural: { masculine: '-ы / -и', feminine: '-ы / -и', neuter: '-а / -я' }
},
examples: {
masculine: { singular: { base: 'студент', ending: '' }, plural: { base: 'студент', ending: 'ы' } },
feminine: { singular: { base: 'книг', ending: 'а' }, plural: { base: 'книг', ending: 'и' } },
neuter: { singular: { base: 'окн', ending: 'о' }, plural: { base: 'окн', ending: 'а' } }
}
},
genitive: {
name: 'Genitive',
russian: 'Родительный',
question: 'Of whom? Of what? Whose?',
russianQuestion: 'Кого? Чего?',
description: 'Indicates possession, absence ("нет"), quantity (e.g., "много"), or origin.',
prepositions: 'у, до, из, с, от, без, для, около, вокруг, после',
endings: {
singular: { masculine: '-а / -я', feminine: '-ы / -и', neuter: '-а / -я' },
plural: { masculine: '-ов / -ев', feminine: '- / -ей', neuter: '- / -ов' }
},
examples: {
masculine: { singular: { base: 'студент', ending: 'а' }, plural: { base: 'студент', ending: 'ов' } },
feminine: { singular: { base: 'книг', ending: 'и' }, plural: { base: 'книг', ending: '' } },
neuter: { singular: { base: 'окн', ending: 'а' }, plural: { base: 'окон', ending: '' } }
}
},
dative: {
name: 'Dative',
russian: 'Дательный',
question: 'To whom? To what?',
russianQuestion: 'Кому? Чему?',
description: 'Indicates the indirect object (recipient), age, or necessity (e.g., "мне нужно").',
prepositions: 'к, по',
endings: {
singular: { masculine: '-у / -ю', feminine: '-е / -и', neuter: '-у / -ю' },
plural: { masculine: '-ам / -ям', feminine: '-ам / -ям', neuter: '-ам / -ям' }
},
examples: {
masculine: { singular: { base: 'студент', ending: 'у' }, plural: { base: 'студент', ending: 'ам' } },
feminine: { singular: { base: 'книг', ending: 'е' }, plural: { base: 'книг', ending: 'ам' } },
neuter: { singular: { base: 'окн', ending: 'у' }, plural: { base: 'окн', ending: 'ам' } }
}
},
accusative: {
name: 'Accusative',
russian: 'Винительный',
question: 'Whom? What?',
russianQuestion: 'Кого? Что?',
description: 'Indicates the direct object of an action or movement towards a place.',
prepositions: 'в, на, за, под, через, про',
endings: {
singular: { masculine: '(Nom/Gen)', feminine: '-у / -ю', neuter: '-о / -е' },
plural: { masculine: '(Nom/Gen)', feminine: '-ы / -и', neuter: '-а / -я' }
},
examples: {
masculine: { singular: { base: 'студент', ending: 'а' }, plural: { base: 'студент', ending: 'ов' } },
feminine: { singular: { base: 'книг', ending: 'у' }, plural: { base: 'книг', ending: 'и' } },
neuter: { singular: { base: 'окн', ending: 'о' }, plural: { base: 'окн', ending: 'а' } }
},
note: 'Masculine & Plural forms depend on animacy (Animate = Genitive, Inanimate = Nominative).'
},
instrumental: {
name: 'Instrumental',
russian: 'Творительный',
question: 'With whom? With what?',
russianQuestion: 'Кем? Чем?',
description: 'Indicates the instrument used to perform an action, or company ("с кем").',
prepositions: 'с, за, под, над, между',
endings: {
singular: { masculine: '-ом / -ем', feminine: '-ой / -ей', neuter: '-ом / -ем' },
plural: { masculine: '-ами / -ями', feminine: '-ами / -ями', neuter: '-ами / -ями' }
},
examples: {
masculine: { singular: { base: 'студент', ending: 'ом' }, plural: { base: 'студент', ending: 'ами' } },
feminine: { singular: { base: 'книг', ending: 'ой' }, plural: { base: 'книг', ending: 'ами' } },
neuter: { singular: { base: 'окн', ending: 'ом' }, plural: { base: 'окн', ending: 'ами' } }
}
},
prepositional: {
name: 'Prepositional',
russian: 'Предложный',
question: 'About whom? About what? Where?',
russianQuestion: 'О ком? О чём? Где?',
description: 'Used ONLY with prepositions to indicate location or the object of thought/speech.',
prepositions: 'о(б), в, на, при',
endings: {
singular: { masculine: '-е / -и', feminine: '-е / -и', neuter: '-е / -и' },
plural: { masculine: '-ах / -ях', feminine: '-ах / -ях', neuter: '-ах / -ях' }
},
examples: {
masculine: { singular: { base: 'студент', ending: 'е' }, plural: { base: 'студент', ending: 'ах' } },
feminine: { singular: { base: 'книг', ending: 'е' }, plural: { base: 'книг', ending: 'ах' } },
neuter: { singular: { base: 'окн', ending: 'е' }, plural: { base: 'окн', ending: 'ах' } }
}
}
};
const allPracticeQuestions = [
// Existing
{ baseWord: 'студент', case: 'genitive', correctAnswer: { base: 'студент', ending: 'а' }, options: [{ base: 'студент', ending: '' }, { base: 'студент', ending: 'а' }, { base: 'студент', ending: 'у' }, { base: 'студент', ending: 'ом' }] },
{ baseWord: 'книга', case: 'dative', correctAnswer: { base: 'книг', ending: 'е' }, options: [{ base: 'книг', ending: 'а' }, { base: 'книг', ending: 'и' }, { base: 'книг', ending: 'е' }, { base: 'книг', ending: 'у' }] },
{ baseWord: 'окно', case: 'instrumental', correctAnswer: { base: 'окн', ending: 'ом' }, options: [{ base: 'окн', ending: 'о' }, { base: 'окн', ending: 'а' }, { base: 'окн', ending: 'у' }, { base: 'окн', ending: 'ом' }] },
{ baseWord: 'учитель', case: 'accusative', correctAnswer: { base: 'учител', ending: 'я' }, options: [{ base: 'учитель', ending: '' }, { base: 'учител', ending: 'я' }, { base: 'учител', ending: 'ю' }, { base: 'учител', ending: 'ем' }] },
{ baseWord: 'мама', case: 'prepositional', correctAnswer: { base: 'мам', ending: 'е' }, options: [{ base: 'мам', ending: 'а' }, { base: 'мам', ending: 'ы' }, { base: 'мам', ending: 'е' }, { base: 'мам', ending: 'ой' }] },
{ baseWord: 'море', case: 'genitive', correctAnswer: { base: 'мор', ending: 'я' }, options: [{ base: 'мор', ending: 'е' }, { base: 'мор', ending: 'я' }, { base: 'мор', ending: 'ю' }, { base: 'мор', ending: 'ем' }] },
{ baseWord: 'стол', case: 'prepositional', correctAnswer: { base: 'стол', ending: 'е' }, options: [{ base: 'стол', ending: '' }, { base: 'стол', ending: 'а' }, { base: 'стол', ending: 'у' }, { base: 'стол', ending: 'е' }] },
{ baseWord: 'ручка', case: 'instrumental', correctAnswer: { base: 'ручк', ending: 'ой' }, options: [{ base: 'ручк', ending: 'а' }, { base: 'ручк', ending: 'и' }, { base: 'ручк', ending: 'у' }, { base: 'ручк', ending: 'ой' }] },
{ baseWord: 'брат', case: 'dative', correctAnswer: { base: 'брат', ending: 'у' }, options: [{ base: 'брат', ending: '' }, { base: 'брат', ending: 'а' }, { base: 'брат', ending: 'у' }, { base: 'брат', ending: 'ом' }] },
{ baseWord: 'Россия', case: 'genitive', correctAnswer: { base: 'Росси', ending: 'и' }, options: [{ base: 'Росси', ending: 'я' }, { base: 'Росси', ending: 'и' }, { base: 'Росси', ending: 'ю' }, { base: 'Росси', ending: 'ей' }] },
{ baseWord: 'парк', case: 'prepositional', correctAnswer: { base: 'парк', ending: 'е' }, options: [{ base: 'парк', ending: '' }, { base: 'парк', ending: 'а' }, { base: 'парк', ending: 'у' }, { base: 'парк', ending: 'е' }] },
{ baseWord: 'песня', case: 'accusative', correctAnswer: { base: 'песн', ending: 'ю' }, options: [{ base: 'песн', ending: 'я' }, { base: 'песн', ending: 'и' }, { base: 'песн', ending: 'е' }, { base: 'песн', ending: 'ю' }] },
{ baseWord: 'здание', case: 'instrumental', correctAnswer: { base: 'здани', ending: 'ем' }, options: [{ base: 'здани', ending: 'е' }, { base: 'здани', ending: 'я' }, { base: 'здани', ending: 'ю' }, { base: 'здани', ending: 'ем' }] },
{ baseWord: 'друзья', case: 'genitive', correctAnswer: { base: 'друз', ending: 'ей' }, options: [{ base: 'друзь', ending: 'я' }, { base: 'друз', ending: 'ей' }, { base: 'друзь', ending: 'ям' }, { base: 'друзь', ending: 'ями' }] },
{ baseWord: 'девушка', case: 'dative', correctAnswer: { base: 'девушк', ending: 'е' }, options: [{ base: 'девушк', ending: 'а' }, { base: 'девушк', ending: 'и' }, { base: 'девушк', ending: 'е' }, { base: 'девушк', ending: 'у' }] },
{ baseWord: 'дом', case: 'genitive', correctAnswer: { base: 'дом', ending: 'а' }, options: [{ base: 'дом', ending: '' }, { base: 'дом', ending: 'а' }, { base: 'дом', ending: 'у' }, { base: 'дом', ending: 'ом' }] },
{ baseWord: 'вода', case: 'accusative', correctAnswer: { base: 'вод', ending: 'у' }, options: [{ base: 'вод', ending: 'а' }, { base: 'вод', ending: 'ы' }, { base: 'вод', ending: 'е' }, { base: 'вод', ending: 'у' }] },
{ baseWord: 'слово', case: 'prepositional', correctAnswer: { base: 'слов', ending: 'е' }, options: [{ base: 'слов', ending: 'о' }, { base: 'слов', ending: 'а' }, { base: 'слов', ending: 'у' }, { base: 'слов', ending: 'е' }] },
{ baseWord: 'отец', case: 'instrumental', correctAnswer: { base: 'отц', ending: 'ом' }, options: [{ base: 'отец', ending: '' }, { base: 'отц', ending: 'а' }, { base: 'отц', ending: 'у' }, { base: 'отц', ending: 'ом' }] },
{ baseWord: 'ночь', case: 'genitive', correctAnswer: { base: 'ноч', ending: 'и' }, options: [{ base: 'ночь', ending: '' }, { base: 'ноч', ending: 'и' }, { base: 'ноч', ending: 'е' }, { base: 'ночь', ending: 'ю' }] },
// Added 10 more
{ baseWord: 'машина', case: 'genitive', correctAnswer: { base: 'машин', ending: 'ы' }, options: [{ base: 'машин', ending: 'а' }, { base: 'машин', ending: 'ы' }, { base: 'машин', ending: 'е' }, { base: 'машин', ending: 'ой' }] },
{ baseWord: 'улица', case: 'dative', correctAnswer: { base: 'улиц', ending: 'е' }, options: [{ base: 'улиц', ending: 'а' }, { base: 'улиц', ending: 'ы' }, { base: 'улиц', ending: 'е' }, { base: 'улиц', ending: 'у' }] },
{ baseWord: 'письмо', case: 'accusative', correctAnswer: { base: 'письм', ending: 'о' }, options: [{ base: 'письм', ending: 'о' }, { base: 'письм', ending: 'а' }, { base: 'письм', ending: 'у' }, { base: 'письм', ending: 'ом' }] },
{ baseWord: 'американец', case: 'instrumental', correctAnswer: { base: 'американц', ending: 'ем' }, options: [{ base: 'американец', ending: '' }, { base: 'американц', ending: 'а' }, { base: 'американц', ending: 'у' }, { base: 'американц', ending: 'ем' }] },
{ baseWord: 'компьютер', case: 'prepositional', correctAnswer: { base: 'компьютер', ending: 'е' }, options: [{ base: 'компьютер', ending: '' }, { base: 'компьютер', ending: 'а' }, { base: 'компьютер', ending: 'ом' }, { base: 'компьютер', ending: 'е' }] },
{ baseWord: 'день', case: 'genitive', correctAnswer: { base: 'дн', ending: 'я' }, options: [{ base: 'день', ending: '' }, { base: 'дн', ending: 'я' }, { base: 'дн', ending: 'ю' }, { base: 'дн', ending: 'ём' }] },
{ baseWord: 'сестра', case: 'dative', correctAnswer: { base: 'сестр', ending: 'е' }, options: [{ base: 'сестр', ending: 'а' }, { base: 'сестр', ending: 'ы' }, { base: 'сестр', ending: 'е' }, { base: 'сестр', ending: 'ой' }] },
{ baseWord: 'кофе', case: 'accusative', correctAnswer: { base: 'кофе', ending: '' }, options: [{ base: 'кофе', ending: '' }, { base: 'коф', ending: 'я' }, { base: 'коф', ending: 'ю' }, { base: 'коф', ending: 'ем' }] }, // Stays the same
{ baseWord: 'чай', case: 'genitive', correctAnswer: { base: 'ча', ending: 'я' }, options: [{ base: 'чай', ending: '' }, { base: 'ча', ending: 'я' }, { base: 'ча', ending: 'ю' }, { base: 'ча', ending: 'ем' }] },
{ baseWord: 'неделя', case: 'prepositional', correctAnswer: { base: 'недел', ending: 'е' }, options: [{ base: 'недел', ending: 'я' }, { base: 'недел', ending: 'и' }, { base: 'недел', ending: 'е' }, { base: 'недел', ending: 'ей' }] },
];
// --- Utility function to shuffle an array ---
function shuffleArray(array) {
let newArray = [...array];
for (let i = newArray.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[newArray[i], newArray[j]] = [newArray[j], newArray[i]];
}
return newArray;
}
// --- NEW Component: Word Decliner ---
const WordDecliner = () => {
const [word, setWord] = useState('');
const [declensions, setDeclensions] = useState(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
const handleDecline = async (e) => {
e.preventDefault();
if (!word) return;
setLoading(true);
setError(null);
setDeclensions(null);
const systemPrompt = `You are an expert Russian linguist. Your task is to decline a given Russian noun into all 6 cases (Nominative, Genitive, Dative, Accusative, Instrumental, Prepositional) for both singular and plural forms.
- The user will provide a word. You must first determine if it is a valid Russian noun.
- If it is a valid noun, first find its singular nominative base form.
- Then, return the 6 case forms for both singular and plural.
- If the word is NOT a noun (e.g., verb, adjective, preposition) or is a non-existent word, you MUST set the 'error' field in your JSON response.
- If a noun is plural-only (e.g., "ножницы"), fill the singular column with "---" and provide the plural forms.
- If a noun is singular-only (e.g., "молоко"), fill the plural column with "---" and provide the singular forms.`;
const userQuery = `Please decline the word: "${word}"`;
const payload = {
contents: [{ parts: [{ text: userQuery }] }],
systemInstruction: {
parts: [{ text: systemPrompt }]
},
generationConfig: {
responseMimeType: "application/json",
responseSchema: {
type: "OBJECT",
properties: {
wordInfo: {
type: "OBJECT",
properties: {
baseForm: { type: "STRING" },
gender: { type: "STRING" },
isNoun: { type: "BOOLEAN" }
}
},
declensions: {
type: "ARRAY",
items: {
type: "OBJECT",
properties: {
case: { type: "STRING" },
singular: { type: "STRING" },
plural: { type: "STRING" }
}
}
},
error: { type: "STRING", nullable: true }
}
}
}
};
const apiKey = ""; // API key is handled by the environment
const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-09-2025:generateContent?key=${apiKey}`;
try {
const response = await fetch(apiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
if (!response.ok) {
throw new Error(`API error: ${response.statusText}`);
}
const result = await response.json();
const text = result.candidates?.[0]?.content?.parts?.[0]?.text;
if (!text) {
throw new Error("Received an empty response from the AI.");
}
const parsedJson = JSON.parse(text);
if (parsedJson.error) {
setError(parsedJson.error);
} else if (!parsedJson.wordInfo || !parsedJson.wordInfo.isNoun) {
setError(`"${word}" is not recognized as a valid Russian noun. Please try another word.`);
} else {
setDeclensions(parsedJson.declensions);
}
} catch (err) {
console.error("Declension API error:", err);
setError("Sorry, we couldn't decline this word. Please try again.");
}
setLoading(false);
};
return (
Russian Noun Decliner (Beta)
Want to know all the forms of a specific word? Type any Russian noun in its singular, nominative form (e.g., дом , мама , окно ) and our AI will decline it for you.
{loading && (
)}
{error && (
{error}
)}
{declensions && (
Case Singular Plural
{declensions.map((item, index) => (
{item.case} {item.singular} {item.plural}
))}
)}
);
};
const RussianCaseExplorer = () => {
// const [activeTab, setActiveTab] = useState('explore'); // Removed state
const [selectedCase, setSelectedCase] = useState(null);
const [filters, setFilters] = useState({ number: 'singular', gender: 'all' });
// Practice Mode State
const [shuffledQuestions, setShuffledQuestions] = useState([]);
const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0);
const [totalAnswered, setTotalAnswered] = useState(0);
const [totalCorrect, setTotalCorrect] = useState(0);
const [streak, setStreak] = useState(0);
const [showResult, setShowResult] = useState(null);
const [quizComplete, setQuizComplete] = useState(false);
// Initialize and shuffle questions on component mount
useEffect(() => {
resetQuiz(); // resetQuiz shuffles
}, []);
const resetQuiz = () => {
setShuffledQuestions(shuffleArray(allPracticeQuestions));
setCurrentQuestionIndex(0);
setTotalAnswered(0);
setTotalCorrect(0);
setStreak(0);
setShowResult(null);
setQuizComplete(false);
};
// Memoize current question object
const currentQuestion = useMemo(() => {
return shuffledQuestions[currentQuestionIndex];
}, [shuffledQuestions, currentQuestionIndex]);
// Handle case click
const handleCaseClick = (caseKey) => {
setSelectedCase(caseKey);
};
// Handle answer in practice mode
const handleAnswer = (selectedOption) => {
if (!currentQuestion) return;
const isCorrect = selectedOption.base === currentQuestion.correctAnswer.base &&
selectedOption.ending === currentQuestion.correctAnswer.ending;
setShowResult(isCorrect ? 'correct' : 'incorrect');
setTotalAnswered(totalAnswered + 1);
if (isCorrect) {
setTotalCorrect(totalCorrect + 1);
setStreak(streak + 1);
} else {
setStreak(0);
}
setTimeout(() => {
setShowResult(null);
if (currentQuestionIndex < shuffledQuestions.length - 1) {
setCurrentQuestionIndex(currentQuestionIndex + 1);
} else {
// Quiz is complete
setQuizComplete(true);
}
}, 1500);
};
const accuracy = totalAnswered > 0 ? Math.round((totalCorrect / totalAnswered) * 100) : 0;
const caseKeys = Object.keys(casesData);
return (
{/* Introduction Section - Updated */}
Russian Case Explorer
Welcome to the ultimate tool for mastering Russian cases! Use the Explore Cases tab to see how nouns change. Use the new filters to isolate by gender and number. When you're ready, switch to Practice Mode to test your knowledge with our randomized quiz.
{/* Navigation Tabs - Changed to Anchors */}
{/* Explore Tab - Now permanent and with ID */}
{/* Filters - Updated with Gender */}
View Noun: setFilters({...filters, number: e.target.value})}
className="px-4 py-2 rounded-[10px] border border-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-1"
style={{ borderColor: colors.teal, focusRingColor: colors.teal }}
> Singular Plural
View Gender: setFilters({...filters, gender: e.target.value})}
className="px-4 py-2 rounded-[10px] border border-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-1"
style={{ borderColor: colors.teal, focusRingColor: colors.teal }}
> All Genders Masculine (м) Feminine (ж) Neuter (ср)
{/* Interactive Cases Table - Updated Structure */}
Case Question Prepositions Common Endings Examples
{caseKeys.map((caseKey) => {
const caseData = casesData[caseKey];
return (
{/* Case Name */}
{caseData.name}
{caseData.russian}
handleCaseClick(caseKey)}
className="text-xs mt-1 text-blue-600 hover:underline opacity-0 group-hover:opacity-100 transition-opacity"
>
Learn more...
{/* Question */}
{caseData.question} {caseData.russianQuestion}
{/* Prepositions */}
{caseData.prepositions}
{/* Endings */}
{filters.gender === 'all' ? (
<>
{`м: ${caseData.endings[filters.number].masculine}`}
{`ж: ${caseData.endings[filters.number].feminine}`}
{`ср: ${caseData.endings[filters.number].neuter}`}
>
) : (
caseData.endings[filters.number][filters.gender]
)}
{/* Example */}
{filters.gender === 'all' ? (
<> (м) (ж) (ср)
>
) : (
/* --- ИСПРАВЛЕННЫЙ БАГ ЗДЕСЬ --- */
)}
);
})}
{/* Note for Accusative */}
*Note: For Accusative, Masculine animate & Plural animate nouns use Genitive endings. Inanimate nouns use Nominative endings.
{/* Detailed Case Modal (remains same) */}
{selectedCase && (
setSelectedCase(null)}
> e.stopPropagation()}
> setSelectedCase(null)}
className="absolute top-4 right-4 p-2 text-gray-500 hover:text-gray-800 hover:bg-gray-100 rounded-full transition-colors"
>
{casesData[selectedCase].name}
({casesData[selectedCase].russian})
{casesData[selectedCase].question} ({casesData[selectedCase].russianQuestion})
{casesData[selectedCase].description}
Typical Prepositions: {casesData[selectedCase].prepositions}
Common Endings: Singular: {casesData[selectedCase].endings.singular.masculine}, {casesData[selectedCase].endings.singular.feminine}, {casesData[selectedCase].endings.singular.neuter} Plural: {casesData[selectedCase].endings.plural.masculine}, {casesData[selectedCase].endings.plural.feminine}, {casesData[selectedCase].endings.plural.neuter}
)}
{/* --- NEW: Word Decliner Tool --- */}
{/* --- Rewritten Educational Section --- */}
What Are Russian Cases (and Why Aren't They Scary)?
In English, we know who is doing what by word order: "The student reads the book ." It's clear the student is the subject and the book is the object. If we flip it—"The book reads the student "—the meaning becomes nonsense.
Russian doesn't rely on word order. Instead, it uses a system of six cases (падежи). Think of cases as small "tags" (endings) that you add to words to show their exact role in the sentence.
This means you can say Студент читает книгу , Книгу читает студент , or Читает студент книгу , and the meaning stays exactly the same . The ending -у on книгу clearly marks it as the object, no matter where it is.
Do Other Languages Have Cases?
Yes! Many languages use cases, including German (4 cases), Latin, and Polish. What makes Russian unique is its specific set of six cases and its lack of articles (like "a" or "the"), which means the endings do even more work.
Why You Shouldn't Just Memorize Tables
Looking at the table above can be overwhelming. The secret isn't to *zubrit'* (memorize by rote) every single ending. The secret is to understand the job of each case and learn them in context.
The Genitive case's "job" is to show possession or absence (У меня нет... ). The Dative case's "job" is to show the receiver (Дай мне... ). The Prepositional case's "job" is to talk about location or topic (Я в... , Мы говорим о... ).
Use the table to explore, then use the Practice Mode to build a *feel* for the cases. That's how you'll learn to use them automatically, just like a native speaker!
{/* --- End of Rewritten Section --- */}
{/* Practice Tab - Moved to bottom with ID */}
Test Your Knowledge
{quizComplete ? (
// --- Quiz Complete Screen ---
Quiz Complete! Here's how you did:
Final Accuracy
{accuracy}%
Questions
{totalCorrect}/{totalAnswered}
Try Again (New Questions)
) : (
// --- Quiz in Progress Screen ---
currentQuestion ? (
<> Streak
{streak}
Question {currentQuestionIndex + 1} of {shuffledQuestions.length}
Put the word {currentQuestion.baseWord} into the {casesData[currentQuestion.case].name} case:
({casesData[currentQuestion.case].question} / {casesData[currentQuestion.case].russianQuestion})
{currentQuestion.options.map((option, idx) => (
!showResult && handleAnswer(option)}
disabled={showResult}
className={`p-4 rounded-[10px] font-semibold text-lg transition-all duration-200 shadow-sm ${
showResult === 'correct' && option.base === currentQuestion.correctAnswer.base && option.ending === currentQuestion.correctAnswer.ending
? 'bg-green-500 text-white scale-105'
: showResult === 'incorrect' && option.base === currentQuestion.correctAnswer.base && option.ending === currentQuestion.correctAnswer.ending
? 'bg-green-500 text-white' // Show correct even if wrong was picked
: showResult === 'incorrect' && !(option.base === currentQuestion.correctAnswer.base && option.ending === currentQuestion.correctAnswer.ending)
? 'bg-red-500 text-white opacity-60'
: 'bg-white hover:bg-gray-100' // Changed from gray-100/gray-200
}`}
style={{
color: (showResult === 'correct' || showResult === 'incorrect') ? `${colors.white} !important` : `${colors.navy} !important`
}}
>
{showResult === 'correct' && option.base === currentQuestion.correctAnswer.base && option.ending === currentQuestion.correctAnswer.ending && (
)}
{showResult === 'incorrect' && option.base === currentQuestion.correctAnswer.base && option.ending === currentQuestion.correctAnswer.ending && (
)}
))}
{showResult && (
{showResult === 'correct' ? : }
{showResult === 'correct' ? 'Correct! Отлично!' : `Incorrect. The answer is `}
{showResult === 'incorrect' && (
)}
)}
>
) : (
Loading questions...
)
)}
{/* CTA Section - Styled */}
Ready to Master Russian Grammar?
Cases might seem tricky, but they're key to fluency! Join our courses to practice with native teachers and finally make sense of Russian grammar.
Explore Our Courses
);
};
export default RussianCaseExplorer;