Skip to content

Commit 4b9f535

Browse files
committed
Add analytics hub button on the stats dashboard
1 parent 71cb54a commit 4b9f535

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ private extension StoreStatsAndTopPerformersPeriodViewController {
287287
storeStatsPeriodView.heightAnchor.constraint(equalToConstant: Constants.storeStatsPeriodViewHeight),
288288
])
289289

290+
// Analytics Hub ("See more") button
291+
stackView.addArrangedSubview(createAnalyticsHubButtonView())
292+
290293
// In-app Feedback Card
291294
stackView.addArrangedSubviews(inAppFeedbackCardViewsForStackView)
292295

@@ -327,11 +330,29 @@ private extension StoreStatsAndTopPerformersPeriodViewController {
327330
return [emptySpaceView, cardView]
328331
}
329332

333+
func createAnalyticsHubButtonView() -> UIView {
334+
let button = UIButton(frame: .zero)
335+
button.translatesAutoresizingMaskIntoConstraints = false
336+
button.applySecondaryButtonStyle()
337+
button.setTitle(Localization.seeMoreButton, for: .normal)
338+
button.addTarget(self, action: #selector(seeMoreButtonTapped), for: .touchUpInside)
339+
340+
let view = UIView(frame: .zero)
341+
view.addSubview(button)
342+
view.pinSubviewToSafeArea(button, insets: Constants.buttonInsets)
343+
344+
return view
345+
}
346+
330347
func configureInAppFeedbackViewControllerAction() {
331348
inAppFeedbackCardViewController.onFeedbackGiven = { [weak self] in
332349
self?.viewModel.onInAppFeedbackCardAction()
333350
}
334351
}
352+
353+
@objc func seeMoreButtonTapped() {
354+
// TODO: navigate to analytics hub view
355+
}
335356
}
336357

337358
// MARK: Actions
@@ -349,5 +370,10 @@ private extension StoreStatsAndTopPerformersPeriodViewController {
349370
static let storeStatsPeriodViewHeight: CGFloat = 444
350371
static let ghostStyle: GhostStyle = .wooDefaultGhostStyle
351372
static let backgroundColor: UIColor = .systemBackground
373+
static let buttonInsets: UIEdgeInsets = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16)
374+
}
375+
376+
enum Localization {
377+
static let seeMoreButton = NSLocalizedString("See more", comment: "Button on the stats dashboard that navigates user to the analytics hub")
352378
}
353379
}

0 commit comments

Comments
 (0)