Improved layout

master
Laurent 6 years ago
parent 6e89912d22
commit f557dba652
  1. 20
      TournamentStats/UI/components/TableView.swift
  2. 22
      TournamentStats/UI/reports/InfographyView.swift
  3. 201
      TournamentStats/UI/reports/InfographyView.xib
  4. 26
      TournamentStats/report/structures/CountryCounter.swift
  5. 1
      TournamentStats/report/structures/FestivalStats.swift
  6. 46
      TournamentStats/report/structures/TournamentStats.swift

@ -22,6 +22,26 @@ class TableView : UITableView {
self.reference = wrapper
}
private func label(height: CGFloat, text: String) -> UILabel {
let label = UILabel(frame: CGRect(x: 0, y: 0, width: self.frame.width, height: height))
label.text = text
label.textColor = UIColor.white
label.backgroundColor = UIColor.clear
label.textAlignment = .center
return label
}
func setHeader(header: String) {
let label = self.label(height: 60.0, text: header)
label.font = Fonts.subTitle
self.tableHeaderView = label
}
func setFooter(footer: String) {
let label = self.label(height: 22.0, text: footer)
self.tableFooterView = label
}
override init(frame: CGRect, style: UITableView.Style) {
super.init(frame: frame, style: style)
self._initialize()

@ -63,8 +63,7 @@ class InfographyView: UIView {
@IBOutlet weak var label51: UILabel!
@IBOutlet weak var hStack5b: UIStackView!
@IBOutlet weak var tableView51: TableView!
@IBOutlet weak var collectionView51: UICollectionView!
override func awakeFromNib() {
super.awakeFromNib()
@ -105,13 +104,15 @@ class InfographyView: UIView {
/////
self.label11.text = "Biggest Winners".uppercased()
// self.label11.text = "Biggest Winners".uppercased()
self.label12.text = "Most Cashes".uppercased()
self.label13.text = "Best average cash (7+)".uppercased()
self.tableView11.setData(data: generator.biggestWinners)
self.tableView12.setData(data: generator.mostCashes)
self.tableView13.setData(data: generator.averageCash)
self.tableView11.setHeader(header: "Biggest Winners")
self.tableView11.setFooter(footer: "* denotes a Main Event finalist")
self.tableView12.setData(data: generator.mostCashes, maxRows: 5)
self.tableView13.setData(data: generator.averageCash, maxRows: 5)
/////
@ -134,10 +135,12 @@ class InfographyView: UIView {
/////
self.label31.text = "Events by prizepool".uppercased()
self.label32.text = "Events by entries".uppercased()
// self.label31.text = "Events by prizepool".uppercased()
// self.label32.text = "Events by entries".uppercased()
self.tableView31.setHeader(header: "Events by prizepool".uppercased())
self.tableView31.setData(data: generator.tourniesByPrizepool, maxRows: 5)
self.tableView32.setHeader(header: "Events by entries".uppercased())
self.tableView32.setData(data: generator.tourniesByEntries, maxRows: 5)
/////
@ -155,8 +158,9 @@ class InfographyView: UIView {
self.label51.text = "Average Event".uppercased()
let ds = generator.averageEvent.first
self.tableView51.dataSource = ds
self.tableView51.delegate = ds
self.collectionView51.register(UINib(nibName: "StatCollectionViewCell", bundle: Bundle.main), forCellWithReuseIdentifier: "Stat")
self.collectionView51.dataSource = ds
self.collectionView51.delegate = ds
}

@ -13,14 +13,14 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="InfographyView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="1800" height="3500"/>
<rect key="frame" x="0.0" y="0.0" width="1500" height="4500"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="w79-xx-Evx">
<rect key="frame" x="8" y="44" width="1784" height="2740"/>
<rect key="frame" x="100" y="44" width="1300" height="3370"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2019 WSOP" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Hu-Ou-nFd">
<rect key="frame" x="0.0" y="0.0" width="1784" height="100"/>
<rect key="frame" x="0.0" y="0.0" width="1300" height="100"/>
<constraints>
<constraint firstAttribute="height" constant="100" id="mMK-PI-eZm"/>
</constraints>
@ -28,82 +28,98 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="C35-qI-rKP">
<rect key="frame" x="0.0" y="110" width="1784" height="100"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Iu6-Mp-G7e" userLabel="Space">
<rect key="frame" x="0.0" y="110" width="1300" height="50"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="100" id="Beg-JJ-WDa"/>
<constraint firstAttribute="height" constant="50" id="hKN-si-3Ts"/>
</constraints>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="93i-Pd-4WS">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
</collectionView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="aDf-a7-TD5">
<rect key="frame" x="0.0" y="220" width="1784" height="50"/>
<viewLayoutGuide key="safeArea" id="cgF-JL-ieX"/>
</view>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="ABP-ce-MDa">
<rect key="frame" x="0.0" y="170" width="1300" height="500"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hf2-oh-1Oz" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="594.5" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="US0-bW-Fa3" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="594.5" y="0.0" width="595" height="50"/>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" contentInsetAdjustmentBehavior="always" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Vh3-97-zuO">
<rect key="frame" x="0.0" y="0.0" width="642" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<inset key="scrollIndicatorInsets" minX="0.0" minY="40" maxX="0.0" maxY="0.0"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" sectionInsetReference="safeArea" id="O06-sl-CBC">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="40" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
</collectionView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="HbR-TC-HeD" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="658" y="0.0" width="642" height="500"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="500" id="LQg-JD-2Lr"/>
</constraints>
</stackView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Xrv-gg-4dD" userLabel="Space">
<rect key="frame" x="0.0" y="680" width="1300" height="50"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="z1Q-lp-yMy"/>
</constraints>
<viewLayoutGuide key="safeArea" id="x7x-j2-Rbi"/>
</view>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="Vf4-JJ-wEt">
<rect key="frame" x="0.0" y="740" width="1300" height="50"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VWQ-ZA-7rt" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="650" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7a3-eu-I7F" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="1189.5" y="0.0" width="594.5" height="50"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iaM-v8-HTO" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="650" y="0.0" width="650" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="50" id="3re-Nx-rm3"/>
<constraint firstAttribute="height" constant="50" id="Ump-tg-4hL"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="ABP-ce-MDa">
<rect key="frame" x="0.0" y="280" width="1784" height="400"/>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="50" translatesAutoresizingMaskIntoConstraints="NO" id="NbO-FE-SHj">
<rect key="frame" x="0.0" y="800" width="1300" height="300"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="HbR-TC-HeD" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="584" height="400"/>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="M2m-xf-le9" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="625" height="300"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="AOY-yE-egI" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="600" y="0.0" width="584" height="400"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="D9l-DT-eiv" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="1200" y="0.0" width="584" height="400"/>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="Vdb-nD-4Cy" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="675" y="0.0" width="625" height="300"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="400" id="LQg-JD-2Lr"/>
<constraint firstAttribute="height" constant="300" id="N0D-Z0-uH0"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="91U-hc-Oqn">
<rect key="frame" x="0.0" y="690" width="1784" height="40"/>
<rect key="frame" x="0.0" y="1110" width="1300" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hcr-dr-rUz" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="594.5" height="40"/>
<rect key="frame" x="0.0" y="0.0" width="433.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2yf-Z5-Tpy" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="594.5" y="0.0" width="595" height="40"/>
<rect key="frame" x="433.5" y="0.0" width="433" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hcG-kJ-HS1" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="1189.5" y="0.0" width="594.5" height="40"/>
<rect key="frame" x="866.5" y="0.0" width="433.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
@ -114,18 +130,18 @@
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="4u9-3E-Qwu">
<rect key="frame" x="0.0" y="740" width="1784" height="500"/>
<rect key="frame" x="0.0" y="1160" width="1300" height="500"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zmk-PV-di2">
<rect key="frame" x="0.0" y="0.0" width="584" height="500"/>
<rect key="frame" x="0.0" y="0.0" width="422.5" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iQu-2n-Y3T">
<rect key="frame" x="600" y="0.0" width="584" height="500"/>
<rect key="frame" x="438.5" y="0.0" width="423" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OZT-Lo-t7S">
<rect key="frame" x="1200" y="0.0" width="584" height="500"/>
<rect key="frame" x="877.5" y="0.0" width="422.5" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</subviews>
@ -133,53 +149,41 @@
<constraint firstAttribute="height" constant="500" id="zmA-DP-mDx"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="RgJ-XU-xav">
<rect key="frame" x="0.0" y="1250" width="1784" height="50"/>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="ucv-f0-P2r">
<rect key="frame" x="0.0" y="1670" width="1300" height="280"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zHz-52-q8s" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="892" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PFl-bw-SwB" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="892" y="0.0" width="892" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="0h6-mp-rHD" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="1300" height="280"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="50" id="0cN-fx-oRp"/>
<constraint firstAttribute="height" constant="280" id="Qi4-FK-vXH"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="ucv-f0-P2r">
<rect key="frame" x="0.0" y="1310" width="1784" height="400"/>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="JSX-zY-CFg">
<rect key="frame" x="0.0" y="1960" width="1300" height="280"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="0h6-mp-rHD" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="884" height="400"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="WPJ-0S-klg" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="900" y="0.0" width="884" height="400"/>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="h84-Ta-8eQ" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="1300" height="280"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="400" id="Qi4-FK-vXH"/>
<constraint firstAttribute="height" constant="280" id="e22-At-bAV"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="WFa-d3-zcU">
<rect key="frame" x="0.0" y="1720" width="1784" height="40"/>
<rect key="frame" x="0.0" y="2250" width="1300" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aSt-Fm-PHF" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="892" height="40"/>
<rect key="frame" x="0.0" y="0.0" width="650" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wcd-nU-zRB" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="892" y="0.0" width="892" height="40"/>
<rect key="frame" x="650" y="0.0" width="650" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
@ -190,14 +194,14 @@
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="9WN-7G-oBN">
<rect key="frame" x="0.0" y="1770" width="1784" height="500"/>
<rect key="frame" x="0.0" y="2300" width="1300" height="500"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YMb-PS-dFz">
<rect key="frame" x="0.0" y="0.0" width="884" height="500"/>
<rect key="frame" x="0.0" y="0.0" width="642" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LJL-hy-odj">
<rect key="frame" x="900" y="0.0" width="884" height="500"/>
<rect key="frame" x="658" y="0.0" width="642" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</subviews>
@ -206,16 +210,16 @@
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="myS-g5-vsP">
<rect key="frame" x="0.0" y="2280" width="1784" height="50"/>
<rect key="frame" x="0.0" y="2810" width="1300" height="50"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mDV-nN-W7V" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="892" height="50"/>
<rect key="frame" x="0.0" y="0.0" width="650" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7xF-BM-RBb" customClass="Label" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="892" y="0.0" width="892" height="50"/>
<rect key="frame" x="650" y="0.0" width="650" height="50"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
@ -226,19 +230,29 @@
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="2iy-YX-agg">
<rect key="frame" x="0.0" y="2340" width="1784" height="400"/>
<rect key="frame" x="0.0" y="2870" width="1300" height="500"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="tVi-Bi-Ese">
<rect key="frame" x="0.0" y="0.0" width="422.5" height="500"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="G6p-YK-B8A">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
</collectionView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="vqG-Pt-IB2" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="884" height="400"/>
<rect key="frame" x="438.5" y="0.0" width="423" height="500"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="bPn-x2-2H0" customClass="TableView" customModule="TournamentStats" customModuleProvider="target">
<rect key="frame" x="900" y="0.0" width="884" height="400"/>
<rect key="frame" x="877.5" y="0.0" width="422.5" height="500"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="400" id="U4b-yO-LB0"/>
<constraint firstAttribute="height" constant="500" id="U4b-yO-LB0"/>
</constraints>
</stackView>
</subviews>
@ -246,47 +260,42 @@
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="w79-xx-Evx" secondAttribute="trailing" constant="8" id="4VD-EL-9RH"/>
<constraint firstItem="w79-xx-Evx" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="8" id="stc-gy-e36"/>
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="w79-xx-Evx" secondAttribute="trailing" constant="100" id="4VD-EL-9RH"/>
<constraint firstItem="w79-xx-Evx" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="100" id="stc-gy-e36"/>
<constraint firstItem="w79-xx-Evx" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="usO-r7-R25"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<connections>
<outlet property="collectionView" destination="C35-qI-rKP" id="XRC-Q6-W3C"/>
<outlet property="collectionView" destination="Vh3-97-zuO" id="uR2-F8-eWB"/>
<outlet property="collectionView51" destination="tVi-Bi-Ese" id="f6M-Za-9IQ"/>
<outlet property="container21" destination="Zmk-PV-di2" id="mv0-Sg-r5V"/>
<outlet property="container22" destination="iQu-2n-Y3T" id="Yhg-KD-vzU"/>
<outlet property="container23" destination="OZT-Lo-t7S" id="QcZ-kf-CTr"/>
<outlet property="container41" destination="YMb-PS-dFz" id="siA-pY-GZT"/>
<outlet property="container42" destination="LJL-hy-odj" id="7Bq-4v-uda"/>
<outlet property="hStack1a" destination="aDf-a7-TD5" id="8fs-h9-pfk"/>
<outlet property="hStack1b" destination="ABP-ce-MDa" id="44B-nQ-AOq"/>
<outlet property="hStack2a" destination="91U-hc-Oqn" id="5b4-H7-FU3"/>
<outlet property="hStack2b" destination="4u9-3E-Qwu" id="14V-Za-4Iz"/>
<outlet property="hStack3a" destination="RgJ-XU-xav" id="PLX-zh-AiD"/>
<outlet property="hStack3b" destination="ucv-f0-P2r" id="u9R-aG-IpP"/>
<outlet property="hStack4a" destination="WFa-d3-zcU" id="i8z-Cc-rbi"/>
<outlet property="hStack4b" destination="9WN-7G-oBN" id="eAg-zC-ojV"/>
<outlet property="hStack5a" destination="myS-g5-vsP" id="S4L-12-8qP"/>
<outlet property="hStack5b" destination="2iy-YX-agg" id="iqW-bN-4fc"/>
<outlet property="infographyTitle" destination="4Hu-Ou-nFd" id="0vL-nP-fjY"/>
<outlet property="label11" destination="Hf2-oh-1Oz" id="njE-6s-1Qr"/>
<outlet property="label12" destination="US0-bW-Fa3" id="XVf-Ak-Mi2"/>
<outlet property="label13" destination="7a3-eu-I7F" id="Zhy-aY-QPM"/>
<outlet property="label12" destination="VWQ-ZA-7rt" id="OBf-Fx-clC"/>
<outlet property="label13" destination="iaM-v8-HTO" id="Li5-T2-st6"/>
<outlet property="label21" destination="Hcr-dr-rUz" id="Ggb-ck-2Y7"/>
<outlet property="label22" destination="2yf-Z5-Tpy" id="5yK-A5-sha"/>
<outlet property="label23" destination="hcG-kJ-HS1" id="iKw-Dy-B6C"/>
<outlet property="label31" destination="zHz-52-q8s" id="twI-GF-8Zj"/>
<outlet property="label32" destination="PFl-bw-SwB" id="OhY-3p-Bei"/>
<outlet property="label41" destination="aSt-Fm-PHF" id="43C-8N-8Xk"/>
<outlet property="label42" destination="wcd-nU-zRB" id="WAR-I1-Bej"/>
<outlet property="label51" destination="mDV-nN-W7V" id="QlS-da-9bL"/>
<outlet property="tableView11" destination="HbR-TC-HeD" id="P5k-OS-JgN"/>
<outlet property="tableView12" destination="AOY-yE-egI" id="XYu-ad-tdK"/>
<outlet property="tableView13" destination="D9l-DT-eiv" id="yUh-4y-qns"/>
<outlet property="tableView12" destination="M2m-xf-le9" id="ze0-w3-ZA8"/>
<outlet property="tableView13" destination="Vdb-nD-4Cy" id="XXM-W3-Hu0"/>
<outlet property="tableView31" destination="0h6-mp-rHD" id="Huj-wS-RGv"/>
<outlet property="tableView32" destination="WPJ-0S-klg" id="PzI-hh-uer"/>
<outlet property="tableView51" destination="vqG-Pt-IB2" id="FrK-oS-xF8"/>
<outlet property="tableView32" destination="h84-Ta-8eQ" id="ffQ-bn-NJj"/>
</connections>
<point key="canvasLocation" x="-1700.0000000000002" y="-204.24107142857142"/>
</view>

@ -18,7 +18,7 @@ final class CountryCounter : HTMLRepresentable, Aggregeable {
var copy = table
copy.remove(at: indexOfParam)
let count = copy.reduce(0) { $0 + $1.counter }
return [paramCounter, CountryCounter(country: "Others", counter: count)]
return [paramCounter, CountryCounter(country: "not \(param)", counter: count)]
}
let count = table.reduce(0) { $0 + $1.counter }
@ -60,28 +60,4 @@ final class CountryCounter : HTMLRepresentable, Aggregeable {
return PieChartDataEntry(value: Double(self.counter), label: self.country)
}
// static func htmlHeaders() -> String {
// var strings: [String] = []
// strings.append("Country")
// strings.append("Cashes")
// let all = strings.joined(separator: "</td><td>")
// return "<tr class=\"table-header\"><td>\(all)</td></tr>"
// }
//
// func html() -> String {
//
// let formattedCountry: String
// if let flagoji = Locale.current.flagoji(from: self.country) {
// formattedCountry = "\(flagoji) \(self.country)"
// } else {
// formattedCountry = self.country
// }
//
// var strings: [String] = []
// strings.append(formattedCountry)
// strings.append("\(counter)")
// let all = strings.joined(separator: "</td><td>")
// return "<tr><td>\(all)</td></tr>"
// }
}

@ -56,7 +56,6 @@ class FestivalStats : NSObject, UICollectionViewDataSource, UICollectionViewDele
return cell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 360.0, height: 100.0)
}

@ -9,7 +9,7 @@
import Foundation
import UIKit
class TournamentStats : NSObject, HTMLRepresentable, UITableViewDelegate, UITableViewDataSource {
class TournamentStats : NSObject, HTMLRepresentable, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
var entries: Double
var buyin: Double
@ -122,4 +122,48 @@ class TournamentStats : NSObject, HTMLRepresentable, UITableViewDelegate, UITabl
}
// MARK: - UICollectionViewDataSource
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 4
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Stat", for: indexPath) as! StatCollectionViewCell
let name: String
let value: String
switch indexPath.row {
case 0:
name = "Entries"
value = NumberFormatter().string(from: NSNumber(value: self.entries))!
case 1:
name = "Buy-in".uppercased()
value = Formatter.currency.string(from: NSNumber(value: self.buyin))!
case 2:
name = "Prizepool".uppercased()
value = Formatter.currency.string(from: NSNumber(value: self.prizepool))!
case 3:
name = "Earnings".uppercased()
value = Formatter.currency.string(from: NSNumber(value: self.itmValue))!
default:
name = ""
value = ""
}
cell.nameLabel.text = name.uppercased()
cell.valueLabel.text = value
cell.nameLabel.textColor = UIColor.white
cell.valueLabel.textColor = UIColor.white
cell.nameLabel.font = UIFont.systemFont(ofSize: 20.0)
cell.valueLabel.font = UIFont.systemFont(ofSize: 56.0, weight: .thin)
return cell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 360.0, height: 100.0)
}
}

Loading…
Cancel
Save