import SwiftUI struct ContentView: View { @State var root: RootFlow = DefaultTokenStore().jwt == nil ? .auth : .main @State var selectedTab: MainTab = .home private let tokenStore: TokenStore = DefaultTokenStore() @State var appState = AppState() #if os(Android) @State var snackbarCenter = SnackbarCenter.shared #else @StateObject var snackbarCenter = SnackbarCenter.shared #endif var body: some View { ZStack(alignment: .top) { Group { switch root { case .auth: AuthFlowView(root: $root, selectedTab: $selectedTab, tokenStore: tokenStore, appState: $appState) case .main: MainTabView(selectedTab: $selectedTab, root: $root, tokenStore: tokenStore, appState: $appState) } } SnackbarOverlay(center: snackbarCenter) } .sheet(item: $appState.activeModal) { modal in switch modal { case .addressPicker: AddressPickerModalView(appState: $appState, selectedTab: $selectedTab) case .filters: FiltersModalView() } } } } struct AddressPickerModalView: View { @Binding var appState: AppState @Binding var selectedTab: MainTab @Environment(\.dismiss) var dismiss var body: some View { NavigationStack { VStack(spacing: 12) { if let message = appState.address.onboardingMessage { Text(message) .font(AppTypography.body) .multilineTextAlignment(.center) .foregroundStyle(AppColors.textPrimary) .padding(.horizontal, 16) .padding(.vertical, 12) .frame(maxWidth: .infinity) .background(AppColors.brandSoft) .clipShape(RoundedRectangle(cornerRadius: 14, style: .continuous)) .padding(.horizontal, 20) } Text("Selecionar endereco") .font(AppTypography.heading2) Text("Fluxo de endereco sera implementado na etapa de checkout/perfil.") .font(AppTypography.body) .multilineTextAlignment(.center) .foregroundStyle(AppColors.textMuted) Button("Ir para Perfil > Endereços") { selectedTab = .profile dismiss() } .font(AppTypography.heading3) .foregroundStyle(AppColors.primary) .padding(.top, 8) } .padding(24) .frame(maxWidth: .infinity, maxHeight: .infinity) .background(AppColors.backgroundLight) } } } struct FiltersModalView: View { var body: some View { NavigationStack { VStack(spacing: 12) { Text("Filtros") .font(AppTypography.heading2) Text("Filtros de busca serao ligados na integracao real da Home com API.") .font(AppTypography.body) .multilineTextAlignment(.center) .foregroundStyle(AppColors.textMuted) } .padding(24) .frame(maxWidth: .infinity, maxHeight: .infinity) .background(AppColors.backgroundLight) } } }