import React, { useState, useMemo } from 'react';
import {
BookOpen, Brain, Trophy, ChevronRight, RotateCcw, Volume2,
Home, Star, Settings, Sun, Snowflake, Heart, Users, Feather,
Compass, X
} from 'lucide-react';
// --- Data ---
const CATEGORIES = [
{
id: 'east',
title: 'Greetings (East)',
subtitle: 'New Beginnings',
icon: ,
bgColor: 'bg-yellow-400',
textColor: 'text-black',
borderColor: 'border-yellow-600',
buttonColor: 'bg-black text-yellow-400 hover:bg-slate-900',
accentColor: 'text-black',
words: [
{ id: 1, target: 'Waq lis ʔi?', native: 'How are you?', pronunciation: 'walk-leese-ee' },
{ id: 2, target: 'Sepk\'eec\'a', native: 'Thank you', pronunciation: 'sep-kay-cha' },
{ id: 3, target: 'Moo dic', native: 'Very good', pronunciation: 'moo ditch' },
{ id: 4, target: 'At ma', native: 'Goodbye (Now you)', pronunciation: 'ot ma' },
{ id: 5, target: 'E', native: 'Yes', pronunciation: 'eh' },
]
},
{
id: 'south',
title: 'Colors (South)',
subtitle: 'Growth & Life',
icon: ,
bgColor: 'bg-red-700',
textColor: 'text-white',
borderColor: 'border-red-900',
buttonColor: 'bg-white text-red-700 hover:bg-slate-100',
accentColor: 'text-white',
words: [
{ id: 6, target: 'Taktakli', native: 'Red', pronunciation: 'tock-tock-lee' },
{ id: 7, target: 'Gekgekli', native: 'Yellow', pronunciation: 'geck-geck-lee' },
{ id: 8, target: 'Bosbosli', native: 'Black', pronunciation: 'boss-boss-lee' },
{ id: 9, target: 'Balbali', native: 'White', pronunciation: 'ball-ball-ee' },
{ id: 10, target: 'Mecmecli', native: 'Blue', pronunciation: 'metch-metch-lee' },
]
},
{
id: 'west',
title: 'Family (West)',
subtitle: 'Introspection',
icon: ,
bgColor: 'bg-black',
textColor: 'text-white',
borderColor: 'border-slate-700',
buttonColor: 'bg-white text-black hover:bg-slate-200',
accentColor: 'text-white',
words: [
{ id: 11, target: 'Pkisap', native: 'Mother', pronunciation: 'p-key-sop' },
{ id: 12, target: 'Ptisap', native: 'Father', pronunciation: 'p-tea-sop' },
{ id: 13, target: 'Maqlaqs', native: 'Person / People', pronunciation: 'mock-locks' },
{ id: 14, target: 'Ewksiknii', native: 'Klamath Lake People', pronunciation: 'ewk-sick-nee' },
{ id: 15, target: 'M\'ok\'aak', native: 'Baby', pronunciation: 'm-ok-awk' },
]
},
{
id: 'north',
title: 'Winter/Nature (North)',
subtitle: 'Wisdom',
icon: ,
bgColor: 'bg-white',
textColor: 'text-black',
borderColor: 'border-black',
buttonColor: 'bg-black text-white hover:bg-slate-800',
accentColor: 'text-black',
words: [
{ id: 16, target: 'Loldam', native: 'Winter', pronunciation: 'lool-tum' },
{ id: 17, target: 'Keys', native: 'Snow', pronunciation: 'kay-s' },
{ id: 18, target: 'Slewys', native: 'Wind', pronunciation: 'slou-weash' },
{ id: 19, target: 'We', native: 'Ice', pronunciation: 'waa' },
{ id: 20, target: 'P\'as', native: 'Food', pronunciation: 'pah-s' },
]
}
];
// --- Shared Components ---
const playAudio = (text) => {
if (!window.speechSynthesis) return;
window.speechSynthesis.cancel();
const utterance = new SpeechSynthesisUtterance(text);
utterance.rate = 0.8;
const voices = window.speechSynthesis.getVoices();
const voice = voices.find(v => v.lang === 'en-US' && !v.name.includes('Google'));
if (voice) utterance.voice = voice;
window.speechSynthesis.speak(utterance);
};
const Layout = ({ children }) => (
);
const ProgressBar = ({ current, total, color }) => (
);
const BottomNav = ({ activeTab, onTabChange }) => (
);
// --- Screens ---
const HomeScreen = ({ streak, xp, onStart }) => (
MAQLAQS
Medicine Wheel Learning
The Four Directions
{CATEGORIES.map(cat => (
{cat.icon}
{cat.title}
{cat.subtitle}
))}
);
const LearnScreen = ({ category, idx, isFlipped, setFlipped, onNext, onExit }) => {
const word = category.words[idx];
return (
{idx + 1}/{category.words.length}
setFlipped(!isFlipped)}>
{/* Front */}
{category.icon}
{word.target}
/{word.pronunciation}/
Tap to reveal
{/* Back */}
Translation
{word.native}
);
};
const QuizScreen = ({ category, idx, onAnswer, onExit }) => {
const word = category.words[idx];
const options = useMemo(() => {
const others = category.words.filter(w => w.id !== word.id).sort(() => 0.5 - Math.random()).slice(0, 2);
return [word, ...others].sort(() => 0.5 - Math.random());
}, [word, category]);
return (
{idx + 1}/{category.words.length}
How do you say?
{word.native}
{options.map((opt) => (
))}
);
};
const ResultScreen = ({ category, score, onHome }) => {
const isSuccess = (score / category.words.length) >= 0.7;
return (
{isSuccess ? : }
{isSuccess ? 'Success!' : 'Keep Going!'}
{isSuccess ? `You have honored the ${category.title} direction.` : `You got ${score} out of ${category.words.length} correct.`}
Score
{Math.round((score / category.words.length) * 100)}%
XP Earned
+{isSuccess ? 100 : 25}
);
};
// --- Main App ---
export default function App() {
const [view, setView] = useState('home');
const [session, setSession] = useState({ category: null, idx: 0, flipped: false, score: 0 });
const [stats, setStats] = useState({ streak: 5, xp: 2450 });
const startSession = (category, mode) => {
setSession({ category, idx: 0, flipped: false, score: 0 });
setView(mode);
};
const handleNext = (isCorrect = null) => {
const { category, idx, score } = session;
const newScore = isCorrect ? score + 1 : score;
if (idx < category.words.length - 1) {
setTimeout(() => setSession(s => ({ ...s, idx: s.idx + 1, flipped: false, score: newScore })), 150);
} else {
const passed = (newScore / category.words.length) >= 0.7;
setStats(s => ({ ...s, xp: s.xp + (passed || view === 'learn' ? (view === 'learn' ? 50 : 100) : 25) }));
setView(view === 'quiz' ? 'result' : 'home');
if (view === 'quiz') setSession(s => ({ ...s, score: newScore }));
}
};
return (
{view === 'home' && }
{view === 'learn' && session.category && (
setSession(s => ({ ...s, flipped: f }))}
onNext={() => handleNext()}
onExit={() => setView('home')}
/>
)}
{view === 'quiz' && session.category && (
setView('home')}
/>
)}
{view === 'result' && session.category && (
setView('home')} />
)}
{view === 'home' && {}} />}
);
}