import React from 'react'; import { WORLD_1 } from './levels/world1.js'; import { WORLD_2 } from './levels/world2.js'; import { WORLD_3 } from './levels/world3.js'; import { WORLD_4 } from './levels/world4.js'; import { WORLD_5 } from './levels/world5.js'; import { WORLD_6 } from './levels/world6.js'; import { getLevelProgress, isLevelUnlocked, loadProgress } from './gameState.js'; const worlds = [WORLD_1, WORLD_2, WORLD_3, WORLD_4, WORLD_5, WORLD_6]; function Stars({ count, max = 3 }) { return ( {Array.from({ length: max }, (_, i) => ( ★ ))} ); } function getTotalStars() { const p = loadProgress(); return Object.values(p.completedLevels).reduce((s, l) => s + (l.stars || 0), 0); } function getMaxStars() { return worlds.reduce((s, w) => s + w.levels.length * 3, 0); } function isWorldUnlocked(world) { if (!world.unlockStars) return true; // World 1 always unlocked return getTotalStars() >= world.unlockStars; } export default function WorldMap({ onSelectLevel, onSandbox, onAdmin }) { const totalStars = getTotalStars(); const maxStars = getMaxStars(); return (
Aprende sintesis modular resolviendo puzzles
Consigue {world.unlockStars} estrellas para desbloquear ({totalStars}/{world.unlockStars})
{world.subtitle}
{level.subtitle}