tui

package
v0.3.0-beta Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxContentWidth = 100
	MinContentWidth = 60
)

Layout constants

Variables

View Source
var (
	// Title style for headers
	TitleStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(colorPrimary).
				MarginBottom(1)

	// Subtle text style
	SubtleStyle = lipgloss.NewStyle().
				Foreground(colorMuted)

	// Highlight style for selected items
	HighlightStyle = lipgloss.NewStyle().
					Foreground(colorHighlight).
					Bold(true)

	// Error style
	ErrorStyle = lipgloss.NewStyle().
				Foreground(colorDanger)

	// Success style
	SuccessStyle = lipgloss.NewStyle().
					Foreground(colorSuccess)

	// Warning style
	WarningStyle = lipgloss.NewStyle().
					Foreground(colorWarning)
)

Common styles

View Source
var (
	// Selected row style
	SelectedRowStyle = lipgloss.NewStyle().
						Background(colorBgAlt).
						Foreground(colorHighlight).
						Bold(true)

	// Normal row style
	NormalRowStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color("#CCCCCC"))

	// Header style for tables
	HeaderStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(colorPrimary).
				BorderStyle(lipgloss.NormalBorder()).
				BorderBottom(true).
				BorderForeground(colorSecondary)
)

List view styles

View Source
var (
	// Label style for field names
	LabelStyle = lipgloss.NewStyle().
				Foreground(colorSecondary).
				Width(15)

	// Value style for field values
	ValueStyle = lipgloss.NewStyle().
				Foreground(colorHighlight)

	// Section header style
	SectionStyle = lipgloss.NewStyle().
					Foreground(colorPrimary).
					Bold(true).
					MarginTop(1).
					MarginBottom(1).
					BorderStyle(lipgloss.NormalBorder()).
					BorderBottom(true).
					BorderForeground(colorSecondary)

	// Box style for detail panels
	BoxStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(colorSecondary).
				Padding(1, 2)
)

Detail view styles

View Source
var (
	// Focused input style
	FocusedInputStyle = lipgloss.NewStyle().
						Foreground(colorPrimary).
						BorderStyle(lipgloss.RoundedBorder()).
						BorderForeground(colorPrimary)

	// Blurred input style
	BlurredInputStyle = lipgloss.NewStyle().
						Foreground(colorMuted).
						BorderStyle(lipgloss.RoundedBorder()).
						BorderForeground(colorMuted)

	// Button style
	ButtonStyle = lipgloss.NewStyle().
				Foreground(colorHighlight).
				Background(colorPrimary).
				Padding(0, 2).
				MarginRight(1)

	// Disabled button style
	DisabledButtonStyle = lipgloss.NewStyle().
						Foreground(colorMuted).
						Background(colorBgAlt).
						Padding(0, 2).
						MarginRight(1)
)

Form styles

View Source
var (
	HelpKeyStyle = lipgloss.NewStyle().
					Foreground(colorPrimary).
					Bold(true)

	HelpDescStyle = lipgloss.NewStyle().
					Foreground(colorMuted)

	HelpSepStyle = lipgloss.NewStyle().
					Foreground(colorSecondary)
)

Help styles

View Source
var StatusBarStyle = lipgloss.NewStyle().
	Foreground(colorMuted).
	Background(colorBgAlt).
	Padding(0, 1)

Status bar style

Functions

func GetStatusColor

func GetStatusColor(status string) lipgloss.Color

GetStatusColor returns the color for a given status

func StatusBadgeStyle

func StatusBadgeStyle(status string) lipgloss.Style

Status badge style

Types

type App

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

App is the main Bubble Tea model

func New

func New(s *store.Store) App

New creates a new App

func (App) Init

func (a App) Init() tea.Cmd

Init initializes the app

func (App) Update

