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:
@@ -11,6 +11,7 @@ import { scoreRecipesAgainstPantry } from "@/lib/pantry-match";
|
||||
import { dishExpiresAt, daysUntil, isLeftoverExpiringSoon } from "@/lib/leftover-match";
|
||||
import { getPublicUrl } from "@/lib/storage";
|
||||
import { getFeatureFlagMatrix, isFeatureAvailableAnyTier, type Tier } from "@/lib/feature-flags";
|
||||
import { loadIngredientAliasIndex } from "@/lib/ingredient-match";
|
||||
|
||||
export const metadata: Metadata = {};
|
||||
|
||||
@@ -22,7 +23,7 @@ export default async function PantryPage() {
|
||||
const markdownExportLocked = !featureFlags.markdown_export[viewerTier];
|
||||
const markdownExportAvailable = isFeatureAvailableAnyTier(featureFlags, "markdown_export");
|
||||
|
||||
const [items, candidateRecipes, cookedDishes] = await Promise.all([
|
||||
const [items, candidateRecipes, cookedDishes, aliasIndex] = await Promise.all([
|
||||
db.query.pantryItems.findMany({
|
||||
where: eq(pantryItems.userId, session.user.id),
|
||||
orderBy: asc(pantryItems.rawName),
|
||||
@@ -38,6 +39,7 @@ export default async function PantryPage() {
|
||||
recipe: { columns: { id: true, title: true } },
|
||||
},
|
||||
}),
|
||||
loadIngredientAliasIndex(),
|
||||
]);
|
||||
|
||||
const mappedItems = items.map((i) => ({
|
||||
@@ -45,10 +47,12 @@ export default async function PantryPage() {
|
||||
rawName: i.rawName,
|
||||
quantity: i.quantity,
|
||||
unit: i.unit,
|
||||
notes: i.notes,
|
||||
aisle: i.aisle,
|
||||
expiresAt: i.expiresAt?.toISOString() ?? null,
|
||||
}));
|
||||
|
||||
const suggestions = scoreRecipesAgainstPantry(candidateRecipes, items)
|
||||
const suggestions = scoreRecipesAgainstPantry(candidateRecipes, items, aliasIndex)
|
||||
.filter((s) => s.usesExpiring.length > 0)
|
||||
.slice(0, 3)
|
||||
.map((s) => {
|
||||
|
||||
Reference in New Issue
Block a user