app

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FormKind

type FormKind int

type Mode

type Mode int

type Model

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

func NewModel

func NewModel(store *data.Store, options Options) (*Model, error)

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 Options

type Options struct {
	DBPath     string
	ConfigPath string
	LLMConfig  *llmConfig // nil if LLM is not configured
}

func (*Options) SetLLM added in v1.22.0

func (o *Options) SetLLM(baseURL, model, extraContext string)

SetLLM configures the LLM backend on the Options. Pass empty strings to disable the LLM feature.

type Styles

type Styles struct {
	Header          lipgloss.Style
	HeaderBox       lipgloss.Style
	HeaderTitle     lipgloss.Style
	HeaderHint      lipgloss.Style
	HeaderBadge     lipgloss.Style
	HeaderSection   lipgloss.Style
	HeaderLabel     lipgloss.Style
	HeaderValue     lipgloss.Style
	Keycap          lipgloss.Style
	TabActive       lipgloss.Style
	TabInactive     lipgloss.Style
	TabLocked       lipgloss.Style
	TabUnderline    lipgloss.Style
	TableHeader     lipgloss.Style
	TableSelected   lipgloss.Style
	TableSeparator  lipgloss.Style
	ColActiveHeader lipgloss.Style
	FormClean       lipgloss.Style
	FormDirty       lipgloss.Style
	ModeNormal      lipgloss.Style
	ModeEdit        lipgloss.Style
	Money           lipgloss.Style
	Readonly        lipgloss.Style
	Drilldown       lipgloss.Style
	Empty           lipgloss.Style
	Error           lipgloss.Style
	Info            lipgloss.Style
	DeletedLabel    lipgloss.Style
	Pinned          lipgloss.Style
	LinkIndicator   lipgloss.Style
	Breadcrumb      lipgloss.Style
	BreadcrumbArrow lipgloss.Style
	FilterMark      lipgloss.Style // dot between tabs when filter is active
	HiddenLeft      lipgloss.Style // hidden cols to the left of cursor
	HiddenRight     lipgloss.Style // hidden cols to the right of cursor
	DashSubtitle    lipgloss.Style // dashboard subtitle (house name, date)
	DashSection     lipgloss.Style // dashboard section header
	DashSectionWarn lipgloss.Style // dashboard section header (overdue/warning)
	DashRule        lipgloss.Style // dashboard horizontal rule
	DashLabel       lipgloss.Style // dashboard dim label text
	DashValue       lipgloss.Style // dashboard bright value text
	DashOverdue     lipgloss.Style // overdue maintenance item
	DashUpcoming    lipgloss.Style // upcoming maintenance (within 30 days)
	CalCursor       lipgloss.Style // calendar: cursor day
	CalSelected     lipgloss.Style // calendar: previously selected day
	CalToday        lipgloss.Style // calendar: today marker
	ChatUser        lipgloss.Style // chat: user message label
	ChatAssistant   lipgloss.Style // chat: assistant message label
	ChatNotice      lipgloss.Style // chat: system notice (model switch, pull progress)
	ChatInterrupted lipgloss.Style // chat: user-initiated cancellation
	StatusStyles    map[string]lipgloss.Style
}

func DefaultStyles

func DefaultStyles() Styles

type Tab

type Tab struct {
	Kind        TabKind
	Name        string
	Handler     TabHandler
	Table       table.Model
	Rows        []rowMeta
	Specs       []columnSpec
	CellRows    [][]cell
	ColCursor   int
	ViewOffset  int // first visible column in horizontal scroll viewport
	LastDeleted *uint
	ShowDeleted bool
	Sorts       []sortEntry
	Stale       bool // true when data may be outdated; cleared on reload

	// Pin-and-filter state.
	Pins         []filterPin // active pins; AND across columns, OR within
	FilterActive bool        // true = non-matching rows hidden; false = preview only

	// Full data (pre-row-filter). Populated by reloadTab after project status
	// filtering. Row filter operates on these without hitting the DB.
	FullRows     []table.Row
	FullMeta     []rowMeta
	FullCellRows [][]cell
}

func NewTabs

func NewTabs(styles Styles) []Tab

type TabHandler

type TabHandler interface {
	// FormKind returns the FormKind that identifies this entity in forms and
	// undo entries.
	FormKind() FormKind

	// Load fetches entities and converts them to table rows.
	Load(store *data.Store, showDeleted bool) ([]table.Row, []rowMeta, [][]cell, error)

	// Delete soft-deletes the entity with the given ID.
	Delete(store *data.Store, id uint) error

	// Restore reverses a soft-delete.
	Restore(store *data.Store, id uint) error

	// StartAddForm opens a "new entity" form on the model.
	StartAddForm(m *Model) error

	// StartEditForm opens an "edit entity" form for the given ID.
	StartEditForm(m *Model, id uint) error

	// InlineEdit opens a single-field editor for the given column.
	InlineEdit(m *Model, id uint, col int) error

	// SubmitForm persists the current form data (create or update).
	SubmitForm(m *Model) error

	// Snapshot captures the current DB state of an entity for undo/redo.
	Snapshot(store *data.Store, id uint) (undoEntry, bool)

	// SyncFixedValues updates column specs with values from dynamic lookup
	// tables so column widths stay stable.
	SyncFixedValues(m *Model, specs []columnSpec)
}

TabHandler encapsulates entity-specific operations for a tab, eliminating TabKind/FormKind switch dispatch scattered across the codebase. Each entity type (projects, quotes, maintenance, appliances) implements this interface.

type TabKind

type TabKind int

func (TabKind) String

func (k TabKind) String() string

Jump to

Keyboard shortcuts

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