import React, { useState, useEffect } from ‘react’; import { Ruler, Map, MoveRight, CheckCircle2, AlertCircle, HelpCircle, RefreshCcw, Info } from ‘lucide-react’; const App = () => { const [view, setView] = useState(‘learn’); const [scaleInput, setScaleInput] = useState(‘400000’); const [quizStep, setQuizStep] = useState(0); const [userAnswer, setUserAnswer] = useState(”); const [quizFeedback, setQuizFeedback] = useState(null); const [score, setScore] = useState(0); // Quiz questions inspired by the PDF examples const quizQuestions = [ { scale: ‘1 : 300’, question: ‘1 cm na mapie to ile metrów w terenie?’, unit: ‘m’, correct: 3, hint: ‘Skreśl 2 zera (100 cm = 1 m)’ }, { scale: ‘1 : 2000’, question: ‘1 cm na mapie to ile metrów w terenie?’, unit: ‘m’, correct: 20, hint: ‘Odejmij dwa zera od 2000’ }, { scale: ‘1 : 400 000’, question: ‘1 cm na mapie to ile kilometrów w terenie?’, unit: ‘km’, correct: 4, hint: ‘Skreśl 5 zer, aby otrzymać kilometry’ }, { scale: ‘1 : 5000’, question: ‘Ile metrów w terenie odpowiada 1 cm na mapie?’, unit: ‘m’, correct: 50, hint: ‘Skreśl 2 zera’ }, { scale: ‘1 : 1 000 000’, question: ‘1 cm na mapie to 10 km. Prawda czy Fałsz?’, type: ‘boolean’, correct: ‘prawda’, hint: ‘1 000 000 cm to 10 000 m, czyli 10 km’ } ]; const handleQuizSubmit = () => { const current = quizQuestions[quizStep]; let isCorrect = false; if (current.type === ‘boolean’) { isCorrect = userAnswer.toLowerCase() === current.correct; } else { isCorrect = parseFloat(userAnswer) === current.correct; } if (isCorrect) { setQuizFeedback(‘correct’); setScore(score + 1); } else { setQuizFeedback(‘wrong’); } }; const nextQuestion = () => { setUserAnswer(”); setQuizFeedback(null); if (quizStep < quizQuestions.length - 1) { setQuizStep(quizStep + 1); } else { setQuizStep(0); setScore(0); } }; return (
{/* Header Section */}

MISTRZ SKALI

Klasa 4-6 • Zadania Interaktywne

{/* Dynamic View Area */}
{view === ‘learn’ && (

Jak działa “Zjadanie Zer”?

Skala mówi nam, ile centymetrów w terenie odpowiada 1 centymetrowi na mapie. Ale nikt nie mierzy drogi do szkoły w centymetrach! Dlatego używamy dwóch trików:

Trik 1: Chcesz metry? Skreśl 2 zera (bo 1 m = 100 cm).

Trik 2: Chcesz kilometry? Skreśl 5 zer (bo 1 km = 100 000 cm).

Przykład w akcji:

Skala 1 : 2000
1 cm = 2000 m
Skala 1 : 400 000
1 cm = 400000 km
)} {view === ‘calculator’ && (

Transformator Zer

Wpisz skalę, a ja pokażę Ci, jak znikają zera!

1 :
setScaleInput(e.target.value)} className=”w-full bg-transparent px-4 py-3 text-2xl font-black focus:outline-none placeholder-slate-300″ placeholder=”Wpisz liczbę…” />
{/* Result Meters */}
W metrach -2 zera
{scaleInput.length >= 2 ? ( <> {scaleInput.slice(0, -2)} {scaleInput.slice(-2)} m ) : ‘…’}

“1 cm na mapie to {scaleInput.length >= 2 ? scaleInput.slice(0, -2) : ‘…’} m w terenie”

{/* Result KM */}
W kilometrach -5 zer
{scaleInput.length >= 5 ? ( <> {scaleInput.slice(0, -5)} {scaleInput.slice(-5)} km ) : ( Za mało zer na km! )}

“1 cm na mapie to {scaleInput.length >= 5 ? scaleInput.slice(0, -5) : ‘0,’ + scaleInput.padStart(5, ‘0’)} km”

)} {view === ‘quiz’ && (
{/* Progress dots */}
{quizQuestions.map((_, i) => (
))}
Skala Mapy
{quizQuestions[quizStep].scale}

{quizQuestions[quizStep].question}

{quizQuestions[quizStep].type === ‘boolean’ ? (
{[‘PRAWDA’, ‘FAŁSZ’].map((opt) => ( ))}
) : (
setUserAnswer(e.target.value)} placeholder=”Wpisz wynik…” className=”w-full bg-slate-50 px-6 py-6 rounded-2xl border-2 border-slate-200 focus:border-blue-500 focus:bg-white focus:outline-none text-center font-black text-3xl transition-all shadow-inner” /> {quizQuestions[quizStep].unit}
)}
{!quizFeedback ? ( ) : (
{quizFeedback === ‘correct’ ? : }

{quizFeedback === ‘correct’ ? ‘FENOMENALNIE!’ : ‘OJ, BLISKO!’}

{quizFeedback === ‘correct’ ? ‘Znasz skalę jak własną kieszeń.’ : `Poprawna odpowiedź: ${quizQuestions[quizStep].correct} ${quizQuestions[quizStep].unit || ”}`}

{quizQuestions[quizStep].hint}
)}
)}
Zasada złotej rączki:
1 m = 100 cm (✂️ 00) 1 km = 100 000 cm (✂️ 00000)
); }; export default App;