-
Notifications
You must be signed in to change notification settings - Fork 120
Top Performers Mark3: User Interface #305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
ca0ee45
WIP: Dashboard top performers UI
bummytime 817e671
Top Perf: Added section label
bummytime b5c8cd9
Merge branch 'develop' of github.com:woocommerce/woocommerce-ios into…
bummytime 6dc3cc5
Top Perf: Fixed a spacing issue
bummytime e7ebf1f
Top Perf: Layout adjustments
bummytime 36c2546
Top Perf: Fixed some constraints
bummytime 87bbb52
Top Perf: Added tab titles
bummytime 80fe903
Merge branch 'develop' of github.com:woocommerce/woocommerce-ios into…
bummytime df1a40c
Removed superfluous VC from dash storyboard
bummytime 02da5b2
Top Perf section headers
bummytime 7f77f03
Top perf tweaks
bummytime 03d4883
Added ProductTableViewCell
bummytime c5ef920
WIP: Loading data in top performers
bummytime 49717af
Top Perf: UI updates
bummytime 9bcb8a9
ProductTableViewCell updates
bummytime 038c370
Top Perf: Wired up ResultsController
bummytime 78e9cef
Top Perf: Added formatted price string to table
bummytime 0e43031
Top Perf: Sorting
bummytime 48e675a
Dashboard: resultsController.onDidResetContent imp'ed
bummytime 758166f
Top Perf: Added no results view
bummytime eed1e62
Merge branch 'develop' of github.com:woocommerce/woocommerce-ios into…
bummytime b023664
Lint fixes!
bummytime a1bfc38
Top perf: leave section header in place if table is empty
bummytime 62bc388
Top Perf: doc comment updates
bummytime d7f9513
Added IntrinsicTableView subclass
bummytime File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import Foundation | ||
| import Yosemite | ||
|
|
||
|
|
||
| // MARK: - TopEarnerStatsItem Helper Methods | ||
| // | ||
| extension TopEarnerStatsItem { | ||
|
|
||
| /// Returns the Currency Symbol associated with the current TopEarnerStatsItem. | ||
| /// | ||
| var currencySymbol: String { | ||
| guard !currency.isEmpty else { | ||
| return "" | ||
| } | ||
| guard let identifier = Locale.availableIdentifiers.first(where: { Locale(identifier: $0).currencyCode == currency }) else { | ||
| return currency | ||
| } | ||
|
|
||
| return Locale(identifier: identifier).currencySymbol ?? currency | ||
| } | ||
|
|
||
| /// Returns a friendly-formatted total string including the currency symbol | ||
| /// | ||
| var formattedTotalString: String { | ||
| return currencySymbol + total.friendlyString() | ||
| } | ||
| } |
132 changes: 113 additions & 19 deletions
132
WooCommerce/Classes/ViewRelated/Dashboard/Dashboard.storyboard
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
WooCommerce/Classes/ViewRelated/Dashboard/MyStore/Cells/NoPeriodDataTableViewCell.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import Foundation | ||
| import UIKit | ||
|
|
||
|
|
||
| /// Displayed whenever there is no top performer data for a given period (granularity) | ||
| /// | ||
| class NoPeriodDataTableViewCell: UITableViewCell { | ||
| @IBOutlet private weak var mainImageView: UIImageView! | ||
|
|
||
| /// LegendLabel: To be displayed below the ImageView. | ||
| /// | ||
| @IBOutlet private var legendLabel: UILabel! { | ||
| didSet { | ||
| legendLabel.applySubheadlineStyle() | ||
| legendLabel.text = NSLocalizedString("No activity this period", comment: "Default text for Top Performers section when no data exists for a given period.") | ||
| } | ||
| } | ||
| } |
53 changes: 53 additions & 0 deletions
53
WooCommerce/Classes/ViewRelated/Dashboard/MyStore/Cells/NoPeriodDataTableViewCell.xib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> | ||
| <device id="retina4_7" orientation="portrait"> | ||
| <adaptation id="fullscreen"/> | ||
| </device> | ||
| <dependencies> | ||
| <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/> | ||
| <capability name="Constraints to layout margins" minToolsVersion="6.0"/> | ||
| <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
| </dependencies> | ||
| <objects> | ||
| <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> | ||
| <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | ||
| <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" rowHeight="242" id="qMv-Pb-lgn" customClass="NoPeriodDataTableViewCell" customModule="WooCommerce" customModuleProvider="target"> | ||
| <rect key="frame" x="0.0" y="0.0" width="375" height="242"/> | ||
| <autoresizingMask key="autoresizingMask"/> | ||
| <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="qMv-Pb-lgn" id="gcY-Gg-DvR"> | ||
| <rect key="frame" x="0.0" y="0.0" width="375" height="241.5"/> | ||
| <autoresizingMask key="autoresizingMask"/> | ||
| <subviews> | ||
| <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="woo-no-store" translatesAutoresizingMaskIntoConstraints="NO" id="uuh-xp-DA5"> | ||
| <rect key="frame" x="0.0" y="0.0" width="375" height="180"/> | ||
| </imageView> | ||
| <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bPV-bJ-GBz"> | ||
| <rect key="frame" x="26" y="200.5" width="323" height="20.5"/> | ||
| <fontDescription key="fontDescription" type="system" pointSize="17"/> | ||
| <nil key="textColor"/> | ||
| <nil key="highlightedColor"/> | ||
| </label> | ||
| </subviews> | ||
| <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
| <constraints> | ||
| <constraint firstItem="bPV-bJ-GBz" firstAttribute="leading" secondItem="gcY-Gg-DvR" secondAttribute="leadingMargin" constant="10" id="02T-fd-amz"/> | ||
| <constraint firstAttribute="trailingMargin" secondItem="bPV-bJ-GBz" secondAttribute="trailing" constant="10" id="4v0-dU-uL0"/> | ||
| <constraint firstItem="uuh-xp-DA5" firstAttribute="top" secondItem="gcY-Gg-DvR" secondAttribute="top" id="AXH-sZ-i9m"/> | ||
| <constraint firstItem="uuh-xp-DA5" firstAttribute="leading" secondItem="gcY-Gg-DvR" secondAttribute="leading" id="QK4-JX-5Z1"/> | ||
| <constraint firstItem="bPV-bJ-GBz" firstAttribute="top" relation="greaterThanOrEqual" secondItem="uuh-xp-DA5" secondAttribute="bottom" constant="10" id="YHi-MJ-ZFK"/> | ||
| <constraint firstAttribute="bottomMargin" secondItem="bPV-bJ-GBz" secondAttribute="bottom" constant="10" id="Zyf-Uq-D8M"/> | ||
| <constraint firstAttribute="trailing" secondItem="uuh-xp-DA5" secondAttribute="trailing" id="egs-Ij-2lL"/> | ||
| </constraints> | ||
| </tableViewCellContentView> | ||
| <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
| <connections> | ||
| <outlet property="legendLabel" destination="bPV-bJ-GBz" id="VBf-2Q-gkI"/> | ||
| <outlet property="mainImageView" destination="uuh-xp-DA5" id="vq3-GZ-F81"/> | ||
| </connections> | ||
| <point key="canvasLocation" x="-162.5" y="-12"/> | ||
| </tableViewCell> | ||
| </objects> | ||
| <resources> | ||
| <image name="woo-no-store" width="320" height="180"/> | ||
| </resources> | ||
| </document> |
65 changes: 65 additions & 0 deletions
65
WooCommerce/Classes/ViewRelated/Dashboard/MyStore/Cells/ProductTableViewCell.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import UIKit | ||
| import Yosemite | ||
| import WordPressUI | ||
| import Gridicons | ||
|
|
||
| class ProductTableViewCell: UITableViewCell { | ||
|
|
||
| // MARK: - Properties | ||
|
|
||
| @IBOutlet private weak var productImage: UIImageView! | ||
| @IBOutlet private var nameLabel: UILabel! | ||
| @IBOutlet private var detailLabel: UILabel! | ||
| @IBOutlet private var priceLabel: UILabel! | ||
|
|
||
| var nameText: String? { | ||
| get { | ||
| return nameLabel.text | ||
| } | ||
| set { | ||
| nameLabel.text = newValue | ||
| } | ||
| } | ||
|
|
||
| var detailText: String? { | ||
| get { | ||
| return detailLabel.text | ||
| } | ||
| set { | ||
| detailLabel.text = newValue | ||
| } | ||
| } | ||
|
|
||
| var priceText: String? { | ||
| get { | ||
| return priceLabel.text | ||
| } | ||
| set { | ||
| priceLabel.text = newValue | ||
| } | ||
| } | ||
|
|
||
| override func awakeFromNib() { | ||
| super.awakeFromNib() | ||
| nameLabel.applyBodyStyle() | ||
| priceLabel.applyBodyStyle() | ||
| detailLabel.applyFootnoteStyle() | ||
| productImage.contentMode = .scaleAspectFit | ||
| } | ||
| } | ||
|
|
||
| // MARK: - Public Methods | ||
| // | ||
| extension ProductTableViewCell { | ||
| func configure(_ statsItem: TopEarnerStatsItem?) { | ||
| nameText = statsItem?.productName | ||
| detailText = String.localizedStringWithFormat( NSLocalizedString("Total Product Order: %ld", comment: "Top performers — label for the total number of products ordered"), statsItem?.quantity ?? 0) | ||
| priceText = statsItem?.formattedTotalString | ||
|
|
||
| if let productURLString = statsItem?.imageUrl { | ||
| productImage.downloadImage(from: URL(string: productURLString), placeholderImage: UIImage.productPlaceholderImage) | ||
| } else { | ||
| productImage.image = .productPlaceholderImage | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1