|
1 | 1 | import SwiftUI |
2 | 2 |
|
3 | 3 | struct PointOfSaleSettingsHelpDetailView: View { |
| 4 | + @State private var showProductRestrictions = false |
| 5 | + @State private var showDocumentation = false |
| 6 | + @State private var showSupport = false |
| 7 | + |
4 | 8 | var body: some View { |
5 | 9 | NavigationStack { |
6 | 10 | VStack(alignment: .leading) { |
7 | | - Text("Help Settings") |
8 | | - .font(.title2) |
9 | | - Text("Help-related configuration") |
10 | | - .font(.caption) |
11 | | - .foregroundStyle(.secondary) |
| 11 | + List { |
| 12 | + Button { |
| 13 | + showProductRestrictions = true |
| 14 | + } label: { |
| 15 | + HStack(alignment: .firstTextBaseline) { |
| 16 | + Image(systemName: "magnifyingglass") |
| 17 | + .font(.posBodyLargeRegular()) |
| 18 | + VStack(alignment: .leading, spacing: POSPadding.xSmall) { |
| 19 | + Text(Localization.productRestrictionsInfo) |
| 20 | + .font(.posBodyLargeRegular()) |
| 21 | + Text(Localization.productRestrictionsInfoSubtitle) |
| 22 | + .font(.posBodyMediumRegular()) |
| 23 | + .foregroundStyle(.secondary) |
| 24 | + } |
| 25 | + } |
| 26 | + } |
| 27 | + .buttonStyle(.plain) |
| 28 | + Button { |
| 29 | + showDocumentation = true |
| 30 | + } label: { |
| 31 | + HStack(alignment: .firstTextBaseline) { |
| 32 | + Image(systemName: "doc.text") |
| 33 | + .font(.posBodyLargeRegular()) |
| 34 | + VStack(alignment: .leading, spacing: POSPadding.xSmall) { |
| 35 | + Text(Localization.documentationTitle) |
| 36 | + .font(.posBodyLargeRegular()) |
| 37 | + Text(Localization.documentationSubtitle) |
| 38 | + .font(.posBodyMediumRegular()) |
| 39 | + .foregroundStyle(.secondary) |
| 40 | + } |
| 41 | + } |
| 42 | + } |
| 43 | + .buttonStyle(.plain) |
| 44 | + |
| 45 | + Button { |
| 46 | + showSupport = true |
| 47 | + } label: { |
| 48 | + HStack(alignment: .firstTextBaseline) { |
| 49 | + Image(systemName: "questionmark") |
| 50 | + .font(.posBodyLargeRegular()) |
| 51 | + VStack(alignment: .leading, spacing: POSPadding.xSmall) { |
| 52 | + Text(Localization.getSupportTitle) |
| 53 | + .font(.posBodyLargeRegular()) |
| 54 | + Text(Localization.getSupportSubtitle) |
| 55 | + .font(.posBodyMediumRegular()) |
| 56 | + .foregroundStyle(.secondary) |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | + .buttonStyle(.plain) |
| 61 | + } |
12 | 62 | } |
13 | 63 | .padding() |
14 | 64 | } |
| 65 | + .posModal(isPresented: $showProductRestrictions) { |
| 66 | + // TODO: Remove copy on POSFloatingControlView.documentationView |
| 67 | + // WOOMOB-1168 |
| 68 | + SimpleProductsOnlyInformation(isPresented: $showProductRestrictions) |
| 69 | + } |
| 70 | + .posFullScreenCover(isPresented: $showDocumentation) { |
| 71 | + // TODO: Remove copy on PointOfSaleDashboardView.documentationView |
| 72 | + // WOOMOB-1168 |
| 73 | + SafariView(url: WooConstants.URLs.pointOfSaleDocumentation.asURL()) |
| 74 | + |
| 75 | + } |
| 76 | + .posFullScreenCover(isPresented: $showSupport) { |
| 77 | + // TODO: Remove copy on PointOfSaleDashboardView.supportForm |
| 78 | + // WOOMOB-1168 |
| 79 | + supportForm |
| 80 | + .interactiveDismissDisabled(true) |
| 81 | + } |
| 82 | + } |
| 83 | +} |
| 84 | + |
| 85 | +private extension PointOfSaleSettingsHelpDetailView { |
| 86 | + enum Constants { |
| 87 | + static let supportTag = "origin:point-of-sale" |
| 88 | + } |
| 89 | + |
| 90 | + enum Localization { |
| 91 | + static let productRestrictionsInfo = NSLocalizedString( |
| 92 | + "PointOfSaleSettingsHelpDetailView.help.productRestrictionsInfo.button.title", |
| 93 | + value: "Where are my products?", |
| 94 | + comment: "The title of the menu button to view product restrictions info, shown in settings. " + |
| 95 | + "We only show simple and variable products in POS, this shows a modal to help explain that limitation." |
| 96 | + ) |
| 97 | + |
| 98 | + static let productRestrictionsInfoSubtitle = NSLocalizedString( |
| 99 | + "PointOfSaleSettingsHelpDetailView.help.productRestrictionsInfo.button.subtitle", |
| 100 | + value: "Learn about which products are supported in POS", |
| 101 | + comment: "The subtitle of the menu button to view product restrictions info, shown in settings. " + |
| 102 | + "We only show simple and variable products in POS, this shows a modal to help explain that limitation." |
| 103 | + ) |
| 104 | + |
| 105 | + static let documentationTitle = NSLocalizedString( |
| 106 | + "PointOfSaleSettingsHelpDetailView.help.documentation.button.subtitle", |
| 107 | + value: "Documentation", |
| 108 | + comment: "The title of the menu button to view documentation, shown in settings." |
| 109 | + ) |
| 110 | + |
| 111 | + static let documentationSubtitle = NSLocalizedString( |
| 112 | + "PointOfSaleSettingsHelpDetailView.help.documentation.button.subtitle", |
| 113 | + value: "View guides and tutorials", |
| 114 | + comment: "The subtitle of the menu button to view documentation, shown in settings." |
| 115 | + ) |
| 116 | + |
| 117 | + static let getSupportTitle = NSLocalizedString( |
| 118 | + "PointOfSaleSettingsHelpDetailView.help.getSupport.button.subtitle", |
| 119 | + value: "Get Support", |
| 120 | + comment: "The title of the menu button to contact support, shown in settings." |
| 121 | + ) |
| 122 | + |
| 123 | + static let getSupportSubtitle = NSLocalizedString( |
| 124 | + "PointOfSaleSettingsHelpDetailView.help.getSupport.button.subtitle", |
| 125 | + value: "Contact our support team", |
| 126 | + comment: "The subtitle of the menu button to contact support, shown in settings." |
| 127 | + ) |
| 128 | + |
| 129 | + static let supportCancel = NSLocalizedString( |
| 130 | + "PointOfSaleSettingsHelpDetailView.help.support.cancel", |
| 131 | + value: "Cancel", |
| 132 | + comment: "Button to dismiss the support form from the POS settings." |
| 133 | + ) |
| 134 | + } |
| 135 | + |
| 136 | + var supportForm: some View { |
| 137 | + NavigationView { |
| 138 | + SupportForm(isPresented: $showSupport, |
| 139 | + viewModel: SupportFormViewModel(sourceTag: Constants.supportTag, |
| 140 | + defaultSite: ServiceLocator.stores.sessionManager.defaultSite)) |
| 141 | + .toolbar { |
| 142 | + ToolbarItem(placement: .cancellationAction) { |
| 143 | + Button(Localization.supportCancel) { |
| 144 | + showSupport = false |
| 145 | + } |
| 146 | + } |
| 147 | + } |
| 148 | + } |
| 149 | + .navigationViewStyle(.stack) |
15 | 150 | } |
16 | 151 | } |
0 commit comments