Skip to content

Commit ef8776b

Browse files
authored
Merge pull request #5885 from woocommerce/feat/5745-dashboard-design-polishes
My store tab design/technical updates (before design review)
2 parents 6ddd16e + 45e2e90 commit ef8776b

File tree

6 files changed

+32
-7
lines changed

6 files changed

+32
-7
lines changed

WooCommerce/Classes/ViewRelated/Dashboard/DashboardViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ final class DashboardViewController: UIViewController {
136136
private extension DashboardViewController {
137137

138138
func configureView() {
139-
view.backgroundColor = .listBackground
139+
view.backgroundColor = ServiceLocator.featureFlagService.isFeatureFlagEnabled(.myStoreTabUpdates) ?
140+
Constants.backgroundColor: Constants.legacyBackgroundColor
140141
}
141142

142143
func configureNavigation() {
@@ -478,6 +479,8 @@ private extension DashboardViewController {
478479
enum Constants {
479480
static let bannerBottomMargin = CGFloat(8)
480481
static let horizontalMargin = CGFloat(20)
482+
static let backgroundColor: UIColor = .systemBackground
483+
static let legacyBackgroundColor: UIColor = .listBackground
481484
static let collapsedNavigationBarHeight = CGFloat(44)
482485
}
483486
}

WooCommerce/Classes/ViewRelated/Dashboard/MyStore/Cells/NoPeriodDataTableViewCell.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import UIKit
44

55
/// Displayed whenever there is no top performer data for a given period (granularity)
66
///
7-
class NoPeriodDataTableViewCell: UITableViewCell {
7+
final class NoPeriodDataTableViewCell: UITableViewCell {
88
@IBOutlet private weak var mainImageView: UIImageView!
99

1010
/// LegendLabel: To be displayed below the ImageView.
@@ -21,7 +21,15 @@ class NoPeriodDataTableViewCell: UITableViewCell {
2121

2222
override func awakeFromNib() {
2323
super.awakeFromNib()
24-
contentView.backgroundColor = .listForeground
24+
contentView.backgroundColor = ServiceLocator.featureFlagService.isFeatureFlagEnabled(.myStoreTabUpdates) ?
25+
Constants.backgroundColor: Constants.legacyBackgroundColor
2526
backgroundColor = .listForeground
2627
}
2728
}
29+
30+
private extension NoPeriodDataTableViewCell {
31+
enum Constants {
32+
static let backgroundColor: UIColor = .systemBackground
33+
static let legacyBackgroundColor: UIColor = .listForeground
34+
}
35+
}

WooCommerce/Classes/ViewRelated/Dashboard/MyStore/Cells/ProductTableViewCell.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ final class ProductTableViewCell: UITableViewCell {
5858
accessoryLabel.applyBodyStyle()
5959
detailLabel.applyFootnoteStyle()
6060
applyProductImageStyle()
61-
backgroundColor = .listForeground
61+
backgroundColor = ServiceLocator.featureFlagService.isFeatureFlagEnabled(.myStoreTabUpdates) ?
62+
Constants.backgroundColor: Constants.legacyBackgroundColor
6263
bottomBorderView.backgroundColor = .systemColor(.separator)
6364
selectionStyle = .default
6465
}
@@ -80,12 +81,14 @@ extension ProductTableViewCell {
8081
let detailText: String?
8182
let accessoryText: String?
8283
let imageURL: String?
84+
let backgroundColor: UIColor
8385
}
8486

8587
func configure(viewModel: ViewModel, imageService: ImageService) {
8688
nameText = viewModel.nameText
8789
detailText = viewModel.detailText
8890
accessoryText = viewModel.accessoryText
91+
backgroundColor = viewModel.backgroundColor
8992

9093
/// Set `center` contentMode to not distort the placeholder aspect ratio.
9194
/// After a successful image download set the contentMode to `scaleAspectFill`
@@ -116,13 +119,15 @@ extension ProductTableViewCell.ViewModel {
116119
statsItem?.totalString(currencyFormatter: currencyFormatter) ?? ""
117120
)
118121
accessoryText = "\(statsItem?.quantity ?? 0)"
122+
backgroundColor = ProductTableViewCell.Constants.backgroundColor
119123
} else {
120124
detailText = String.localizedStringWithFormat(
121125
NSLocalizedString("Total orders: %ld",
122126
comment: "Top performers — label for the total number of products ordered"),
123127
statsItem?.quantity ?? 0
124128
)
125129
accessoryText = statsItem?.formattedTotalString
130+
backgroundColor = ProductTableViewCell.Constants.legacyBackgroundColor
126131
}
127132
}
128133
}
@@ -136,6 +141,11 @@ private extension ProductTableViewCell {
136141
static let borderColor = UIColor.border
137142
static let backgroundColor = UIColor.listForeground
138143
}
144+
145+
enum Constants {
146+
static let backgroundColor: UIColor = .systemBackground
147+
static let legacyBackgroundColor: UIColor = .listForeground
148+
}
139149
}
140150

141151
private extension TopEarnerStatsItem {

WooCommerce/Classes/ViewRelated/Dashboard/Stats v4/StoreStatsAndTopPerformersPeriodViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ private extension StoreStatsAndTopPerformersPeriodViewController {
273273

274274
func configureSubviews() {
275275
view.addSubview(scrollView)
276+
view.backgroundColor = Constants.backgroundColor
276277
view.pinSubviewToSafeArea(scrollView)
277278

278279
scrollView.refreshControl = refreshControl
@@ -356,5 +357,6 @@ private extension StoreStatsAndTopPerformersPeriodViewController {
356357
enum Constants {
357358
static let storeStatsPeriodViewHeight: CGFloat = 444
358359
static let ghostStyle: GhostStyle = .wooDefaultGhostStyle
360+
static let backgroundColor: UIColor = .systemBackground
359361
}
360362
}

WooCommerce/Classes/ViewRelated/Dashboard/Stats v4/StoreStatsAndTopPerformersViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private extension StoreStatsAndTopPerformersViewController {
276276
}
277277

278278
func configureView() {
279-
view.backgroundColor = .listBackground
279+
view.backgroundColor = Constants.backgroundColor
280280
configureButtonBarBottomBorder()
281281

282282
// Disables any content inset adjustment since `XLPagerTabStrip` doesn't seem to support safe area insets.
@@ -477,5 +477,6 @@ private extension StoreStatsAndTopPerformersViewController {
477477

478478
enum Constants {
479479
static let topEarnerStatsLimit: Int = 5
480+
static let backgroundColor: UIColor = .systemBackground
480481
}
481482
}

WooCommerce/Classes/ViewRelated/Dashboard/Stats v4/StoreStatsV4PeriodViewController.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ private extension StoreStatsV4PeriodViewController {
348348
func configureBarChart() {
349349
lineChartView.marker = StoreStatsChartCircleMarker()
350350
lineChartView.chartDescription?.enabled = false
351-
lineChartView.dragEnabled = true
351+
lineChartView.dragXEnabled = true
352+
lineChartView.dragYEnabled = false
352353
lineChartView.setScaleEnabled(false)
353354
lineChartView.pinchZoomEnabled = false
354355
lineChartView.rightAxis.enabled = false
@@ -698,7 +699,7 @@ private extension StoreStatsV4PeriodViewController {
698699
if hasRevenueData && !hasNegativeRevenueOnly {
699700
let gradientColors = [Constants.chartGradientBottomColor.cgColor, Constants.chartGradientTopColor.cgColor] as CFArray
700701
let gradientColorSpace = CGColorSpaceCreateDeviceRGB()
701-
let locations: [CGFloat] = hasNegativeRevenueOnly ? [1.0, 0.0]: [0.0, 1.0]
702+
let locations: [CGFloat] = [0.0, 1.0]
702703
if let gradient = CGGradient(colorsSpace: gradientColorSpace, colors: gradientColors, locations: locations) {
703704
dataSet.fill = .init(linearGradient: gradient, angle: 90.0)
704705
dataSet.fillAlpha = 1.0

0 commit comments

Comments
 (0)