2.0: beta feedback — edit dish from shopping list + dish photos in planner
- Shopping list: dishes under "No ingredients yet" now open the dish editor on tap (pencil affordance); list reconciles on dismiss. This was a dead end on devices without Apple Intelligence (no Generate button, e.g. iPhone 14). - Planner: dish photo as a scrimmed card background in the week calendar, behind a new Settings toggle (settings_show_dish_photos, default on). New optional AppSettings.showDishPhotosInPlanner (CloudKit/migration safe). - FilledSlotView: inlines the meal-card chrome to support the photo layer. - Toggle localized in all 6 languages. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BkanrydYtrme8wipTzWssG
This commit is contained in:
@@ -271,6 +271,7 @@ struct WeekCalendarView: View {
|
||||
tags: dishTags.map { (name: $0.localizedName(language: settings.languageEnum.resolved()), color: $0.color) },
|
||||
mealType: mealType,
|
||||
showsRuleWarning: slot.isRuleOverridden,
|
||||
photoData: settings.showDishPhotosInPlannerResolved ? dishData.photoData : nil,
|
||||
onRemove: viewModel.canEditCurrentWeek ? {
|
||||
guard let live = liveSlot(for: slot) else { return }
|
||||
viewModel.removeDish(from: live, plan: plan, settings: settings)
|
||||
@@ -313,6 +314,7 @@ struct WeekCalendarView: View {
|
||||
let name: String
|
||||
let descriptionText: String?
|
||||
let tagIds: [UUID]
|
||||
let photoData: Data?
|
||||
}
|
||||
|
||||
private struct DisplaySlot {
|
||||
@@ -326,7 +328,7 @@ struct WeekCalendarView: View {
|
||||
|
||||
private var dishesSnapshotKey: String {
|
||||
dishes
|
||||
.map { "\($0.id.uuidString)|\($0.name)|\($0.tagIds.count)|\($0.descriptionText ?? "")" }
|
||||
.map { "\($0.id.uuidString)|\($0.name)|\($0.tagIds.count)|\($0.descriptionText ?? "")|\($0.photoData?.count ?? 0)" }
|
||||
.joined(separator: ";")
|
||||
}
|
||||
|
||||
@@ -335,7 +337,8 @@ struct WeekCalendarView: View {
|
||||
return DishSnapshot(
|
||||
name: live.name,
|
||||
descriptionText: live.descriptionText,
|
||||
tagIds: live.tagIds
|
||||
tagIds: live.tagIds,
|
||||
photoData: live.photoData
|
||||
)
|
||||
}
|
||||
return dishSnapshotsById[dishId]
|
||||
@@ -348,7 +351,8 @@ struct WeekCalendarView: View {
|
||||
DishSnapshot(
|
||||
name: dish.name,
|
||||
descriptionText: dish.descriptionText,
|
||||
tagIds: dish.tagIds
|
||||
tagIds: dish.tagIds,
|
||||
photoData: dish.photoData
|
||||
)
|
||||
)
|
||||
})
|
||||
|
||||
@@ -89,6 +89,12 @@ struct SettingsView: View {
|
||||
))
|
||||
.tint(.mealMoodCoral)
|
||||
|
||||
Toggle("settings_show_dish_photos", isOn: Binding(
|
||||
get: { settings.showDishPhotosInPlannerResolved },
|
||||
set: { settings.showDishPhotosInPlannerResolved = $0 }
|
||||
))
|
||||
.tint(.mealMoodCoral)
|
||||
|
||||
Picker("settings_export_style", selection: Binding(
|
||||
get: { settings.weekExportStyleEnum },
|
||||
set: { settings.weekExportStyleEnum = $0 }
|
||||
|
||||
@@ -18,6 +18,7 @@ struct ShoppingListView: View {
|
||||
@State private var newItemText: String = ""
|
||||
@State private var generatingDishId: UUID?
|
||||
@State private var showPaywall = false
|
||||
@State private var editingDish: Dish?
|
||||
|
||||
private var items: [ShoppingItem] {
|
||||
allItems
|
||||
@@ -131,6 +132,16 @@ struct ShoppingListView: View {
|
||||
.sheet(isPresented: $showPaywall) {
|
||||
PremiumView(settings: settings, source: "ingredient_generation")
|
||||
}
|
||||
.sheet(item: $editingDish, onDismiss: {
|
||||
// Pick up ingredients the user just added in the editor.
|
||||
ShoppingListService.reconcile(
|
||||
context: context,
|
||||
weekStartDate: weekStartDate,
|
||||
plannedDishes: plannedDishes
|
||||
)
|
||||
}) { dish in
|
||||
DishFormView(dish: dish)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,9 +190,23 @@ struct ShoppingListView: View {
|
||||
@ViewBuilder
|
||||
private func missingIngredientsRow(_ dish: Dish) -> some View {
|
||||
HStack {
|
||||
Text(dish.name)
|
||||
.foregroundColor(.mealMoodTextPrimary)
|
||||
// Tapping the dish opens its editor — the only path to add
|
||||
// ingredients on devices without on-device generation.
|
||||
Button {
|
||||
editingDish = dish
|
||||
} label: {
|
||||
HStack(spacing: 6) {
|
||||
Text(dish.name)
|
||||
.foregroundColor(.mealMoodTextPrimary)
|
||||
Image(systemName: "square.and.pencil")
|
||||
.font(.system(size: 13))
|
||||
.foregroundColor(.mealMoodTextSecondary)
|
||||
}
|
||||
}
|
||||
.buttonStyle(.borderless)
|
||||
|
||||
Spacer()
|
||||
|
||||
if IngredientGenerator.isAvailable {
|
||||
if generatingDishId == dish.id {
|
||||
ProgressView()
|
||||
|
||||
Reference in New Issue
Block a user