Skip to content

Commit 0277b25

Browse files
committed
update help view to use POSSettingsCard
1 parent 7ef386e commit 0277b25

File tree

1 file changed

+32
-79
lines changed

1 file changed

+32
-79
lines changed

Modules/Sources/PointOfSale/Presentation/Settings/PointOfSaleSettingsHelpDetailView.swift

Lines changed: 32 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,100 +2,53 @@ import SwiftUI
22
import struct WooFoundation.SafariView
33

44
struct PointOfSaleSettingsHelpDetailView: View {
5-
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
65
@Environment(\.posExternalViews) private var externalViews
76

87
@State private var showProductRestrictions = false
98
@State private var showDocumentation = false
109
@State private var showSupport = false
1110

1211
private var backgroundColor: Color {
13-
Color.posOnSecondaryContainer
12+
Color.posSurface
1413
}
1514

1615
var body: some View {
1716
NavigationStack {
18-
POSPageHeaderView(title: Localization.helpTitle)
19-
.foregroundColor(.posSurface)
20-
.accessibilityAddTraits(.isHeader)
21-
List {
22-
Button {
23-
showProductRestrictions = true
24-
} label: {
25-
HStack(spacing: POSSpacing.medium) {
26-
Image(systemName: "magnifyingglass")
27-
.font(.posBodyLargeRegular())
28-
.accessibilityHidden(true)
29-
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
30-
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
31-
Text(Localization.productRestrictionsInfo)
32-
.font(.posBodyLargeRegular())
33-
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
34-
Text(Localization.productRestrictionsInfoSubtitle)
35-
.font(.posBodyMediumRegular())
36-
.foregroundStyle(.secondary)
37-
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
38-
}
39-
Spacer()
17+
VStack(spacing: POSSpacing.none) {
18+
POSPageHeaderView(title: Localization.helpTitle)
19+
.foregroundColor(.posSurface)
20+
.accessibilityAddTraits(.isHeader)
21+
22+
ScrollView {
23+
VStack(spacing: POSSpacing.small) {
24+
POSSettingsCard(
25+
title: Localization.productRestrictionsInfo,
26+
subtitle: Localization.productRestrictionsInfoSubtitle,
27+
action: {
28+
showProductRestrictions = true
29+
}
30+
)
31+
32+
POSSettingsCard(
33+
title: Localization.documentationTitle,
34+
subtitle: Localization.documentationSubtitle,
35+
action: {
36+
showDocumentation = true
37+
}
38+
)
39+
40+
POSSettingsCard(
41+
title: Localization.getSupportTitle,
42+
subtitle: Localization.getSupportSubtitle,
43+
action: {
44+
showSupport = true
45+
}
46+
)
4047
}
48+
.padding(.horizontal, POSPadding.medium)
4149
}
42-
.accessibilityAddTraits(.isButton)
43-
.listRowSeparator(.hidden)
44-
.buttonStyle(.plain)
45-
46-
Button {
47-
showDocumentation = true
48-
} label: {
49-
HStack(spacing: POSSpacing.medium) {
50-
Image(systemName: "doc.text")
51-
.font(.posBodyLargeRegular())
52-
.accessibilityHidden(true)
53-
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
54-
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
55-
Text(Localization.documentationTitle)
56-
.font(.posBodyLargeRegular())
57-
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
58-
Text(Localization.documentationSubtitle)
59-
.font(.posBodyMediumRegular())
60-
.foregroundStyle(.secondary)
61-
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
62-
}
63-
Spacer()
64-
}
65-
}
66-
.accessibilityAddTraits(.isButton)
67-
.listRowSeparator(.hidden)
68-
.buttonStyle(.plain)
69-
70-
Button {
71-
showSupport = true
72-
} label: {
73-
HStack(spacing: POSSpacing.medium) {
74-
Image(systemName: "questionmark")
75-
.font(.posBodyLargeRegular())
76-
.accessibilityHidden(true)
77-
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
78-
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
79-
Text(Localization.getSupportTitle)
80-
.font(.posBodyLargeRegular())
81-
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
82-
Text(Localization.getSupportSubtitle)
83-
.font(.posBodyMediumRegular())
84-
.foregroundStyle(.secondary)
85-
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
86-
}
87-
Spacer()
88-
}
89-
}
90-
.accessibilityAddTraits(.isButton)
91-
.listRowSeparator(.hidden)
92-
.buttonStyle(.plain)
9350
}
94-
.listStyle(.plain)
95-
.scrollContentBackground(.hidden)
9651
.background(backgroundColor)
97-
.listRowBackground(Color.clear)
98-
.listRowSeparator(.hidden)
9952
}
10053
.posModal(isPresented: $showProductRestrictions) {
10154
// TODO: Remove copy on POSFloatingControlView.documentationView

0 commit comments

Comments
 (0)