feat: canvas-confetti style celebration + Quick Add callback
All checks were successful
Security Checks / dependency-audit (push) Successful in 13s
Security Checks / secret-scanning (push) Successful in 4s
Security Checks / dockerfile-lint (push) Successful in 3s

Confetti:
- 60 particles in 3 layered bursts (like canvas-confetti)
- Circles, rectangles, stars in 12 vibrant colors
- Physics: drift, spin, gravity, fade, scale
- Checkmark + 'Added!' text with spring animation
- Haptic feedback

Quick Add:
- FoodSearchView + AddFoodSheet now have onFoodAdded callback
- After adding from Quick Add: dismiss → fitness tab → confetti

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yusuf Suleman
2026-04-03 09:43:13 -05:00
parent b01409628f
commit 1dfa05fe4f
3 changed files with 155 additions and 49 deletions

View File

@@ -3,6 +3,7 @@ import SwiftUI
struct AddFoodSheet: View {
@Environment(\.dismiss) private var dismiss
let food: Food
var onFoodAdded: (() -> Void)?
@State private var quantity: Double = 1.0
@State private var selectedMeal: MealType = .snack
@@ -234,6 +235,7 @@ struct AddFoodSheet: View {
)
_ = try await FitnessRepository.shared.createEntry(request)
dismiss()
onFoodAdded?()
} catch {
self.error = error.localizedDescription
}

View File

@@ -2,6 +2,7 @@ import SwiftUI
struct FoodSearchView: View {
var isSheet: Bool = false
var onFoodAdded: (() -> Void)?
@State private var vm = FoodSearchViewModel()
@State private var selectedFood: Food?
@@ -48,7 +49,7 @@ struct FoodSearchView: View {
vm.search()
}
.sheet(item: $selectedFood) { food in
AddFoodSheet(food: food)
AddFoodSheet(food: food, onFoodAdded: onFoodAdded)
}
}