@@ -17,97 +17,89 @@ struct TaxEducationalDialogView: View {
1717 Color . black. opacity ( Layout . backgroundOpacity) . edgesIgnoringSafeArea ( . all)
1818
1919 VStack {
20- GeometryReader { geometry in
21- VStack ( spacing: 0 ) {
22- VStack {
23- ScrollView {
24- VStack ( alignment: . center, spacing: Layout . verticalSpacing) {
25- Text ( Localization . title)
26- . headlineStyle ( )
20+ ScrollView {
21+ VStack ( alignment: . center, spacing: Layout . verticalSpacing) {
22+ Text ( Localization . title)
23+ . headlineStyle ( )
2724
28- Text ( Localization . bodyFirstParagraph)
29- . bodyStyle ( )
30- . fixedSize ( horizontal: false , vertical: true )
31-
32- Text ( Localization . bodySecondParagraph)
33- . bodyStyle ( )
25+ Text ( Localization . bodyFirstParagraph)
26+ . bodyStyle ( )
27+ . fixedSize ( horizontal: false , vertical: true )
3428
35- VStack ( alignment: . leading, spacing: Layout . verticalSpacing) {
36- Divider ( )
37- . frame ( height: Layout . dividerHeight)
38- . foregroundColor ( Color ( . opaqueSeparator) )
29+ Text ( Localization . bodySecondParagraph)
30+ . bodyStyle ( )
3931
40- if let explanatoryText = viewModel. taxBasedOnSettingExplanatoryText {
41- Text ( explanatoryText )
42- . bodyStyle ( )
43- . fixedSize ( horizontal : false , vertical : true )
44- }
32+ if viewModel. taxLines . isNotEmpty {
33+ VStack ( alignment : . leading , spacing : Layout . verticalSpacing ) {
34+ Divider ( )
35+ . frame ( height : Layout . dividerHeight )
36+ . foregroundColor ( Color ( . opaqueSeparator ) )
4537
46- ForEach ( viewModel. taxLines, id: \. title) { taxLine in
47- AdaptiveStack ( horizontalAlignment: . leading, spacing: Layout . taxLinesInnerSpacing) {
48- Text ( taxLine. title)
49- . font ( . body)
50- . fontWeight ( . semibold)
51- . multilineTextAlignment ( . leading)
52- . frame ( maxWidth: . infinity, alignment: . leading)
38+ if let explanatoryText = viewModel. taxBasedOnSettingExplanatoryText {
39+ Text ( explanatoryText)
40+ . bodyStyle ( )
41+ . fixedSize ( horizontal: false , vertical: true )
42+ }
5343
54- Text ( taxLine. value )
55- . font ( . body )
56- . fontWeight ( . semibold )
57- . multilineTextAlignment ( . trailing )
58- . frame ( width : nil , alignment : . trailing )
59- }
60- }
44+ ForEach ( viewModel . taxLines , id : \ . title ) { taxLine in
45+ AdaptiveStack ( horizontalAlignment : . leading , spacing : Layout . taxLinesInnerSpacing ) {
46+ Text ( taxLine . title )
47+ . font ( . body )
48+ . fontWeight ( . semibold )
49+ . multilineTextAlignment ( . leading )
50+ . frame ( maxWidth : . infinity , alignment : . leading )
6151
62- Divider ( )
63- . frame ( height: Layout . dividerHeight)
64- . foregroundColor ( Color ( . opaqueSeparator) )
52+ Text ( taxLine. value)
53+ . font ( . body)
54+ . fontWeight ( . semibold)
55+ . multilineTextAlignment ( . trailing)
56+ . frame ( width: nil , alignment: . trailing)
6557 }
66- . renderedIf ( viewModel . taxLines . isNotEmpty )
58+ }
6759
68- Button {
69- viewModel. onGoToWpAdminButtonTapped ( )
70- showingWPAdminWebview = true
71- } label: {
72- Label {
73- Text ( Localization . editTaxRatesInAdminButtonTitle)
74- . font ( . body)
75- . fontWeight ( . bold)
76- } icon: {
77- Image ( systemName: " arrow.up.forward.square " )
78- . resizable ( )
79- . frame ( width: Layout . externalLinkImageSize * scale,
80- height: Layout . externalLinkImageSize * scale)
81- }
82- }
83- . buttonStyle ( PrimaryButtonStyle ( ) )
84- . safariSheet (
85- isPresented: $showingWPAdminWebview,
86- url: viewModel. wpAdminTaxSettingsURL,
87- onDismiss: {
88- onDismissWpAdminWebView ( )
89- showingWPAdminWebview = false
90- } )
60+ Divider ( )
61+ . frame ( height: Layout . dividerHeight)
62+ . foregroundColor ( Color ( . opaqueSeparator) )
63+ }
64+ }
9165
92- Button {
93- dismiss ( )
94- } label: {
95- Text ( Localization . doneButtonTitle)
96- }
97- . buttonStyle ( SecondaryButtonStyle ( ) )
98- }
99- . padding ( Layout . outterPadding)
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)
10079 }
10180 }
102- . background ( Color ( . systemBackground) )
103- . cornerRadius ( Layout . cornerRadius)
104- . padding ( Layout . outterPadding)
105- . frame ( maxWidth: . infinity, alignment: . center)
106- . frame ( minHeight: geometry. size. height)
107- . frame ( width: geometry. size. width)
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 ( ) )
10896 }
97+ . padding ( Layout . outterPadding)
10998 }
11099 }
100+ . background ( Color ( . systemBackground) )
101+ . cornerRadius ( Layout . cornerRadius)
102+ . padding ( Layout . outterPadding)
111103 }
112104 }
113105}
0 commit comments