feat: bottone 'Usa' per ogni ingrediente ricetta - scala dalla dispensa

- Backend: arricchisce risposta ricetta con product_id, location per ingredienti from_pantry
- Matching fuzzy nome ingrediente AI → prodotto inventario (exact/contains/word overlap)
- Frontend: bottone '📦 Usa' per ogni ingrediente catalogato in dispensa
- Click → chiama inventory_use API → scala 1 unità → feedback visivo (barrato + verde)
- Ingredienti non in dispensa (🛒) mostrati senza bottone
This commit is contained in:
dadaloop82
2026-03-10 17:29:49 +00:00
parent 5258c11f51
commit fa4dc6ae88
3 changed files with 154 additions and 5 deletions
+57
View File
@@ -2031,6 +2031,63 @@ body {
line-height: 1.5;
}
/* Recipe ingredient use buttons */
.recipe-ingredients {
list-style: none;
padding: 0;
}
.recipe-ingredient {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 6px 0;
border-bottom: 1px solid var(--bg-light);
}
.recipe-ingredient:last-child {
border-bottom: none;
}
.recipe-ing-text {
flex: 1;
min-width: 0;
line-height: 1.4;
}
.btn-use-ingredient {
flex-shrink: 0;
background: var(--primary);
color: #fff;
border: none;
border-radius: var(--radius-sm);
padding: 4px 10px;
font-size: 0.78rem;
font-weight: 600;
cursor: pointer;
white-space: nowrap;
transition: background 0.2s, opacity 0.2s;
}
.btn-use-ingredient:active {
opacity: 0.7;
}
.btn-use-ingredient:disabled {
cursor: default;
opacity: 0.6;
}
.btn-use-ingredient.btn-used {
background: var(--success);
}
.recipe-ing-used .recipe-ing-text {
text-decoration: line-through;
opacity: 0.5;
}
/* ===== AI IDENTIFICATION RESULTS ===== */
.ai-identified-card {
background: var(--bg-light);