feat: calorie tap → fitness, confetti on food add, reduce dashboard padding
- Calorie widget taps switches to Fitness tab - After adding food: dismiss sheet, switch to Fitness, confetti animation - Confetti: emoji particles falling + checkmark + haptic feedback - Dashboard top padding reduced from 60pt to 16pt - HomeView accepts selectedTab binding Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import PhotosUI
|
||||
|
||||
struct AssistantChatView: View {
|
||||
@State private var vm = AssistantViewModel()
|
||||
var onFoodAdded: (() -> Void)?
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
@@ -113,6 +114,13 @@ struct AssistantChatView: View {
|
||||
.onChange(of: vm.selectedPhoto) {
|
||||
Task { await vm.handlePhotoSelection() }
|
||||
}
|
||||
.onChange(of: vm.applied) {
|
||||
if vm.applied {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
onFoodAdded?()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Chat Bubble
|
||||
|
||||
@@ -4,8 +4,8 @@ import PhotosUI
|
||||
struct HomeView: View {
|
||||
@Environment(AuthManager.self) private var auth
|
||||
@State private var vm = HomeViewModel()
|
||||
@State private var showAssistant = false
|
||||
@State private var ringAnimated = false
|
||||
@Binding var selectedTab: Int
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
@@ -54,12 +54,15 @@ struct HomeView: View {
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
.padding(.top, 60)
|
||||
.padding(.top, 16)
|
||||
|
||||
// Widget grid — half width
|
||||
// Widget grid — half width, tap to go to fitness
|
||||
HStack(spacing: 12) {
|
||||
calorieWidget
|
||||
// Future widget placeholder — invisible spacer
|
||||
Button { selectedTab = 1 } label: {
|
||||
calorieWidget
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
|
||||
Color.clear
|
||||
}
|
||||
.padding(.horizontal)
|
||||
|
||||
Reference in New Issue
Block a user