Skip to content

Commit 319ac6c

Browse files
committed
Create LegacyTopPerformersSectionHeaderView due to too many changes for the new version.
1 parent 0b41fcc commit 319ac6c

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import UIKit
2+
3+
/// Section header view shown above the top performers data view.
4+
///
5+
class LegacyTopPerformersSectionHeaderView: UIView {
6+
private lazy var label: UILabel = {
7+
return UILabel(frame: .zero)
8+
}()
9+
10+
init(title: String) {
11+
super.init(frame: .zero)
12+
translatesAutoresizingMaskIntoConstraints = false
13+
configureLabel(title: title)
14+
}
15+
16+
required init?(coder aDecoder: NSCoder) {
17+
fatalError("init(coder:) has not been implemented")
18+
}
19+
}
20+
21+
private extension LegacyTopPerformersSectionHeaderView {
22+
func configureLabel(title: String) {
23+
addSubview(label)
24+
25+
label.text = title
26+
27+
label.applyFootnoteStyle()
28+
label.textColor = .listIcon
29+
30+
label.translatesAutoresizingMaskIntoConstraints = false
31+
NSLayoutConstraint.activate([
32+
label.topAnchor.constraint(greaterThanOrEqualTo: topAnchor),
33+
label.leadingAnchor.constraint(equalTo: leadingAnchor, constant: Constants.labelInsets.left),
34+
label.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -Constants.labelInsets.right),
35+
label.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -Constants.labelInsets.bottom)
36+
])
37+
}
38+
}
39+
40+
// MARK: - Constants!
41+
//
42+
private extension LegacyTopPerformersSectionHeaderView {
43+
enum Constants {
44+
static let labelInsets = UIEdgeInsets(top: 0, left: 14, bottom: 6, right: 14)
45+
}
46+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Observables
55

66
/// Container view controller for a stats v4 time range that consists of a scrollable stack view of:
77
/// - Store stats data view (managed by child view controller `OldStoreStatsV4PeriodViewController`)
8-
/// - Top performers header view (`TopPerformersSectionHeaderView`)
8+
/// - Top performers header view (`LegacyTopPerformersSectionHeaderView`)
99
/// - Top performers data view (managed by child view controller `TopPerformerDataViewController`)
1010
///
1111
final class OldStoreStatsAndTopPerformersPeriodViewController: UIViewController {
@@ -287,7 +287,7 @@ private extension OldStoreStatsAndTopPerformersPeriodViewController {
287287
stackView.addArrangedSubviews(inAppFeedbackCardViewsForStackView)
288288

289289
// Top performers header.
290-
let topPerformersHeaderView = TopPerformersSectionHeaderView(title:
290+
let topPerformersHeaderView = LegacyTopPerformersSectionHeaderView(title:
291291
NSLocalizedString("Top Performers",
292292
comment: "Header label for Top Performers section of My Store tab.")
293293
.uppercased())

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
021FAFCF23556D2B00B99241 /* UIView+SubviewsAxis.swift in Sources */ = {isa = PBXBuildFile; fileRef = 021FAFCE23556D2B00B99241 /* UIView+SubviewsAxis.swift */; };
9494
021FB44C24A5E3B00090E144 /* ProductListMultiSelectorSearchUICommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 021FB44B24A5E3B00090E144 /* ProductListMultiSelectorSearchUICommand.swift */; };
9595
0222729227746D8B007D3851 /* OldStoreStatsV4PeriodViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0222729127746D8B007D3851 /* OldStoreStatsV4PeriodViewController.swift */; };
96+
0224B1C82786E69B008F536D /* LegacyTopPerformersSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0224B1C72786E69B008F536D /* LegacyTopPerformersSectionHeaderView.swift */; };
9697
0225C42824768A4C00C5B4F0 /* FilterProductListViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0225C42724768A4C00C5B4F0 /* FilterProductListViewModelTests.swift */; };
9798
0225C42A24768CE900C5B4F0 /* FilterProductListViewModelProductListFilterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0225C42924768CE900C5B4F0 /* FilterProductListViewModelProductListFilterTests.swift */; };
9899
0225C42C2477D0D500C5B4F0 /* ProductFormViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0225C42B2477D0D500C5B4F0 /* ProductFormViewModel.swift */; };
@@ -1679,6 +1680,7 @@
16791680
021FAFCE23556D2B00B99241 /* UIView+SubviewsAxis.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+SubviewsAxis.swift"; sourceTree = "<group>"; };
16801681
021FB44B24A5E3B00090E144 /* ProductListMultiSelectorSearchUICommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductListMultiSelectorSearchUICommand.swift; sourceTree = "<group>"; };
16811682
0222729127746D8B007D3851 /* OldStoreStatsV4PeriodViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OldStoreStatsV4PeriodViewController.swift; sourceTree = "<group>"; };
1683+
0224B1C72786E69B008F536D /* LegacyTopPerformersSectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyTopPerformersSectionHeaderView.swift; sourceTree = "<group>"; };
16821684
0225C42724768A4C00C5B4F0 /* FilterProductListViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterProductListViewModelTests.swift; sourceTree = "<group>"; };
16831685
0225C42924768CE900C5B4F0 /* FilterProductListViewModelProductListFilterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterProductListViewModelProductListFilterTests.swift; sourceTree = "<group>"; };
16841686
0225C42B2477D0D500C5B4F0 /* ProductFormViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFormViewModel.swift; sourceTree = "<group>"; };
@@ -3856,6 +3858,7 @@
38563858
028BAC3F22F2EFA5008BB4AF /* OldStoreStatsAndTopPerformersPeriodViewController.swift */,
38573859
0222729127746D8B007D3851 /* OldStoreStatsV4PeriodViewController.swift */,
38583860
028BAC4422F3AE5C008BB4AF /* OldStoreStatsV4PeriodViewController.xib */,
3861+
0224B1C72786E69B008F536D /* LegacyTopPerformersSectionHeaderView.swift */,
38593862
028BAC4622F3B550008BB4AF /* StatsTimeRangeV4+UI.swift */,
38603863
0285BF6F22FBD91C003A2525 /* TopPerformersSectionHeaderView.swift */,
38613864
02E4FD79230688BA0049610C /* OrderStatsV4Interval+Chart.swift */,
@@ -8591,6 +8594,7 @@
85918594
45D1CF4723BAC89A00945A36 /* ProductTaxStatusListSelectorCommand.swift in Sources */,
85928595
453DBF9023882814006762A5 /* ProductImagesFlowLayout.swift in Sources */,
85938596
024DF30E23742A70006658FE /* AztecBoldFormatBarCommand.swift in Sources */,
8597+
0224B1C82786E69B008F536D /* LegacyTopPerformersSectionHeaderView.swift in Sources */,
85948598
02396251239948470096F34C /* UIImage+TintColor.swift in Sources */,
85958599
DEE6437826D8DAD900888A75 /* InProgressView.swift in Sources */,
85968600
0290E275238E4F8100B5C466 /* PaginatedListSelectorViewController.swift in Sources */,

0 commit comments

Comments
 (0)