models

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorModel

type ErrorModel struct {
	// contains filtered or unexported fields
}

func NewErrorModel

func NewErrorModel(theme Theme, err string) ErrorModel

func (ErrorModel) Init

func (m ErrorModel) Init() tea.Cmd

func (*ErrorModel) SetWidthAndHeight

func (m *ErrorModel) SetWidthAndHeight(width int, height int)

func (ErrorModel) Update

func (m ErrorModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ErrorModel) View

func (m ErrorModel) View() string

type HeaderModel added in v0.3.0

type HeaderModel struct {
	// contains filtered or unexported fields
}

func NewHeaderModel added in v0.3.0

func NewHeaderModel(theme Theme, playbackManager playback.PlaybackManagerService) HeaderModel

func (HeaderModel) Init added in v0.3.0

func (m HeaderModel) Init() tea.Cmd

func (HeaderModel) Update added in v0.3.0

func (m HeaderModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (HeaderModel) View added in v0.3.0

func (m HeaderModel) View() string

type LoadingModel

type LoadingModel struct {
	// contains filtered or unexported fields
}

func NewLoadingModel

func NewLoadingModel(
	theme Theme,
	browser api.RadioBrowserService,
	query common.StationQuery,
	queryText string,
) LoadingModel

func (LoadingModel) Init

func (m LoadingModel) Init() tea.Cmd

func (*LoadingModel) SetWidthAndHeight

func (m *LoadingModel) SetWidthAndHeight(width int, height int)

func (LoadingModel) Update

func (m LoadingModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (LoadingModel) View

func (m LoadingModel) View() string

type Model

type Model struct {
	// contains filtered or unexported fields
}

func NewDefaultModel

func NewDefaultModel(config config.Config) (Model, error)

func NewModel

func NewModel(
	config config.Config,
	browser api.RadioBrowserService,
	playbackManager playback.PlaybackManagerService,
) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type SearchModel

type SearchModel struct {
	// contains filtered or unexported fields
}

func NewSearchModel

func NewSearchModel(theme Theme) SearchModel

func (SearchModel) Init

func (m SearchModel) Init() tea.Cmd

func (*SearchModel) SetWidthAndHeight

func (m *SearchModel) SetWidthAndHeight(width int, height int)

func (SearchModel) Update

func (m SearchModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SearchModel) View

func (m SearchModel) View() string

type SelectorModel

type SelectorModel[T StringRenderable] struct {
	// contains filtered or unexported fields
}

func NewSelectorModel

func NewSelectorModel[T StringRenderable](theme Theme, title string, items []T, initialSelection int) SelectorModel[T]

func (*SelectorModel[T]) Blur

func (m *SelectorModel[T]) Blur()

func (*SelectorModel[T]) Focus

func (m *SelectorModel[T]) Focus()

func (SelectorModel[T]) Focused

func (m SelectorModel[T]) Focused() bool

func (SelectorModel[T]) Init

func (m SelectorModel[T]) Init() tea.Cmd

func (SelectorModel[T]) Selection

func (m SelectorModel[T]) Selection() T

func (SelectorModel[T]) Update

func (m SelectorModel[T]) Update(msg tea.Msg) (SelectorModel[T], tea.Cmd)

func (SelectorModel[T]) View

func (m SelectorModel[T]) View() string

type StationsModel

type StationsModel struct {
	// contains filtered or unexported fields
}

func NewStationsModel

func NewStationsModel(
	theme Theme,
	browser api.RadioBrowserService,
	playbackManager playback.PlaybackManagerService,
	stations []common.Station,
) StationsModel

func (StationsModel) Init

func (m StationsModel) Init() tea.Cmd

func (*StationsModel) SetWidthAndHeight

func (m *StationsModel) SetWidthAndHeight(width int, height int)

func (StationsModel) Update

func (m StationsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (StationsModel) View

func (m StationsModel) View() string

type StringRenderable

type StringRenderable interface {
	Render() string
}

type Theme added in v0.2.0

type Theme struct {
	PrimaryBlock   lipgloss.Style
	SecondaryBlock lipgloss.Style

	Text          lipgloss.Style
	PrimaryText   lipgloss.Style
	SecondaryText lipgloss.Style
	TertiaryText  lipgloss.Style
	ErrorText     lipgloss.Style

	StationsTableStyle table.Styles
}

Theme represents a style configuration for the application.

func NewTheme added in v0.3.0

func NewTheme(config config.Config) Theme

func (Theme) StyleBottomBar added in v0.2.0

func (t Theme) StyleBottomBar(commands []string) string

StyleBottomBar returns a string representing the styled bottom bar of the given Theme. It takes a slice of strings representing the commands to be displayed in the bottom bar. The function iterates over the commands and applies a different style to each one based on its index. If the index is even, the command is styled with the primary color of the Theme as background. If the index is odd, the command is styled with the secondary color of the Theme as background. The styled commands are concatenated into a single string and returned.

Jump to

Keyboard shortcuts

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