import React from 'react';
function SolutionNavigator({ solutions, currentIndex, onIndexChange }) {
if (!solutions || solutions.length === 0) {
return null;
}
const currentSolution = solutions[currentIndex];
const nextSolution = () => {
if (currentIndex < solutions.length - 1) {
onIndexChange(currentIndex + 1);
}
};
const prevSolution = () => {
if (currentIndex > 0) {
onIndexChange(currentIndex - 1);
}
};
const goToSolution = (index) => {
onIndexChange(index);
};
return (
🎯 Solutions ({solutions.length} found)
{solutions.length > 1 && (
{solutions.map((_, index) => (
))}
)}
Solution {currentIndex + 1} of {solutions.length}
{currentSolution.header && currentSolution.rows ? (
{currentSolution.header.map((header, index) => (
{header} |
))}
{currentSolution.rows.map((row, rowIndex) => (
{row.map((cell, cellIndex) => (
{cell} |
))}
))}
) : (
{JSON.stringify(currentSolution, null, 2)}
)}
);
}
export default SolutionNavigator;