// Recipe Modal Component import { showToast } from '../utils/uiHelpers.js'; class RecipeModal { constructor() { this.init(); } init() { this.setupCopyButtons(); } showRecipeDetails(recipe) { console.log(recipe); // Set modal title const modalTitle = document.getElementById('recipeModalTitle'); if (modalTitle) { modalTitle.textContent = recipe.title || 'Recipe Details'; } // Set recipe image const modalImage = document.getElementById('recipeModalImage'); if (modalImage) { // Ensure file_url exists, fallback to file_path if needed const imageUrl = recipe.file_url || (recipe.file_path ? `/loras_static/root1/preview/${recipe.file_path.split('/').pop()}` : '/loras_static/images/no-preview.png'); modalImage.src = imageUrl; modalImage.alt = recipe.title || 'Recipe Preview'; } // Set generation parameters const promptElement = document.getElementById('recipePrompt'); const negativePromptElement = document.getElementById('recipeNegativePrompt'); const otherParamsElement = document.getElementById('recipeOtherParams'); if (recipe.gen_params) { // Set prompt if (promptElement && recipe.gen_params.prompt) { promptElement.textContent = recipe.gen_params.prompt; } else if (promptElement) { promptElement.textContent = 'No prompt information available'; } // Set negative prompt if (negativePromptElement && recipe.gen_params.negative_prompt) { negativePromptElement.textContent = recipe.gen_params.negative_prompt; } else if (negativePromptElement) { negativePromptElement.textContent = 'No negative prompt information available'; } // Set other parameters if (otherParamsElement) { // Clear previous params otherParamsElement.innerHTML = ''; // Add all other parameters except prompt and negative_prompt const excludedParams = ['prompt', 'negative_prompt']; for (const [key, value] of Object.entries(recipe.gen_params)) { if (!excludedParams.includes(key) && value !== undefined && value !== null) { const paramTag = document.createElement('div'); paramTag.className = 'param-tag'; paramTag.innerHTML = ` ${key}: ${value} `; otherParamsElement.appendChild(paramTag); } } // If no other params, show a message if (otherParamsElement.children.length === 0) { otherParamsElement.innerHTML = '