Skip to content

Commit 6ee83f1

Browse files
authored
Merge pull request #8163 from woocommerce/issue/8148-adds-main-view
Products Onboarding: Adds Main Analytics Hub View
2 parents f461df5 + 86f21d6 commit 6ee83f1

File tree

3 files changed

+99
-33
lines changed

3 files changed

+99
-33
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import Foundation
2+
import Yosemite
3+
import SwiftUI
4+
5+
/// Hosting Controller for the `AnalyticsHubView` view.
6+
///
7+
final class AnalyticsHubHostingViewController: UIHostingController<AnalyticsHubView> {
8+
init(timeRange: StatsTimeRangeV4) {
9+
super.init(rootView: AnalyticsHubView())
10+
}
11+
12+
@available(*, unavailable)
13+
required dynamic init?(coder aDecoder: NSCoder) {
14+
fatalError("init(coder:) has not been implemented")
15+
}
16+
}
17+
18+
/// Main Analytics Hub View
19+
///
20+
struct AnalyticsHubView: View {
21+
22+
var body: some View {
23+
ScrollView {
24+
VStack(alignment: .leading, spacing: Layout.vertialSpacing) {
25+
VStack(spacing: 0) {
26+
Divider()
27+
Text("Placeholder for Time Range Selection")
28+
.padding(.leading)
29+
.frame(maxWidth: .infinity, minHeight: 84, alignment: .leading)
30+
.background(Color(uiColor: .listForeground))
31+
32+
Divider()
33+
}
34+
35+
36+
VStack(spacing: 0) {
37+
Divider()
38+
39+
Text("Placeholder For Revenue Card")
40+
.padding(.leading)
41+
.frame(maxWidth: .infinity, minHeight: 220, alignment: .leading)
42+
.background(Color(uiColor: .listForeground))
43+
44+
Divider()
45+
}
46+
47+
VStack(spacing: 0) {
48+
Divider()
49+
50+
Text("Placeholder For Orders Card")
51+
.padding(.leading)
52+
.frame(maxWidth: .infinity, minHeight: 220, alignment: .leading)
53+
.background(Color(uiColor: .listForeground))
54+
55+
Divider()
56+
}
57+
58+
Spacer()
59+
}
60+
}
61+
.navigationTitle(Localization.title)
62+
.navigationBarTitleDisplayMode(.inline)
63+
.background(Color(uiColor: .listBackground))
64+
}
65+
}
66+
67+
/// Constants
68+
///
69+
private extension AnalyticsHubView {
70+
struct Localization {
71+
static let title = NSLocalizedString("Analytics", comment: "Title for the Analytics Hub screen.")
72+
}
73+
74+
struct Layout {
75+
static let vertialSpacing: CGFloat = 24.0
76+
}
77+
}
78+
79+
// MARK: Preview
80+
81+
struct AnalyticsHubPreview: PreviewProvider {
82+
static var previews: some View {
83+
NavigationView {
84+
AnalyticsHubView()
85+
}
86+
}
87+
}

WooCommerce/Classes/ViewRelated/Dashboard/AnalyticsHub/AnalyticsHubView.swift