func (a App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages

func (App) View

func (a App) View() string

View renders the app

type DetailView

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

DetailView displays a single job application's details

func NewDetailView

func NewDetailView(app *model.Application, keys KeyMap) DetailView

NewDetailView creates a new detail view

func (*DetailView) HandleKey

func (d *DetailView) HandleKey(msg tea.KeyMsg) (handled bool, action string)

HandleKey processes a key press and returns the action

func (*DetailView) SetApplication

func (d *DetailView) SetApplication(app *model.Application)

SetApplication sets the application to display

func (*DetailView) SetSize

func (d *DetailView) SetSize(width, height int)

SetSize sets the view dimensions

func (*DetailView) View

func (d *DetailView) View() string

View renders the detail view

type FormField

type FormField int

FormField represents the different fields in the form

const (
	FieldCompany FormField = iota
	FieldPosition
	FieldStatus
	FieldDateApplied
	FieldLocation
	FieldRemote
	FieldSalaryMin
	FieldSalaryMax
	FieldJobURL
	FieldContactName
	FieldContactEmail
	FieldResumeVersion
	FieldCoverLetter
	FieldNotes
	FieldCount // Used to track total number of fields
)

type FormView

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

FormView handles adding and editing applications

func NewFormView

func NewFormView(keys KeyMap) FormView

NewFormView creates a new form for adding/editing applications

func (*FormView) FocusedField

func (f *FormView) FocusedField() FormField

FocusedField returns the currently focused field type

func (*FormView) FocusedInput

func (f *FormView) FocusedInput() textinput.Model

FocusedInput returns the currently focused input

func (*FormView) GetApplication

func (f *FormView) GetApplication() model.Application

GetApplication returns the application from form data

func (*FormView) HandleKey

func (f *FormView) HandleKey(msg tea.KeyMsg) (handled bool, action string)

HandleKey processes key input

func (*FormView) Reset

func (f *FormView) Reset()

Reset clears the form for a new entry

func (*FormView) SetApplication

func (f *FormView) SetApplication(app *model.Application)

SetApplication populates the form for editing

func (*FormView) SetSize

func (f *FormView) SetSize(width, height int)

SetSize sets the view dimensions

func (*FormView) UpdateInput

func (f *FormView) UpdateInput(msg textinput.Model)

UpdateInput updates the focused input

func (*FormView) Validate

func (f *FormView) Validate() bool

Validate checks if the form is valid

func (*FormView) View

func (f *FormView) View() string

View renders the form

type KeyMap

type KeyMap struct {
	// Navigation
	Up     key.Binding
	Down   key.Binding
	Left   key.Binding
	Right  key.Binding
	Top    key.Binding
	Bottom key.Binding

	// Actions
	Add    key.Binding
	Edit   key.Binding
	Delete key.Binding
	Enter  key.Binding
	Back   key.Binding

	// Status shortcuts
	Status1 key.Binding
	Status2 key.Binding
	Status3 key.Binding
	Status4 key.Binding
	Status5 key.Binding
	Status6 key.Binding
	Status7 key.Binding
	Status8 key.Binding

	// Search and filter
	Search key.Binding
	Filter key.Binding
	Clear  key.Binding

	// General
	Help key.Binding
	Quit key.Binding
	Tab  key.Binding

	// Form specific
	Submit key.Binding
	Cancel key.Binding
}

KeyMap defines all keybindings for the application

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default keybindings

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns keybindings for the expanded help view

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns keybindings to show in the mini help view

type ListView

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

ListView displays a list of job applications

func NewListView

func NewListView(apps []model.Application, keys KeyMap) ListView

NewListView creates a new list view

func (*ListView) FilterStatus

func (l *ListView) FilterStatus() string

FilterStatus returns the current filter status

func (*ListView) HandleKey

func (l *ListView) HandleKey(msg tea.KeyMsg) (handled bool, action string)

HandleKey processes a key press and returns true if handled

func (*ListView) IsSearchMode

func (l *ListView) IsSearchMode() bool

IsSearchMode returns true if in search mode

func (*ListView) MoveDown

func (l *ListView) MoveDown()

MoveDown moves the cursor down

func (*ListView) MoveUp

func (l *ListView) MoveUp()

MoveUp moves the cursor up

func (*ListView) SearchInput

func (l *ListView) SearchInput() textinput.Model

SearchInput returns the search input model

func (*ListView) SearchQuery

func (l *ListView) SearchQuery() string

SearchQuery returns the current search query

func (*ListView) SelectedApplication

func (l *ListView) SelectedApplication() *model.Application

SelectedApplication returns the currently selected application

func (*ListView) SetApplications

func (l *ListView) SetApplications(apps []model.Application)

SetApplications updates the applications list

func (*ListView) SetFilterStatus

func (l *ListView) SetFilterStatus(status string)

SetFilterStatus sets the filter status

func (*ListView) SetSize

func (l *ListView) SetSize(width, height int)

SetSize sets the view dimensions

func (*ListView) UpdateSearchInput

func (l *ListView) UpdateSearchInput(msg textinput.Model)

UpdateSearchInput updates the search input

func (*ListView) View

func (l *ListView) View() string

View renders the list view

type ViewState

type ViewState int

ViewState represents the current view

const (
	ViewSplash ViewState = iota
	ViewList
	ViewDetail
	ViewForm
	ViewFilter
	ViewConfirmDelete
)

Jump to

Keyboard shortcuts

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