Skip to content

Commit 805a719

Browse files
authored
[Order Creation - Taxes] Fix Scroll View in Tax Modal (#15997)
2 parents 755dbd2 + ab1ea36 commit 805a719

File tree

1 file changed

+70
-69
lines changed

1 file changed

+70
-69
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Creation/PaymentSection/Taxes/TaxEducationalDialogView.swift

Lines changed: 70 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -16,89 +16,90 @@ struct TaxEducationalDialogView: View {
1616
ZStack {
1717
Color.black.opacity(Layout.backgroundOpacity).edgesIgnoringSafeArea(.all)
1818

19-
VStack {
20-
GeometryReader { geometry in
21-
ScrollView {
22-
VStack(alignment: .center, spacing: Layout.verticalSpacing) {
23-
Text(Localization.title)
24-
.headlineStyle()
25-
Text(Localization.bodyFirstParagraph)
26-
.bodyStyle()
27-
.fixedSize(horizontal: false, vertical: true)
28-
Text(Localization.bodySecondParagraph)
29-
.bodyStyle()
19+
VStack {
20+
ScrollView {
21+
VStack(alignment: .center, spacing: Layout.verticalSpacing) {
22+
Text(Localization.title)
23+
.headlineStyle()
3024

25+
Text(Localization.bodyFirstParagraph)
26+
.bodyStyle()
27+
.fixedSize(horizontal: false, vertical: true)
3128

32-
VStack(alignment: .leading, spacing: Layout.verticalSpacing) {
33-
Divider()
34-
.frame(height: Layout.dividerHeight)
35-
.foregroundColor(Color(.opaqueSeparator))
36-
if let taxBasedOnSettingExplanatoryText = viewModel.taxBasedOnSettingExplanatoryText {
37-
Text(taxBasedOnSettingExplanatoryText)
38-
.bodyStyle()
39-
.fixedSize(horizontal: false, vertical: true)
40-
}
29+
Text(Localization.bodySecondParagraph)
30+
.bodyStyle()
4131

42-
ForEach(viewModel.taxLines, id: \.title) { taxLine in
43-
HStack {
44-
AdaptiveStack(horizontalAlignment: .leading, spacing: Layout.taxLinesInnerSpacing) {
45-
Text(taxLine.title)
46-
.font(.body)
47-
.fontWeight(.semibold)
48-
.multilineTextAlignment(.leading)
49-
.frame(maxWidth: .infinity, alignment: .leading)
32+
if viewModel.taxLines.isNotEmpty {
33+
VStack(alignment: .leading, spacing: Layout.verticalSpacing) {
34+
Divider()
35+
.frame(height: Layout.dividerHeight)
36+
.foregroundColor(Color(.opaqueSeparator))
5037

51-
Text(taxLine.value)
52-
.font(.body)
53-
.fontWeight(.semibold)
54-
.multilineTextAlignment(.trailing)
55-
.frame(width: nil, alignment: .trailing)
56-
}
57-
}
58-
}
59-
Divider()
60-
.frame(height: Layout.dividerHeight)
61-
.foregroundColor(Color(.opaqueSeparator))
62-
}.renderedIf(viewModel.taxLines.isNotEmpty)
38+
if let explanatoryText = viewModel.taxBasedOnSettingExplanatoryText {
39+
Text(explanatoryText)
40+
.bodyStyle()
41+
.fixedSize(horizontal: false, vertical: true)
42+
}
6343

64-
Button {
65-
viewModel.onGoToWpAdminButtonTapped()
66-
showingWPAdminWebview = true
67-
} label: {
68-
Label {
69-
Text(Localization.editTaxRatesInAdminButtonTitle)
44+
ForEach(viewModel.taxLines, id: \.title) { taxLine in
45+
AdaptiveStack(horizontalAlignment: .leading, spacing: Layout.taxLinesInnerSpacing) {
46+
Text(taxLine.title)
7047
.font(.body)
71-
.fontWeight(.bold)
72-
} icon: {
73-
Image(systemName: "arrow.up.forward.square")
74-
.resizable()
75-
.frame(width: Layout.externalLinkImageSize * scale, height: Layout.externalLinkImageSize * scale)
48+
.fontWeight(.semibold)
49+
.multilineTextAlignment(.leading)
50+
.frame(maxWidth: .infinity, alignment: .leading)
51+
52+
Text(taxLine.value)
53+
.font(.body)
54+
.fontWeight(.semibold)
55+
.multilineTextAlignment(.trailing)
56+
.frame(width: nil, alignment: .trailing)
7657
}
7758
}
78-
.buttonStyle(PrimaryButtonStyle())
79-
.safariSheet(isPresented: $showingWPAdminWebview, url: viewModel.wpAdminTaxSettingsURL, onDismiss: {
80-
onDismissWpAdminWebView()
81-
showingWPAdminWebview = false
82-
})
8359

84-
Button {
85-
dismiss()
86-
} label: {
87-
Text(Localization.doneButtonTitle)
88-
}
89-
.buttonStyle(SecondaryButtonStyle())
60+
Divider()
61+
.frame(height: Layout.dividerHeight)
62+
.foregroundColor(Color(.opaqueSeparator))
9063
}
91-
.padding(Layout.outterPadding)
92-
.frame(maxWidth: .infinity, alignment: .center)
93-
.background(Color(.systemBackground))
94-
.cornerRadius(Layout.cornerRadius)
95-
.frame(width: geometry.size.width) // Make the scroll view full-width
96-
.frame(minHeight: geometry.size.height)
9764
}
65+
66+
Button {
67+
viewModel.onGoToWpAdminButtonTapped()
68+
showingWPAdminWebview = true
69+
} label: {
70+
Label {
71+
Text(Localization.editTaxRatesInAdminButtonTitle)
72+
.font(.body)
73+
.fontWeight(.bold)
74+
} icon: {
75+
Image(systemName: "arrow.up.forward.square")
76+
.resizable()
77+
.frame(width: Layout.externalLinkImageSize * scale,
78+
height: Layout.externalLinkImageSize * scale)
79+
}
80+
}
81+
.buttonStyle(PrimaryButtonStyle())
82+
.safariSheet(
83+
isPresented: $showingWPAdminWebview,
84+
url: viewModel.wpAdminTaxSettingsURL,
85+
onDismiss: {
86+
onDismissWpAdminWebView()
87+
showingWPAdminWebview = false
88+
})
89+
90+
Button {
91+
dismiss()
92+
} label: {
93+
Text(Localization.doneButtonTitle)
94+
}
95+
.buttonStyle(SecondaryButtonStyle())
96+
}
97+
.padding(Layout.outterPadding)
9898
}
9999
}
100+
.background(Color(.systemBackground))
101+
.cornerRadius(Layout.cornerRadius)
100102
.padding(Layout.outterPadding)
101-
.frame(maxWidth: .infinity, alignment: .center)
102103
}
103104
}
104105
}

0 commit comments

Comments
 (0)