tui

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Unlicense Imports: 11 Imported by: 0

Documentation

Overview

Package tui provides the terminal user interface for the Wits application.

Index

Constants

This section is empty.

Variables

View Source
var DevicesSubmenu = []string{
	"➕ Add Device",
	"📋 View Devices",
	"✏️ Edit Device",
	"❌ Remove Device"}

DevicesSubmenu is a list of options for the devices submenu.

View Source
var MainMenu = []string{
	"🌿 Strains",
	"🚀 Devices",
	"🔧 Settings",
	"📊 Stats"}

MainMenu is a list of options for the main menu.

View Source
var SettingsSubmenu = []string{
	"🎨 Appearance",
	"⌨️ Keybindings",
	"🌍 Localization",
	"💾 Backup & Restore"}

SettingsSubmenu is a list of options for the settings submenu.

View Source
var StatsSubmenu = []string{
	"📅 Usage History",
	"📈 Trends",
	"🔢 Dosage Tracker"}

StatsSubmenu is a list of options for the stats submenu.

View Source
var StrainsSubmenu = []string{
	"➕ Add Strain",
	"📋 View Strains",
	"✏️ Edit Strain",
	"❌ Remove Strain"}

StrainsSubmenu is a list of options for the strains submenu.

Functions

func AddStrain

func AddStrain(svc service.StrainService) tea.Model

AddStrain opens a form for adding a new strain and returns the created strain object.

Types

type MenuModel struct {
	Cursor int
	Items  []string
	Menu   string
}

MenuModel is the model for the main menu.

func InitialMenuModel

func InitialMenuModel(sSvc service.StrainService, sStr storage.StrainStore) MenuModel

InitialMenuModel returns the initial model for the main menu.

func (m MenuModel) Init() tea.Cmd

Init is the first function that will be called. It returns an optional initial command. To not perform an initial command return nil.

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

Update is called when a message is received. Use it to inspect messages and, in response, update the model and/or send a command.

func (m MenuModel) View() string

View renders the program's UI, which is just a string. The view is rendered after every Update.

type StrainsListItem

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

StrainsListItem is a list item for strains.

func (StrainsListItem) Description

func (sli StrainsListItem) Description() string

Description returns the description for the list item.

func (StrainsListItem) FilterValue

func (sli StrainsListItem) FilterValue() string

FilterValue returns the filter value for the list item.

func (StrainsListItem) Title

func (sli StrainsListItem) Title() string

Title returns the title for the list item.

type StrainsListModel

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

StrainsListModel is a model for the strains list.

func ListStrains

func ListStrains(svc service.StrainService) *StrainsListModel

ListStrains creates a new model for the strains list.

func (StrainsListModel) Init

func (slm StrainsListModel) Init() tea.Cmd

Init initializes the strains list model.

func (StrainsListModel) Update

func (slm StrainsListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update updates the strains list model.

func (StrainsListModel) View

func (slm StrainsListModel) View() string

View renders the strains list model.

Jump to

Keyboard shortcuts

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