Public User Stats - NutrientShield
Public User Stats & Recipes
Explore user stats and their nutrient-rich recipes
User Stats & Recipes
Select a user to view their recipes...
`;
});
container.innerHTML += '
';
} else {
container.innerHTML = '
No recipes found for this user.
';
}
} else {
container.innerHTML = '
Select a user to view their recipes...
';
}
});
});
function loadRandomRecipe() {
// Random recipe from https://nutrientshield.com/Meals-and-Recipes (hardcoded for demo; use AJAX in production)
const randomRecipes = [
{ title: 'Amaranth Breakfast Porridge', image: 'https://nutrientshield.com/images/amaranth.jpg', desc: 'Nutrient-packed porridge', link: 'https://nutrientshield.com/superfoodrecipes' },
{ title: 'Beet Smoothie Bowl', image: 'https://nutrientshield.com/images/beet.jpg', desc: 'Vibrant beet bowl', link: 'https://nutrientshield.com/nitrate-rich' },
// Add more from the 17 recipes...
];
const randomIndex = Math.floor(Math.random() * randomRecipes.length);
const recipe = randomRecipes[randomIndex];
document.getElementById('randomRecipe').innerHTML = `
${recipe.title}
${recipe.desc}
`;
}
function openRecipeModal(recipeId) {
const recipe = recipesData.find(r => r.id === recipeId);
if (recipe) {
document.getElementById('modalBody').innerHTML = `
${recipe.title}
${recipe.fullContent}
`;
document.getElementById('recipeModal').style.display = 'flex';
}
}
function closeRecipeModal() {
document.getElementById('recipeModal').style.display = 'none';
}
// Close modal when clicking outside
document.getElementById('recipeModal').addEventListener('click', function(e) {
if (e.target === this) {
closeRecipeModal();
}
});