Replace scan button in nav with AI recipe generator

- Remove camera/scan button from bottom nav (scan stays in header)
- Add 🍳 Ricetta button with prominent styling in bottom nav
- Auto-detect meal type based on time of day (colazione/pranzo/cena)
- Ask number of persons (default 1)
- Generate recipe via Gemini AI using pantry ingredients
- Prioritize expiring/expired items in recipe suggestions
- Focus on healthy, balanced meals
- Full recipe with ingredients list and step-by-step procedure
- Show prep/cook time, tags, nutrition notes, expiry warnings
- Mark ingredients as from pantry () or extra (🛒)
This commit is contained in:
dadaloop82
2026-03-10 12:12:09 +00:00
parent c015b5b623
commit 0e2287d1e3
4 changed files with 418 additions and 6 deletions
+37 -3
View File
@@ -460,9 +460,9 @@
<span class="nav-icon">📋</span>
<span class="nav-label">Inventario</span>
</button>
<button class="nav-btn scan-btn" onclick="showPage('scan')" data-page="scan">
<span class="nav-icon-large">📷</span>
<span class="nav-label">Scansiona</span>
<button class="nav-btn recipe-btn" onclick="openRecipeDialog()" data-page="recipe">
<span class="nav-icon-large">🍳</span>
<span class="nav-label">Ricetta</span>
</button>
<button class="nav-btn" onclick="showPage('products')" data-page="products">
<span class="nav-icon">📦</span>
@@ -470,6 +470,40 @@
</button>
</nav>
<!-- Recipe Dialog -->
<div class="modal-overlay" id="recipe-overlay" style="display:none" onclick="closeRecipeDialog()">
<div class="modal-content recipe-dialog" onclick="event.stopPropagation()">
<div id="recipe-ask" class="recipe-ask">
<h3 id="recipe-meal-title">🍳 Ricetta</h3>
<p class="recipe-desc">Genero una ricetta sana con gli ingredienti in dispensa, dando priorità a quelli in scadenza.</p>
<div class="form-group">
<label>👥 Quante persone?</label>
<div class="qty-control">
<button type="button" class="qty-btn" onclick="adjustRecipePersons(-1)"></button>
<input type="number" id="recipe-persons" value="1" min="1" max="20" class="qty-input">
<button type="button" class="qty-btn" onclick="adjustRecipePersons(1)">+</button>
</div>
</div>
<button class="btn btn-large btn-success full-width" onclick="generateRecipe()">
✨ Genera Ricetta
</button>
<button class="btn btn-large btn-secondary full-width mt-2" onclick="closeRecipeDialog()">
Annulla
</button>
</div>
<div id="recipe-loading" style="display:none" class="recipe-loading">
<div class="loading-spinner"></div>
<p>Sto preparando la ricetta...</p>
</div>
<div id="recipe-result" style="display:none" class="recipe-result">
<div id="recipe-content"></div>
<button class="btn btn-large btn-primary full-width mt-2" onclick="closeRecipeDialog()">
✅ Chiudi
</button>
</div>
</div>
</div>
<!-- Toast notification -->
<div class="toast" id="toast"></div>