Skip to content

Commit f88ed22

Browse files
authored
Merge pull request #5787 from woocommerce/feat/5742-ghost-view-prep
Duplicate `ChartPlaceholderView` for design updates in Home Screen M2
2 parents 489719a + 971ad58 commit f88ed22

File tree

4 files changed

+221
-9
lines changed

4 files changed

+221
-9
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import Foundation
2+
import UIKit
3+
4+
5+
// ChartPlaceholderView: Charts Mockup UI!
6+
//
7+
class LegacyChartPlaceholderView: UIView {
8+
9+
/// Top Container View
10+
///
11+
@IBOutlet private var topStackView: UIStackView!
12+
13+
/// Bars Container View
14+
///
15+
@IBOutlet private var barsStackView: UIStackView!
16+
17+
// MARK: - Overridden Methods
18+
19+
override func awakeFromNib() {
20+
super.awakeFromNib()
21+
setupView()
22+
setupSubviews()
23+
}
24+
}
25+
26+
27+
// MARK: - Private Methods
28+
//
29+
private extension LegacyChartPlaceholderView {
30+
/// Applies color to the view.
31+
///
32+
func setupView() {
33+
backgroundColor = .listForeground
34+
topStackView.backgroundColor = .listForeground
35+
}
36+
37+
/// Applies Rounded Style to the upper views.
38+
///
39+
func setupSubviews() {
40+
let subviews = barsStackView.subviews + topStackView.subviews.compactMap { $0.subviews.first }
41+
for view in subviews {
42+
view.layer.cornerRadius = Settings.cornerRadius
43+
view.layer.masksToBounds = true
44+
}
45+
}
46+
}
47+
48+
49+
// MARK: - Private Types
50+
//
51+
private enum Settings {
52+
static let cornerRadius = CGFloat(6)
53+
}
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3+
<device id="retina4_7" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
7+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
8+
</dependencies>
9+
<objects>
10+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
11+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
12+
<view contentMode="scaleToFill" id="myP-39-aJj" customClass="LegacyChartPlaceholderView" customModule="WooCommerce" customModuleProvider="target">
13+
<rect key="frame" x="0.0" y="0.0" width="320" height="290"/>
14+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
15+
<subviews>
16+
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" alignment="center" spacing="-1" translatesAutoresizingMaskIntoConstraints="NO" id="tLL-AN-zl3">
17+
<rect key="frame" x="25" y="0.0" width="270" height="90"/>
18+
<subviews>
19+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lOK-PB-egW">
20+
<rect key="frame" x="0.0" y="0.0" width="90.5" height="90"/>
21+
<subviews>
22+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="238-3o-tIA">
23+
<rect key="frame" x="15.5" y="20" width="60" height="50"/>
24+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
25+
<constraints>
26+
<constraint firstAttribute="height" constant="50" id="FcV-e0-1Wp"/>
27+
<constraint firstAttribute="width" constant="60" id="Hcy-Xs-J8v"/>
28+
</constraints>
29+
</view>
30+
</subviews>
31+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
32+
<constraints>
33+
<constraint firstItem="238-3o-tIA" firstAttribute="centerX" secondItem="lOK-PB-egW" secondAttribute="centerX" id="J4g-TI-xGM"/>
34+
<constraint firstItem="238-3o-tIA" firstAttribute="centerY" secondItem="lOK-PB-egW" secondAttribute="centerY" id="gGR-ZG-0jI"/>
35+
</constraints>
36+
</view>
37+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ee5-kF-HK7">
38+
<rect key="frame" x="89.5" y="0.0" width="91" height="90"/>
39+
<subviews>
40+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lCJ-LD-Hg1">
41+
<rect key="frame" x="15.5" y="20" width="60" height="50"/>
42+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
43+
<constraints>
44+
<constraint firstAttribute="width" constant="60" id="FXL-Ch-Asp"/>
45+
<constraint firstAttribute="height" constant="50" id="qhB-De-Clq"/>
46+
</constraints>
47+
</view>
48+
</subviews>
49+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
50+
<constraints>
51+
<constraint firstItem="lCJ-LD-Hg1" firstAttribute="centerY" secondItem="ee5-kF-HK7" secondAttribute="centerY" id="GA3-D6-GSA"/>
52+
<constraint firstItem="lCJ-LD-Hg1" firstAttribute="centerX" secondItem="ee5-kF-HK7" secondAttribute="centerX" id="OFz-yr-d7N"/>
53+
</constraints>
54+
</view>
55+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fId-CU-eJU">
56+
<rect key="frame" x="179.5" y="0.0" width="90.5" height="90"/>
57+
<subviews>
58+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jer-Xj-TlY">
59+
<rect key="frame" x="15" y="20" width="60" height="50"/>
60+
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
61+
<constraints>
62+
<constraint firstAttribute="width" constant="60" id="1iZ-qF-fwS"/>
63+
<constraint firstAttribute="height" constant="50" id="vdi-WG-WZs"/>
64+
</constraints>
65+
</view>
66+
</subviews>
67+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
68+
<constraints>
69+
<constraint firstItem="Jer-Xj-TlY" firstAttribute="centerY" secondItem="fId-CU-eJU" secondAttribute="centerY" id="MlQ-Lj-Cq1"/>
70+
<constraint firstItem="Jer-Xj-TlY" firstAttribute="centerX" secondItem="fId-CU-eJU" secondAttribute="centerX" id="ohb-ql-jEq"/>
71+
</constraints>
72+
</view>
73+
</subviews>
74+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
75+
<constraints>
76+
<constraint firstAttribute="height" constant="90" id="tNY-j6-pRB"/>
77+
</constraints>
78+
</stackView>
79+
<stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" alignment="bottom" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="1eD-TF-3NS">
80+
<rect key="frame" x="32" y="110" width="256" height="120"/>
81+
<subviews>
82+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="nwv-3X-yXO">
83+
<rect key="frame" x="0.0" y="60" width="10" height="60"/>
84+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
85+
<constraints>
86+
<constraint firstAttribute="width" constant="10" id="8pm-un-ftt"/>
87+
</constraints>
88+
</view>
89+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="2vq-Ow-XTA">
90+
<rect key="frame" x="41" y="0.0" width="10" height="120"/>
91+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
92+
</view>
93+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="ezD-Ei-g97">
94+
<rect key="frame" x="82" y="60" width="10" height="60"/>
95+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
96+
</view>
97+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="oHZ-Fw-E7W">
98+
<rect key="frame" x="123" y="100" width="10" height="20"/>
99+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
100+
</view>
101+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="Src-7C-V4i">
102+
<rect key="frame" x="164" y="60" width="10" height="60"/>
103+
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
104+
</view>
105+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="RAr-us-CuM">
106+
<rect key="frame" x="205" y="0.0" width="10" height="120"/>
107+
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
108+
</view>
109+
<view contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="Gcg-G1-3tN">
110+
<rect key="frame" x="246" y="60" width="10" height="60"/>
111+
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
112+
</view>
113+
</subviews>
114+
<constraints>
115+
<constraint firstItem="RAr-us-CuM" firstAttribute="height" secondItem="2vq-Ow-XTA" secondAttribute="height" id="0ha-3w-jX0"/>
116+
<constraint firstItem="Src-7C-V4i" firstAttribute="height" secondItem="nwv-3X-yXO" secondAttribute="height" id="5WB-Ht-Do2"/>
117+
<constraint firstItem="oHZ-Fw-E7W" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="DrR-nA-go4"/>
118+
<constraint firstItem="ezD-Ei-g97" firstAttribute="height" secondItem="nwv-3X-yXO" secondAttribute="height" id="EoO-k5-XEU"/>
119+
<constraint firstItem="2vq-Ow-XTA" firstAttribute="top" secondItem="1eD-TF-3NS" secondAttribute="top" id="H2F-I7-Zpb"/>
120+
<constraint firstItem="Gcg-G1-3tN" firstAttribute="height" secondItem="nwv-3X-yXO" secondAttribute="height" id="IF7-4c-N8t"/>
121+
<constraint firstItem="Gcg-G1-3tN" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="IZA-dw-Zw5"/>
122+
<constraint firstItem="oHZ-Fw-E7W" firstAttribute="top" secondItem="1eD-TF-3NS" secondAttribute="top" constant="100" id="QfI-dm-9nC"/>
123+
<constraint firstItem="ezD-Ei-g97" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="lBu-nH-cU1"/>
124+
<constraint firstItem="RAr-us-CuM" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="nVh-vZ-buX"/>
125+
<constraint firstItem="Src-7C-V4i" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="ne7-zl-jyQ"/>
126+
<constraint firstItem="nwv-3X-yXO" firstAttribute="top" secondItem="1eD-TF-3NS" secondAttribute="top" constant="60" id="s09-Mt-4Zz"/>
127+
<constraint firstItem="2vq-Ow-XTA" firstAttribute="width" secondItem="nwv-3X-yXO" secondAttribute="width" id="vWi-iL-3fB"/>
128+
</constraints>
129+
</stackView>
130+
</subviews>
131+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
132+
<constraints>
133+
<constraint firstAttribute="trailingMargin" secondItem="1eD-TF-3NS" secondAttribute="trailing" constant="16" id="0A0-Wc-apU"/>
134+
<constraint firstAttribute="trailingMargin" secondItem="tLL-AN-zl3" secondAttribute="trailing" constant="9" id="DmR-KI-vaH"/>
135+
<constraint firstItem="tLL-AN-zl3" firstAttribute="leading" secondItem="myP-39-aJj" secondAttribute="leadingMargin" constant="9" id="Ozr-WO-msf"/>
136+
<constraint firstItem="tLL-AN-zl3" firstAttribute="top" secondItem="myP-39-aJj" secondAttribute="top" id="PTs-AI-Nzh"/>
137+
<constraint firstAttribute="bottom" secondItem="1eD-TF-3NS" secondAttribute="bottom" constant="60" id="SCd-TV-K5s"/>
138+
<constraint firstItem="1eD-TF-3NS" firstAttribute="top" secondItem="tLL-AN-zl3" secondAttribute="bottom" constant="20" id="SjD-pr-7cU"/>
139+
<constraint firstItem="1eD-TF-3NS" firstAttribute="leading" secondItem="myP-39-aJj" secondAttribute="leadingMargin" constant="16" id="xuD-lZ-hT8"/>
140+
</constraints>
141+
<nil key="simulatedTopBarMetrics"/>
142+
<nil key="simulatedBottomBarMetrics"/>
143+
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
144+
<connections>
145+
<outlet property="barsStackView" destination="1eD-TF-3NS" id="odU-Rg-8kk"/>
146+
<outlet property="topStackView" destination="tLL-AN-zl3" id="8UA-4q-cOu"/>
147+
</connections>
148+
<point key="canvasLocation" x="104" y="107.94602698650675"/>
149+
</view>
150+
</objects>
151+
</document>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ final class OldStoreStatsV4PeriodViewController: UIViewController {
9898

9999
/// Placeholder: Mockup Charts View
100100
///
101-
private lazy var placeholderChartsView: ChartPlaceholderView = ChartPlaceholderView.instantiateFromNib()
101+
private lazy var placeholderChartsView: LegacyChartPlaceholderView = LegacyChartPlaceholderView.instantiateFromNib()
102102

103103

104104
// MARK: - Computed Properties

0 commit comments

Comments
 (0)