Skip to content

Commit 202f336

Browse files
authored
Display "POS" label in Most recent orders section (#16006)
2 parents 2f47cf8 + ed7c78b commit 202f336

File tree

2 files changed

+35
-9
lines changed

2 files changed

+35
-9
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [internal] Remove oldest (<30) core data models [https://github.com/woocommerce/woocommerce-ios/pull/15987]
77
- [*] Jetpack setup: Native experience for the connection step [https://github.com/woocommerce/woocommerce-ios/pull/15983]
88
- [*] Payments: Updated the In-Person Payments `Learn More` redirection to display the correct page based on the selected payment provider [https://github.com/woocommerce/woocommerce-ios/pull/15998]
9+
- [*] Add "POS" label in Most recent orders in My store dashboard [https://github.com/woocommerce/woocommerce-ios/pull/16006]
910

1011
23.0
1112
-----

WooCommerce/Classes/ViewRelated/Dashboard/Orders/LastOrderDashboardRow.swift

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import SwiftUI
22
import Yosemite
33
import WooFoundation
4+
import NetworkingCore
5+
import Experiments
46

57
/// Used in Last Order Dashboard card
68
///
@@ -29,13 +31,25 @@ struct LastOrderDashboardRow: View {
2931
Spacer()
3032

3133
VStack(alignment: .trailing, spacing: Layout.spacing) {
32-
Text(viewModel.statusDescription)
33-
.foregroundStyle(.black)
34-
.captionStyle()
35-
.padding(.horizontal, Layout.Status.hPadding)
36-
.padding(.vertical, Layout.Status.vPadding)
37-
.background(viewModel.statusBackgroundColor)
38-
.cornerRadius(Layout.Status.cornerRadius)
34+
HStack(spacing: Layout.badgeSpacing) {
35+
Text(viewModel.statusDescription)
36+
.foregroundStyle(.black)
37+
.footnoteStyle()
38+
.padding(.horizontal, Layout.Status.hPadding)
39+
.padding(.vertical, Layout.Status.vPadding)
40+
.background(viewModel.statusBackgroundColor)
41+
.cornerRadius(Layout.Status.cornerRadius)
42+
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.pointOfSaleOrdersi1),
43+
viewModel.isPOSOrder {
44+
Text(viewModel.salesChannelText)
45+
.foregroundStyle(Color(uiColor: Layout.salesChannelLabelTextColor))
46+
.footnoteStyle()
47+
.padding(.horizontal, Layout.Status.hPadding)
48+
.padding(.vertical, Layout.Status.vPadding)
49+
.background(Color(uiColor: Layout.salesChannelLabelBackgroundColor))
50+
.cornerRadius(Layout.Status.cornerRadius)
51+
}
52+
}
3953

4054
Text(viewModel.total)
4155
.bodyStyle()
@@ -56,11 +70,14 @@ private extension LastOrderDashboardRow {
5670
enum Layout {
5771
static let padding: CGFloat = 16
5872
static let spacing: CGFloat = 8
73+
static let badgeSpacing: CGFloat = 6
74+
static let salesChannelLabelBackgroundColor = UIColor.withColorStudio(.wooCommercePurple, shade: .shade10)
75+
static let salesChannelLabelTextColor = UIColor.withColorStudio(.wooCommercePurple, shade: .shade80)
5976

6077
enum Status {
6178
static let hPadding: CGFloat = 8
62-
static let vPadding: CGFloat = 2
63-
static let cornerRadius: CGFloat = 2
79+
static let vPadding: CGFloat = 4
80+
static let cornerRadius: CGFloat = 4
6481
}
6582
}
6683
}
@@ -69,6 +86,14 @@ struct LastOrderDashboardRowViewModel {
6986
private let currencyFormatter = CurrencyFormatter(currencySettings: ServiceLocator.currencySettings)
7087
let order: Order
7188

89+
var isPOSOrder: Bool {
90+
order.salesChannel == .pointOfSale
91+
}
92+
93+
var salesChannelText: String {
94+
order.salesChannel?.description ?? ""
95+
}
96+
7297
var number: String {
7398
"#\(order.number)"
7499
}

0 commit comments

Comments
 (0)