Lines changed: 0 additions & 21 deletions
This file was deleted.

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@
558558
263E38462641FF3400260D3B /* Codegen in Frameworks */ = {isa = PBXBuildFile; productRef = 263E38452641FF3400260D3B /* Codegen */; };
559559
263E38472641FF3400260D3B /* Codegen in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 263E38452641FF3400260D3B /* Codegen */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
560560
263EB409242C58EA00F3A15F /* ProductFormActionsFactoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 263EB408242C58EA00F3A15F /* ProductFormActionsFactoryTests.swift */; };
561+
2647F7B529280A7F00D59FDF /* AnalyticsHubView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2647F7B429280A7F00D59FDF /* AnalyticsHubView.swift */; };
561562
265284022624937600F91BA1 /* AddOnCrossreferenceUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 265284012624937600F91BA1 /* AddOnCrossreferenceUseCase.swift */; };
562563
265284092624ACE900F91BA1 /* AddOnCrossreferenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 265284082624ACE900F91BA1 /* AddOnCrossreferenceTests.swift */; };
563564
2655905B27863D1300BB8457 /* MockCollectOrderPaymentUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2655905A27863D1300BB8457 /* MockCollectOrderPaymentUseCase.swift */; };
@@ -1159,7 +1160,6 @@
11591160
ABC35528D2D6BE6F516E5CEF /* InPersonPaymentsOnboardingError.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC35A4B736A0B2D8348DD08 /* InPersonPaymentsOnboardingError.swift */; };
11601161
ABC35F18E744C5576B986CB3 /* InPersonPaymentsUnavailableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC35055F8AC8C8EB649F421 /* InPersonPaymentsUnavailableView.swift */; };
11611162
AE1CC33829129A010021C8EF /* LinkBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE1CC33729129A010021C8EF /* LinkBehavior.swift */; };
1162-
AE2EA1142927F87B000392B6 /* AnalyticsHubView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2EA1132927F87B000392B6 /* AnalyticsHubView.swift */; };
11631163
AE3AA889290C303B00BE422D /* WebKitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE3AA888290C303B00BE422D /* WebKitViewController.swift */; };
11641164
AE3AA88B290C30B900BE422D /* WebViewControllerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE3AA88A290C30B900BE422D /* WebViewControllerConfiguration.swift */; };
11651165
AE3AA88D290C30E800BE422D /* WebProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE3AA88C290C30E800BE422D /* WebProgressView.swift */; };
@@ -2523,6 +2523,7 @@
25232523
262C922026F1370000011F92 /* StorePickerError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorePickerError.swift; sourceTree = "<group>"; };
25242524
26309F16277D0AEA0012797F /* SafeAreaInsetsKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafeAreaInsetsKey.swift; sourceTree = "<group>"; };
25252525
263EB408242C58EA00F3A15F /* ProductFormActionsFactoryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFormActionsFactoryTests.swift; sourceTree = "<group>"; };
2526+
2647F7B429280A7F00D59FDF /* AnalyticsHubView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsHubView.swift; sourceTree = "<group>"; };
25262527
265284012624937600F91BA1 /* AddOnCrossreferenceUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddOnCrossreferenceUseCase.swift; sourceTree = "<group>"; };
25272528
265284082624ACE900F91BA1 /* AddOnCrossreferenceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddOnCrossreferenceTests.swift; sourceTree = "<group>"; };
25282529
2655905A27863D1300BB8457 /* MockCollectOrderPaymentUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockCollectOrderPaymentUseCase.swift; sourceTree = "<group>"; };
@@ -3111,7 +3112,6 @@
31113112
ABC353433EABC5F0EC796222 /* CardReaderSettingsSearchingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardReaderSettingsSearchingViewController.swift; sourceTree = "<group>"; };
31123113
ABC35A4B736A0B2D8348DD08 /* InPersonPaymentsOnboardingError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InPersonPaymentsOnboardingError.swift; sourceTree = "<group>"; };
31133114
AE1CC33729129A010021C8EF /* LinkBehavior.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkBehavior.swift; sourceTree = "<group>"; };
3114-
AE2EA1132927F87B000392B6 /* AnalyticsHubView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsHubView.swift; sourceTree = "<group>"; };
31153115
AE3AA888290C303B00BE422D /* WebKitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebKitViewController.swift; sourceTree = "<group>"; };
31163116
AE3AA88A290C30B900BE422D /* WebViewControllerConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewControllerConfiguration.swift; sourceTree = "<group>"; };
31173117
AE3AA88C290C30E800BE422D /* WebProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebProgressView.swift; sourceTree = "<group>"; };
@@ -5239,6 +5239,14 @@
52395239
path = "Environment Keys";
52405240
sourceTree = "<group>";
52415241
};
5242+
2647F7B329280A5000D59FDF /* Analytics Hub */ = {
5243+
isa = PBXGroup;
5244+
children = (
5245+
2647F7B429280A7F00D59FDF /* AnalyticsHubView.swift */,
5246+
);
5247+
path = "Analytics Hub";
5248+
sourceTree = "<group>";
5249+
};
52425250
265284002624933B00F91BA1 /* AddOns */ = {
52435251
isa = PBXGroup;
52445252
children = (
@@ -6684,14 +6692,6 @@
66846692
path = FlowCoordinator;
66856693
sourceTree = "<group>";
66866694
};
6687-
AE2EA1122927F86C000392B6 /* AnalyticsHub */ = {
6688-
isa = PBXGroup;
6689-
children = (
6690-
AE2EA1132927F87B000392B6 /* AnalyticsHubView.swift */,
6691-
);
6692-
path = AnalyticsHub;
6693-
sourceTree = "<group>";
6694-
};
66956695
AE9E04732776034B003FA09E /* CustomerSection */ = {
66966696
isa = PBXGroup;
66976697
children = (
@@ -8059,7 +8059,7 @@
80598059
CE85FD5120F677460080B73E /* Dashboard */ = {
80608060
isa = PBXGroup;
80618061
children = (
8062-
AE2EA1122927F86C000392B6 /* AnalyticsHub */,
8062+
2647F7B329280A5000D59FDF /* Analytics Hub */,
80638063
DE23CFF827462CD2003BE54E /* JetpackInstall */,
80648064
02F843D8273646190017FE12 /* JetpackConnectionPackageSites */,
80658065
028BAC4322F3AE3B008BB4AF /* Stats v4 */,
@@ -9882,6 +9882,7 @@
98829882
CC4A4E962655273D00B75DCD /* ShippingLabelPaymentMethods.swift in Sources */,
98839883
45DB6D972632CF9300E83C1A /* ActivityIndicator.swift in Sources */,
98849884
5778E00624DB0C3900B65CBF /* StoreStatsAndTopPerformersPeriodViewModel.swift in Sources */,
9885+
2647F7B529280A7F00D59FDF /* AnalyticsHubView.swift in Sources */,
98859886
453A908325EFC9B2006EE892 /* ShippingLabelSuggestedAddressTopBannerFactory.swift in Sources */,
98869887
45BBE5C7268CBB090017D8F8 /* ShippingLabelStateOfACountryListSelectorCommand.swift in Sources */,
98879888
456396A725C81C9A001F1A26 /* ShippingLabelFormViewController.swift in Sources */,
@@ -10204,7 +10205,6 @@
1020410205
CC254F2D26C17AB5005F3C82 /* BottomButtonView.swift in Sources */,
1020510206
DEF36DE92898D3CF00178AC2 /* AuthenticatedWebViewController.swift in Sources */,
1020610207
74334F36214AB130006D6AC5 /* ProductTableViewCell.swift in Sources */,
10207-
AE2EA1142927F87B000392B6 /* AnalyticsHubView.swift in Sources */,
1020810208
D8610D762570AE1F00A5DF27 /* NotWPErrorViewModel.swift in Sources */,
1020910209
0245465B24EE7637004F531C /* ProductFormEventLoggerProtocol.swift in Sources */,
1021010210
02C1853D27FF153A00ABD764 /* CardPresentRefundOrchestrator.swift in Sources */,

0 commit comments

Comments
 (0)