// Perfil β stats, badges, mascots, diploma
const Perfil = ({ profile, onUpdate, onLogout, onDiploma }) => {
const t = window.MP_I18N.t;
const lvl = window.MP_DATA.levelFor(profile.points || 0);
const lang = window.MP_I18N.getLang();
const equipMascot = (id) => {
if (!profile.mascotsUnlocked.includes(id)) return;
window.MP_SOUND.tap();
onUpdate({ ...profile, mascot: id });
};
const switchLang = () => {
const next = lang === 'es' ? 'en' : 'es';
window.MP_I18N.setLang(next);
onUpdate({ ...profile, lang: next });
};
return (
<>
π€ {t('profile')}
{profile.firstName} {profile.lastInitial}.
{profile.schoolName || 'β'}{profile.grade ? ' Β· ' + profile.grade + 'Β°' : ''}
{lvl.curr.name[lang]}
β {profile.points}
π₯ {profile.streak}
π {t('stats')}
π
{t('badges')} ({(profile.badges||[]).length}/{window.MP_DATA.BADGES.length})
{window.MP_DATA.BADGES.map(b => {
const owned = profile.badges?.includes(b.id);
return (
{owned ? b.icon : 'π'}
{b.name[lang]}
);
})}
πΈ {t('mascots')}
{window.MP_DATA.MASCOTS.map(m => {
const unlocked = profile.mascotsUnlocked.includes(m.id);
const equipped = profile.mascot === m.id;
return (
equipMascot(m.id)}
>
{m.name}
{equipped ? 'β ' + t('equipped') : unlocked ? t('change_mascot') : `π ${m.unlock} ${t('points')}`}
);
})}
>
);
};
const Stat = ({ label, value, color }) => (
);
window.Perfil = Perfil;