Skip to content

Commit 57d147c

Browse files
committed
Add WooShippingHazmatDetailView
1 parent ec44733 commit 57d147c

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import SwiftUI
2+
3+
struct WooShippingHazmatDetailView: View {
4+
@Environment(\.dismiss) private var dismiss
5+
6+
@Binding private var isHazardous: Bool
7+
8+
init(isHazardous: Binding<Bool>) {
9+
self._isHazardous = isHazardous
10+
}
11+
12+
var body: some View {
13+
ScrollView {
14+
VStack {
15+
HStack {
16+
Button(Localization.cancel) {
17+
dismiss()
18+
}
19+
.padding(.vertical)
20+
Spacer()
21+
}
22+
23+
Text(Localization.title)
24+
.secondaryTitleStyle()
25+
.bold()
26+
27+
Spacer()
28+
}
29+
.padding(.horizontal)
30+
}
31+
}
32+
}
33+
34+
private extension WooShippingHazmatDetailView {
35+
enum Localization {
36+
static let title = NSLocalizedString(
37+
"wooShippingHazmatDetailView.title",
38+
value: "Are you shipping dangerous goods or hazardous materials?",
39+
comment: "Title of the HAZMAT detail view in the shipping label creation flow"
40+
)
41+
static let cancel = NSLocalizedString(
42+
"wooShippingHazmatDetailView.cancel",
43+
value: "Cancel",
44+
comment: "Button to dismiss the HAZMAT detail view in the shipping label creation flow"
45+
)
46+
}
47+
}
48+
49+
#Preview {
50+
WooShippingHazmatDetailView(isHazardous: .constant(true))
51+
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ struct WooShippingHazmatRow: View {
66

77
@Binding private var isHazardous: Bool
88

9+
@State private var isShowingDetailView = false
10+
911
init(isHazardous: Binding<Bool>, enabled: Bool) {
1012
self._isHazardous = isHazardous
1113
self.enabled = enabled
1214
}
1315

1416
var body: some View {
1517
Button(action: {
16-
// TODO: show sheet
18+
isShowingDetailView = true
1719
}) {
1820
AdaptiveStack {
1921
Text(Localization.hazmatLabel)
@@ -29,6 +31,9 @@ struct WooShippingHazmatRow: View {
2931
}
3032
.buttonStyle(.plain)
3133
.disabled(!enabled)
34+
.sheet(isPresented: $isShowingDetailView) {
35+
WooShippingHazmatDetailView(isHazardous: $isHazardous)
36+
}
3237
}
3338
}
3439

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2793,6 +2793,7 @@
27932793
DEC0293729C418FF00FD0E2F /* ApplicationPasswordAuthorizationWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC0293629C418FF00FD0E2F /* ApplicationPasswordAuthorizationWebViewController.swift */; };
27942794
DEC0293A29C41BC500FD0E2F /* ApplicationPasswordAuthorizationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC0293929C41BC500FD0E2F /* ApplicationPasswordAuthorizationViewModel.swift */; };
27952795
DEC1508227F450AC00F4487C /* CouponAllowedEmails.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC1508127F450AC00F4487C /* CouponAllowedEmails.swift */; };
2796+
DEC17AE02D82C513005A6E6D /* WooShippingHazmatDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC17ADF2D82C513005A6E6D /* WooShippingHazmatDetailView.swift */; };
27962797
DEC2961F26BD1605005A056B /* ShippingLabelCustomsFormListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC2961E26BD1605005A056B /* ShippingLabelCustomsFormListViewModel.swift */; };
27972798
DEC2962126BD1627005A056B /* ShippingLabelCustomsFormList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC2962026BD1627005A056B /* ShippingLabelCustomsFormList.swift */; };
27982799
DEC2962326BD4E6E005A056B /* ShippingLabelCustomsFormInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC2962226BD4E6E005A056B /* ShippingLabelCustomsFormInput.swift */; };
@@ -5994,6 +5995,7 @@
59945995
DEC0293629C418FF00FD0E2F /* ApplicationPasswordAuthorizationWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationPasswordAuthorizationWebViewController.swift; sourceTree = "<group>"; };
59955996
DEC0293929C41BC500FD0E2F /* ApplicationPasswordAuthorizationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationPasswordAuthorizationViewModel.swift; sourceTree = "<group>"; };
59965997
DEC1508127F450AC00F4487C /* CouponAllowedEmails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponAllowedEmails.swift; sourceTree = "<group>"; };
5998+
DEC17ADF2D82C513005A6E6D /* WooShippingHazmatDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WooShippingHazmatDetailView.swift; sourceTree = "<group>"; };
59975999
DEC2961E26BD1605005A056B /* ShippingLabelCustomsFormListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShippingLabelCustomsFormListViewModel.swift; sourceTree = "<group>"; };
59986000
DEC2962026BD1627005A056B /* ShippingLabelCustomsFormList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShippingLabelCustomsFormList.swift; sourceTree = "<group>"; };
59996001
DEC2962226BD4E6E005A056B /* ShippingLabelCustomsFormInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShippingLabelCustomsFormInput.swift; sourceTree = "<group>"; };
@@ -12338,6 +12340,7 @@
1233812340
isa = PBXGroup;
1233912341
children = (
1234012342
CE7B4A5A2CA1BF9900F764EB /* WooShippingHazmatRow.swift */,
12343+
DEC17ADF2D82C513005A6E6D /* WooShippingHazmatDetailView.swift */,
1234112344
);
1234212345
path = "WooShipping Hazmat Section";
1234312346
sourceTree = "<group>";
@@ -15554,6 +15557,7 @@
1555415557
025C00BA25514A7100FAC222 /* BarcodeScannerFrameScaler.swift in Sources */,
1555515558
EE9D031B2B89E4470077CED1 /* FilterOrdersByProduct+Analytics.swift in Sources */,
1555615559
20C6E7512CDE4AEA00CD124C /* ItemListState.swift in Sources */,
15560+
DEC17AE02D82C513005A6E6D /* WooShippingHazmatDetailView.swift in Sources */,
1555715561
86967D812B4E21C600C20CA8 /* BlazeAddParameterViewModel.swift in Sources */,
1555815562
EE45E2B92A409BA40085F227 /* ProductDescriptionAITooltipUseCase.swift in Sources */,
1555915563
DE02ABBA2B56981C008E0AC4 /* BlazeConfirmPaymentView.swift in Sources */,

0 commit comments

Comments
 (0)