a4dfb38feb
- Dish.isPriority: mark dishes as priority; auto-assign gives them 2.5x weight - Tag.dayRestriction: restrict tags to weekdays or weekend only - Auto-assign CTA banner shown when there are empty slots (was hidden in context menu) - Tap on filled slot opens picker to replace dish directly (no need to remove first) - Export callout visible as soon as ≥1 slot is filled (not only when week is complete) - WeekPlanShareView shows localized "TBD" / "Eating out" for empty/eating-out slots - Second Sunday 17:00 push notification to plan next week - DishDrawer sorts: priority first, then by historical usage, then alphabetically - Search in SlotDishPickerSheet already shipped in 1.0.5 (verified ✓) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
1.1 KiB
Swift
37 lines
1.1 KiB
Swift
import SwiftUI
|
|
import SwiftData
|
|
|
|
@MainActor
|
|
final class TagViewModel: ObservableObject {
|
|
@Published var editingTag: Tag?
|
|
@Published var maxPerWeek: Int? = nil
|
|
@Published var noConsecutive: Bool = false
|
|
@Published var noDuplicateInDay: Bool = false
|
|
@Published var mealTypeRestriction: String? = nil
|
|
@Published var dayRestriction: String? = nil
|
|
@Published var useMaxLimit: Bool = true
|
|
|
|
func loadTag(_ tag: Tag) {
|
|
editingTag = tag
|
|
maxPerWeek = tag.maxPerWeek
|
|
noConsecutive = tag.noConsecutive
|
|
noDuplicateInDay = tag.noDuplicateInDay
|
|
mealTypeRestriction = tag.mealTypeRestriction
|
|
dayRestriction = tag.dayRestriction
|
|
useMaxLimit = tag.maxPerWeek != nil
|
|
}
|
|
|
|
func save() {
|
|
guard let tag = editingTag else { return }
|
|
tag.maxPerWeek = useMaxLimit ? (maxPerWeek ?? 3) : nil
|
|
tag.noConsecutive = noConsecutive
|
|
tag.noDuplicateInDay = noDuplicateInDay
|
|
tag.mealTypeRestriction = mealTypeRestriction
|
|
tag.dayRestriction = dayRestriction
|
|
}
|
|
|
|
func reset() {
|
|
editingTag = nil
|
|
}
|
|
}
|