Skip to content

Commit f1ddaf0

Browse files
committed
Add save button for confirm disabling hazmat
1 parent 18591fd commit f1ddaf0

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShipping Hazmat Section/WooShippingHazmatDetailView.swift

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,25 @@ struct WooShippingHazmatDetailView: View {
9494
}
9595
.toolbarBackground(Color.clear, for: .navigationBar)
9696
}
97+
.safeAreaInset(edge: .bottom) {
98+
VStack {
99+
Button(Localization.save) {
100+
selectionHandler(nil)
101+
dismiss()
102+
}
103+
.buttonStyle(PrimaryButtonStyle())
104+
.padding(Constants.verticalSpacing)
105+
}
106+
.background(Color(.systemBackground))
107+
.renderedIf(selectedCategory != nil && isHazardous == false)
108+
}
97109
.sheet(isPresented: $isShowingCategoryList) {
98110
WooShippingHazmatCategoryList(selectedItem: selectedCategory,
99111
selectionHandler: { category in
100112
selectionHandler(category)
101113
dismiss()
102114
})
103115
}
104-
.onChange(of: isHazardous) { newValue in
105-
if newValue == false {
106-
selectedCategory = nil
107-
}
108-
}
109116
}
110117
}
111118
}
@@ -192,6 +199,11 @@ private extension WooShippingHazmatDetailView {
192199
value: "Category",
193200
comment: "Label for the existing category on the HAZMAT detail view in the shipping label creation flow"
194201
)
202+
static let save = NSLocalizedString(
203+
"wooShippingHazmatDetailView.save",
204+
value: "Save",
205+
comment: "Button to confirm selection on the HAZMAT detail view in the shipping label creation flow"
206+
)
195207
static let detailLine1 = NSLocalizedString(
196208
"wooShippingHazmatDetailView.detailLine1",
197209
value: "Potentially hazardous material includes items such as batteries, dry ice, " +

0 commit comments

Comments
 (0)