feat: batch-cook shopping list (already worked) + leftover expiry reminders

Shopping list add already worked generically for batch-cook recipes —
no code needed there.

New: mark a specific batch-cook dish as "cooked today", track its
fridge expiry (cookingHistory.batchDishId), surface a "Leftovers
expiring soon" widget on the pantry page, and send a daily push+email
reminder via a new /api/internal/cron/leftover-reminders endpoint
(mirrors the weekly-digest cron pattern; doesn't use the social
notifications table, which requires a non-null actor and isn't built
for self-reminders).

Also fixes, from user-reported bugs:
- Recipe cards showed no batch-cook badge/dish-count/prep-time in some
  views — added dishCount + prepMins/cookMins (now generated by the AI
  and persisted) to the card component and /recipes query.
- Batch-cook descriptions occasionally contained raw markdown
  (**bold**) — added explicit "plain prose only" prompt instructions
  and a stripMarkdown() defensive fallback at render time.
- Truncated/cut-off descriptions — the generateObject call had no
  maxOutputTokens set, so long structured responses could get cut off
  mid-field; now capped explicitly at 8000.
- Generate dialogs (batch-cook + the main AI dialog) could show
  buttons unreachable once the progress bar appeared mid-generation —
  restructured so the action row is pinned outside the scrollable
  content area, not affected by content height changes.
- /api/internal/* routes were being redirected to /login by middleware
  before their own CRON_SECRET check ever ran (pre-existing bug,
  affected the weekly-digest cron too) — added to PUBLIC_PATHS.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-12 10:03:52 +02:00
parent 646c97128d
commit 002f14ced0
24 changed files with 5070 additions and 47 deletions
+11 -2
View File
@@ -40,7 +40,8 @@
"mention": "{name} mentioned you in a comment",
"detail": {
"comment": "{name} commented on your recipe \"{title}\"",
"rating": "{name} rated your recipe \"{title}\" {stars} stars"
"rating": "{name} rated your recipe \"{title}\" {stars} stars",
"leftoverExpiring": "Your \"{dish}\" from \"{title}\" is about to expire — eat it soon!"
},
"pushTitle": {
"follow": "New follower",
@@ -48,7 +49,8 @@
"reply": "New reply",
"reaction": "New reaction",
"rating": "New rating",
"mention": "You were mentioned"
"mention": "You were mentioned",
"leftoverExpiring": "Leftovers expiring soon"
}
},
"recipe": {
@@ -68,6 +70,10 @@
"batchCookFridgeDays": "Fridge: {days}d",
"batchCookFreezerFriendly": "Freezer-friendly",
"batchCookDayOf": "On the day",
"batchCookMarkCooked": "Mark as cooked today",
"batchCookMarkSuccess": "Marked as cooked",
"batchCookMarkFailed": "Failed to mark as cooked",
"batchCookExpiresOn": "Cooked — good until {date}",
"servings": "{count} servings",
"prep": "{mins}m prep",
"cook": "{mins}m cook",
@@ -770,6 +776,9 @@
"canCook": "What can I cook?",
"expiringSoonSuggestionsTitle": "Use it up soon",
"seeAll": "See all",
"expiringLeftoversTitle": "Leftovers expiring soon",
"expiringToday": "Eat today",
"expiringInDays": "{days}d left",
"itemNamePlaceholder": "Item name",
"qtyPlaceholder": "Qty",
"unitPlaceholder": "Unit",