feat: pantry notes/categories, ingredient-alias matching, cook-log edit/delete, fork-list popover (v0.83.0)

Pantry: notes + category fields (collapsible grouping like the shopping list), a "Merge duplicates" cleanup action, and fixed quantity display precision (was showing raw decimal(10,4) strings like "0.3333 kg" everywhere — pantry, shopping list, print views, Markdown exports).

Ingredient-alias matching: the ingredients table (canonical name + aliases) existed but was never populated or used. Seeded ~10 bilingual EN/FR staples and wired resolution into pantry add/edit, can-cook scoring, auto-deduct-on-cook, and shopping-list pantry-awareness, so "sel"/"sel fin"/"table salt" are recognized as the same ingredient.

Cook log: entries from "Mark cooked" can now be edited and deleted (previously log-only, no fix-a-mistake path). The "Cooked N times" text is a hover tooltip listing every date and opens a full manage sheet on click.

Also: the "Forked by N others" backlink is now a click-to-open popover instead of an always-inline list.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-24 15:13:33 +02:00
parent a488b544dc
commit 93936eae10
37 changed files with 7255 additions and 117 deletions
+15 -6
View File
@@ -13,6 +13,7 @@
*/
import { extractIngredientQuantity } from "./extract-ingredient-quantity";
import { resolveIngredientKey, type IngredientAliasIndex } from "./ingredient-match";
export type PantrySourceItem = {
ingredientId: string | null;
@@ -55,7 +56,8 @@ export function formatQuantity(n: number): string {
*/
export function applyPantryToItems(
items: ShoppingSourceItem[],
pantry: PantrySourceItem[]
pantry: PantrySourceItem[],
aliasIndex?: IngredientAliasIndex
): PantryAdjustedItem[] {
const pantryByIngredientId = new Map<string, PantrySourceItem[]>();
const pantryByName = new Map<string, PantrySourceItem[]>();
@@ -66,10 +68,15 @@ export function applyPantryToItems(
list.push(p);
pantryByIngredientId.set(p.ingredientId, list);
}
const nameKey = normalizeName(p.rawName);
const list = pantryByName.get(nameKey) ?? [];
list.push(p);
pantryByName.set(nameKey, list);
// Index under both the plain normalized name and its alias-resolved
// canonical key (e.g. "sel fin" also indexes under salt's canonical
// id) — a shopping item written as "sel" then still finds it.
for (const key of new Set([normalizeName(p.rawName), aliasIndex ? resolveIngredientKey(p.rawName, aliasIndex) : null])) {
if (!key) continue;
const list = pantryByName.get(key) ?? [];
list.push(p);
pantryByName.set(key, list);
}
}
return items.map((item) => {
@@ -78,7 +85,9 @@ export function applyPantryToItems(
if (item.ingredientId && pantryByIngredientId.has(item.ingredientId)) {
matches = pantryByIngredientId.get(item.ingredientId);
} else {
matches = pantryByName.get(normalizeName(item.rawName));
matches =
pantryByName.get(normalizeName(item.rawName)) ??
(aliasIndex ? pantryByName.get(resolveIngredientKey(item.rawName, aliasIndex)) : undefined);
}
if (!matches || matches.length === 0) {