feat: ask replace vs save-to-archive on regenerate recipe

When user clicks 'Generate another', show a choice:
- Replace (discard current, generate new) — former behavior
- Save to archive & generate new — saves current recipe first

All 5 languages (it/en/de/fr/es) with regen_choice_title,
regen_replace, regen_save_new keys.
This commit is contained in:
dadaloop82
2026-05-25 10:11:56 +00:00
parent 52afdd6bfa
commit 4e4a736dba
8 changed files with 74 additions and 2 deletions
+34 -1
View File
@@ -13206,6 +13206,12 @@ function _extractToolsFromSteps(steps) {
}
function renderRecipe(r) {
// Reset regen choice panel (hide choice, show button)
const regenChoice = document.getElementById('recipe-regen-choice');
const regenBtn = document.getElementById('recipe-regen-btn');
if (regenChoice) regenChoice.style.display = 'none';
if (regenBtn) regenBtn.style.display = '';
let html = `<h2>${r.title}</h2>`;
// Meta tags
@@ -14692,7 +14698,30 @@ function _renderMealPlanHint(mealSlot) {
}).catch(() => {/* ignore */});
}
function regenerateRecipe() {
function showRegenChoice() {
document.getElementById('recipe-regen-btn').style.display = 'none';
document.getElementById('recipe-regen-choice').style.display = '';
}
function cancelRegenChoice() {
document.getElementById('recipe-regen-choice').style.display = 'none';
document.getElementById('recipe-regen-btn').style.display = '';
}
function doRegenerateReplace() {
cancelRegenChoice();
_doRegenerate();
}
async function doRegenerateSave() {
if (_cachedRecipe && _cachedRecipe.recipe) {
await saveRecipeToArchive(_cachedRecipe.recipe);
}
cancelRegenChoice();
_doRegenerate();
}
function _doRegenerate() {
// Collect main ingredients from the rejected recipe to exclude them
if (_cachedRecipe && _cachedRecipe.recipe && _cachedRecipe.recipe.ingredients) {
const mainIngs = _cachedRecipe.recipe.ingredients
@@ -14708,6 +14737,10 @@ function regenerateRecipe() {
document.getElementById('recipe-ask').style.display = '';
}
function regenerateRecipe() {
showRegenChoice();
}
async function generateRecipe() {
if (!_requireGemini()) return;
const meal = getSelectedMealType();