diff --git a/pedi-foods/Sources/PediFoods/Views/Main/OrderDetailsView.swift b/pedi-foods/Sources/PediFoods/Views/Main/OrderDetailsView.swift index 8b5c33a..1494bab 100644 --- a/pedi-foods/Sources/PediFoods/Views/Main/OrderDetailsView.swift +++ b/pedi-foods/Sources/PediFoods/Views/Main/OrderDetailsView.swift @@ -19,7 +19,7 @@ struct OrderDetailsView: View { } .padding(.horizontal, 20) .padding(.top, 14) - .padding(.bottom, UIDevice.bottomNotch + 110) + .padding(.bottom, UIDevice.bottomNotch) } .background(AppColors.backgroundLight) .navigationTitle("Detalhes do Pedido") @@ -29,7 +29,7 @@ struct OrderDetailsView: View { reorderButton .padding(.horizontal, 20) .padding(.top, 10) - .padding(.bottom, max(10, UIDevice.bottomNotch)) + .padding(.bottom, UIDevice.bottomNotch + 60) } .background(AppColors.backgroundLight.opacity(0.94)) } diff --git a/pedi-foods/Sources/PediFoods/Views/Main/OrdersView.swift b/pedi-foods/Sources/PediFoods/Views/Main/OrdersView.swift index 2f0b770..607f064 100644 --- a/pedi-foods/Sources/PediFoods/Views/Main/OrdersView.swift +++ b/pedi-foods/Sources/PediFoods/Views/Main/OrdersView.swift @@ -53,18 +53,27 @@ struct OrdersView: View { orderId: context.orderId, initialShortId: context.shortId, fallbackPaymentMethod: context.paymentMethod, - fallbackTotal: context.total + fallbackTotal: context.total, + routeIntent: context.intent ) } } private func orderCard(_ order: AppOrderSummary) -> some View { let status = orderVisualStatus(for: order) - let route = OrderRouteContext( + let detailsRoute = OrderRouteContext( orderId: trackingOrderId(for: order), shortId: order.shortId, paymentMethod: order.paymentMethod, - total: order.total + total: order.total, + intent: .details + ) + let trackingRoute = OrderRouteContext( + orderId: trackingOrderId(for: order), + shortId: order.shortId, + paymentMethod: order.paymentMethod, + total: order.total, + intent: .tracking ) return VStack(alignment: .leading, spacing: 14) { @@ -121,7 +130,7 @@ struct OrdersView: View { HStack(spacing: 12) { Button(status.isCanceled ? "Ajuda" : "Ver Detalhes") { - selectedOrderRoute = route + selectedOrderRoute = detailsRoute } .font(AppTypography.heading3) .foregroundStyle(AppColors.textMuted) @@ -134,7 +143,7 @@ struct OrdersView: View { Button { if status.isInProgress { - selectedOrderRoute = route + selectedOrderRoute = trackingRoute return } SnackbarCenter.shared.show( @@ -464,11 +473,18 @@ struct OrdersView: View { } struct OrderRouteContext: Identifiable, Hashable { - var id: String { orderId } + var id: String { "\(orderId)|\(intent.rawValue)" } let orderId: String let shortId: String? let paymentMethod: String? let total: Double? + let intent: OrderRouteIntent +} + +enum OrderRouteIntent: String, Hashable { + case details + case tracking + case auto } private enum OrderRowStatusStyle { @@ -584,6 +600,7 @@ struct OrderEntryDestinationView: View { let initialShortId: String? let fallbackPaymentMethod: String? let fallbackTotal: Double? + let routeIntent: OrderRouteIntent @State var isResolvingRoute = true @State var didResolve = false @@ -643,8 +660,16 @@ struct OrderEntryDestinationView: View { func resolveRoute() async { defer { isResolvingRoute = false } + if routeIntent == .tracking { + return + } + let order = await fetchOrderForRouting() guard let order else { return } + if routeIntent == .details { + orderDetails = order + return + } if shouldOpenOrderDetails(for: order) { orderDetails = order return