tui

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Starting color of the progress bar
	ProgressStart = lipgloss.Color("#1B6B93")
	// Ending color of the progress bar
	ProgressEnd = lipgloss.Color("#A2FF86")
)
View Source
const (
	Recipes = iota
	ChangeSettings
	ChangeRecipe
	Amount
	Crafter
)

Indices for Models slice

View Source
const MaxNameLength = 25

Max length of the recipe name

View Source
const StatusMsgLifetime = 10 * time.Second

Variables

View Source
var (
	// Height of terminal window
	WindowHeight int
	// Width of terminal window
	WindowWidth int

	// Slice to manage models
	Models = []tea.Model{nil, nil, nil, nil, nil}

	StartPause string
	Stop       string
	Confirm    string
	Cancel     string
)

Functions

func ConvertItemsToRecipes

func ConvertItemsToRecipes(items []Item) []utils.Recipe

ConvertItemsToRecipes takes a slice of Item structs and returns a slice of utils.Recipe structs

func NewItemDelegate

func NewItemDelegate() list.ItemDelegate

Types

type Input

type Input struct {
	// Get user input for the amount to craft
	Input textinput.Model

	// Help model
	Help help.Model
	// contains filtered or unexported fields
}

func NewInput

func NewInput() *Input

NewInput returns a pointer to an Input struct

func (Input) Init

func (m Input) Init() tea.Cmd

func (Input) Update

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

func (Input) View

func (m Input) View() string

type Item

type Item struct {

	// Name of recipe
	Name string

	// Food hotkey
	Food string
	// Duration of food
	FoodDuration int
	// Potion hotkey
	Potion string

	// Macro 1 hotkey
	Macro1 string
	// Duration of macro 1
	Macro1Duration int
	// Macro 2 hotkey
	Macro2 string
	// Duration of macro 2
	Macro2Duration int
	// Macro 3 hotkey
	Macro3 string
	// Duration of macro 3
	Macro3Duration int
}

func ConvertListItemToItem

func ConvertListItemToItem(listItems []list.Item) []Item

ConvertListItemToItem takes in a list.Item slice and converts it into an Item slice

func (Item) Description

func (i Item) Description() string

func (Item) FilterValue

func (i Item) FilterValue() string

func (Item) PrintItemDetails

func (i Item) PrintItemDetails() string

PrintItemDetails returns a stylized string with details of the Item struct

func (Item) Title

func (i Item) Title() string

type List

type List struct {
	// List model
	Recipes list.Model

	// Flag to edit item
	Edit bool
	// contains filtered or unexported fields
}

func NewList

func NewList(items []list.Item) *List

NewList returns a pointer to a List struct

func (List) Init

func (m List) Init() tea.Cmd

func (List) Update

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

func (List) View

func (m List) View() string

type Progress

type Progress struct {
	// Show crafting progress
	Crafter  *crafter.Crafter
	Progress progress.Model

	// Help model
	Help help.Model
	// contains filtered or unexported fields
}

func NewProgress

func NewProgress() *Progress

NewProgress returns a pointer to a Progress struct

func (Progress) Init

func (m Progress) Init() tea.Cmd

func (Progress) Update

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

func (Progress) View

func (m Progress) View() string

type Settings

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

func NewSettings

func NewSettings(startPause string, stop string, confirm string, cancel string) *Settings

NewSettings returns a pointer to a NewSettings struct

type UpdateRecipe

type UpdateRecipe struct {
	NameModel textinput.Model

	FoodModel textinput.Model

	FoodDurationModel textinput.Model

	PotionModel textinput.Model

	Macro1Model textinput.Model

	Macro1DurationModel textinput.Model

	Macro2Model textinput.Model

	Macro2DurationModel textinput.Model

	Macro3Model textinput.Model

	Macro3DurationModel textinput.Model

	// Help model
	Help help.Model

	// Status message
	Msg string
	// contains filtered or unexported fields
}

func NewUpdateRecipe

func NewUpdateRecipe() *UpdateRecipe

NewUpdateRecipe returns a pointer to an UpdateRecipe struct

func (*UpdateRecipe) AddPlaceholders

func (m *UpdateRecipe) AddPlaceholders(item Item)

AddPlaceholders updates the textinput.Model Placeholder fields to show the value from Item

func (UpdateRecipe) Init

func (m UpdateRecipe) Init() tea.Cmd

func (UpdateRecipe) Update

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

func (UpdateRecipe) View

func (m UpdateRecipe) View() string

type UpdateSettings

type UpdateSettings struct {
	StartPauseModel textinput.Model

	StopModel textinput.Model

	ConfirmModel textinput.Model

	CancelModel textinput.Model

	// Help model
	Help help.Model

	// Status message
	Msg string
	// contains filtered or unexported fields
}

func NewUpdateSettings

func NewUpdateSettings() *UpdateSettings

NewUpdateSettings returns a pointer to an UpdateSettings struct

func (*UpdateSettings) AddPlaceholders

func (m *UpdateSettings) AddPlaceholders(settings Settings)

AddPlaceholders updates the textinput.Model Placeholder fields to show the value from Item

func (UpdateSettings) Init

func (m UpdateSettings) Init() tea.Cmd

func (UpdateSettings) Update

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

func (UpdateSettings) View

func (m UpdateSettings) View() string

Jump to

Keyboard shortcuts

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