ui

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultTable added in v0.0.2

type DefaultTable struct {
	*tview.Table
}

DefaultTable is the default tview.Table configuration for the application.

Inherits from tview.Table

func NewDefaultTable added in v0.0.3

func NewDefaultTable(title string) *DefaultTable

NewDefaultTable creates a new Table element and applies basic styling.

func (*DefaultTable) SetColorCell added in v0.0.2

func (g *DefaultTable) SetColorCell(row int, col int, text string, color tcell.Color) *DefaultTable

SetColorCell creates a cell that contains text of a specific color within a table.

func (*DefaultTable) SetCustomCell added in v0.0.2

func (g *DefaultTable) SetCustomCell(row, col int, text string, color tcell.Color, align int) *DefaultTable

SetCustomCell creates a customizable cell that contains text within a table.

func (*DefaultTable) SetCustomIntCell added in v0.0.2

func (g *DefaultTable) SetCustomIntCell(row, col, text int, color tcell.Color, align int) *DefaultTable

SetCustomIntCell creates a customizable cell that receives ints as its text value.

func (*DefaultTable) SetHeader added in v0.0.3

func (g *DefaultTable) SetHeader(headerText ...string) *DefaultTable

func (*DefaultTable) SetHeaderCell added in v0.0.2

func (g *DefaultTable) SetHeaderCell(row int, col int, text string) *DefaultTable

SetHeaderCell creates a cell that has a darker color than a standard table cell. Is used to keep table headers/categories uniform.

func (*DefaultTable) SetIntCell added in v0.0.2

func (g *DefaultTable) SetIntCell(row int, col int, text int) *DefaultTable

SetIntCell converts integers into text that can be placed within a cell within a table.

func (*DefaultTable) SetTextCell added in v0.0.2

func (g *DefaultTable) SetTextCell(row int, col int, text string) *DefaultTable

SetTextCell creates a basic cell that contains text within a table.

Is the same as tview.Table.SetCellSimple() but returns *GenericTable instead of *tview.Table.

type GameInfo

type GameInfo struct {
	*DefaultTable
}

GameInfo represents a UI element that displays relevant information of an NFL game.

Inherits from DefaultTable

func NewGameInfo

func NewGameInfo() *GameInfo

NewGameInfo creates a new GameInfo UI element

func (*GameInfo) SetInfo

func (g *GameInfo) SetInfo(game *api.Game)

SetInfo applies game information to a GameInfo UI element

type GameList

type GameList struct {
	*tview.List
}

GameList represents a UI element that displays a selectable list of upcoming/ongoing/recently ended NFL games. Inherits from tview.List

func NewGameList

func NewGameList() *GameList

NewGameList creates a new GameList UI element

type Layout

type Layout struct {
	Outer *tview.Grid
	Inner *tview.Grid

	GameList     *GameList
	Scoreboard   *Scoreboard
	GameInfo     *GameInfo
	ScoreSummary *ScoreSummary
	TeamStats    *TeamStats
	StatPages    *StatPages
	KeyBinds     *tview.TextView
}

Layout represents the overall layout of the app. Contains all UI elements to be displayed within the window

func NewLayout

func NewLayout(games []*api.Game) *Layout

NewLayout creates a new Layout and arranges all UI elements within it.

type PlayerStats

type PlayerStats struct {
	*DefaultTable
	StatType StatType
	SetStats func(game *api.Game)
}

PlayerStats represents a UI element that displays the player stats from a specific NFL game. Can display passing/rushing/receiving stats.

Inherits from DefaultTable

func NewPlayerStats

func NewPlayerStats(title string, statType StatType) *PlayerStats

NewPlayerStats creates a new PlayerStats UI element

type ScoreSummary

type ScoreSummary struct {
	*DefaultTable
}

ScoreSummary represents a UI element that displays a brief description of all scoring plays in a game.

Inherits from DefaultTable

func NewScoreSummary

func NewScoreSummary() *ScoreSummary

NewScoreSummary creates a new ScoreSummary element

func (*ScoreSummary) SetScoreSummary

func (s *ScoreSummary) SetScoreSummary(game *api.Game)

SetScoreSummary populates a ScoreSummary element with details of scoring plays.

type Scoreboard

type Scoreboard struct {
	*DefaultTable
}

Scoreboard represents a UI element that shows the scores of an NFL game quarter by quarter

Inherits from DefaultTable

func NewScoreboard

func NewScoreboard() *Scoreboard

NewScoreboard creates a new Scoreboard element

func (*Scoreboard) SetScores

func (s *Scoreboard) SetScores(game *api.Game)

SetScores populates the scoreboard with the current scores of a game.

type StatPages

type StatPages struct {
	*tview.Pages

	ActivePage *statPage
	// contains filtered or unexported fields
}

StatPages is a container that holds all statPage elements

func NewStatPages

func NewStatPages() *StatPages

NewStatPages creates statPage elements for all stat types

func (*StatPages) NextPage added in v0.0.3

func (s *StatPages) NextPage()

NextPage switches to the next stat page depending on the current active stat page

func (*StatPages) PrevPage added in v0.0.3

func (s *StatPages) PrevPage()

PrevPage switches to the previous stat page depending on the current active stat page

func (*StatPages) SetStats

func (s *StatPages) SetStats(game *api.Game)

SetStats populates the stat pages with their respective stats

type StatType added in v0.0.3

type StatType int
const (
	Passing   StatType = 0
	Rushing   StatType = 1
	Receiving StatType = 2
	Defense   StatType = 3
	Kicking   StatType = 4
	Punting   StatType = 5
	KickRet   StatType = 6
	PuntRet   StatType = 7
)

type TeamStats

type TeamStats struct {
	*DefaultTable
}

TeamStats represents a UI element that displays basic team stats for an NFL game.

Inherits from DefaultTable

func NewTeamStats

func NewTeamStats() *TeamStats

NewTeamStats creates a new TeamStats element.

func (*TeamStats) SetStats

func (t *TeamStats) SetStats(game *api.Game)

SetStats populates a TeamStats element with stats from a specific NFL game.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL