Skip to content

Commit

Permalink
Adds Team rookie year and Event week number to respective views (#967)
Browse files Browse the repository at this point in the history
* info

* remove new line
  • Loading branch information
leongmichael authored Aug 13, 2024
1 parent 1951d31 commit 6c91ddf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class EventInfoViewController: TBATableViewController, Observable {
return cell
case .twitter:
let cell = self.tableView(tableView, detailCellForRowAtIndexPath: indexPath)
cell.textLabel?.text = "View #\(self.event.key) on Twitter"
cell.textLabel?.text = "View \(self.event.key) on Twitter"
return cell
case .youtube:
let cell = self.tableView(tableView, detailCellForRowAtIndexPath: indexPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ private enum TeamInfoSection: Int {

private enum TeamInfoItem {
case location
case rookieYear
case sponsors
case website
case twitter
Expand Down Expand Up @@ -75,6 +76,8 @@ class TeamInfoViewController: TBATableViewController, Observable {
switch item {
case .location:
return self.tableView(tableView, locationCellForRowAt: indexPath)
case .rookieYear:
return self.tableView(tableView, rookieYearCellForRowAt: indexPath)
case .sponsors:
return self.tableView(tableView, sponsorCellForRowAt: indexPath)
case .website:
Expand All @@ -83,7 +86,7 @@ class TeamInfoViewController: TBATableViewController, Observable {
return cell
case .twitter:
let cell = self.tableView(tableView, linkCellForRowAt: indexPath)
cell.textLabel?.text = "View #\(self.team.key) on Twitter"
cell.textLabel?.text = "View \(self.team.key) on Twitter"
return cell
case .youtube:
let cell = self.tableView(tableView, linkCellForRowAt: indexPath)
Expand All @@ -108,7 +111,8 @@ class TeamInfoViewController: TBATableViewController, Observable {
infoItems.append(.location)
}
if team.name != nil {
infoItems.append(.sponsors)
infoItems.append(.rookieYear)
infoItems.append(.sponsors)
}

if !infoItems.isEmpty {
Expand Down Expand Up @@ -146,6 +150,18 @@ class TeamInfoViewController: TBATableViewController, Observable {

return cell
}

private func tableView(_ tableView: UITableView, rookieYearCellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(indexPath: indexPath) as ReverseSubtitleTableViewCell

cell.titleLabel?.text = "Rookie Year"
cell.subtitleLabel?.text = String(team.rookieYear!)

cell.accessoryType = .none
cell.selectionStyle = .none

return cell
}

private func tableView(_ tableView: UITableView, sponsorCellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(indexPath: indexPath) as BasicTableViewCell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct InfoCellViewModel {

init(event: Event) {
nameString = event.name ?? event.key
subtitleStrings = [event.locationString, event.dateString].compactMap({ $0 })
subtitleStrings = [event.locationString, event.dateString, event.weekString].compactMap({ $0 })
}

init(team: Team) {
Expand Down

0 comments on commit 6c91ddf

Please sign in to comment.