components

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package components contains reusable Bubble Tea overlays and chrome for the Jira TUI. Patterns mirror pagerduty-client/internal/tui/components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorToANSIBg

func ColorToANSIBg(c color.Color) string

ColorToANSIBg converts a color to an ANSI 24-bit bg escape.

func LabelledBorder

func LabelledBorder(width int, borderStyle lipgloss.Style, left, right string) string

LabelledBorder renders ── left ────────── right ── as a horizontal rule.

func PersistBg

func PersistBg(line, bg string) string

PersistBg re-emits the bg escape after every inner SGR so foreground color changes don't blow away the row background. This is the only way to reliably highlight a row that contains colored cells.

func PersistBgFull

func PersistBgFull(line, bg string, width int) string

PersistBgFull right-pads `line` to `width` then applies PersistBg so the background spans the full terminal row even after wrapping.

func RenderOverlay

func RenderOverlay(content string, minWidth int) string

RenderOverlay wraps content in the standard overlay style (rounded border, dim foreground, no background — inherits the terminal's default bg so the overlay works on any color scheme).

Types

type Confirm

type Confirm struct {
	Visible bool
	// contains filtered or unexported fields
}

Confirm is a modal y/n dialog used by destructive workflows (clone/move/delete) and any other action that needs an explicit OK.

func (Confirm) Init

func (c Confirm) Init() tea.Cmd

func (Confirm) Show

func (c Confirm) Show(title, message string, onYes tea.Cmd) Confirm

Show returns a new Confirm with Visible=true and the supplied prompt. The original is unmodified — callers reassign: c = c.Show(...).

func (Confirm) Update

func (c Confirm) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Confirm) View

func (c Confirm) View() tea.View

type ConfirmResult

type ConfirmResult struct {
	Confirmed bool
	OnYes     tea.Cmd
}

ConfirmResult is emitted when the user accepts or cancels a confirmation. When Confirmed is true, OnYes carries the action command to execute.

type FilterAppliedMsg

type FilterAppliedMsg struct {
	Origin     string
	Selections map[string]string
}

FilterAppliedMsg is emitted when the user confirms a filter selection.

type FilterClosed

type FilterClosed struct{}

FilterClosed is emitted when the user dismisses the overlay.

type FilterOptions

type FilterOptions struct {
	Visible bool
	// contains filtered or unexported fields
}

FilterOptions is a Bubble Tea overlay that lets the user cycle through per-field choices. Data-driven so callers supply rows at show-time.

func NewFilterOptions

func NewFilterOptions() FilterOptions

NewFilterOptions returns an empty overlay ready to be Show()n.

func (FilterOptions) Init

func (f FilterOptions) Init() tea.Cmd

func (FilterOptions) IssueState

func (f FilterOptions) IssueState() IssueFilterState

IssueState reads selections back into a typed IssueFilterState.

func (FilterOptions) Origin

func (f FilterOptions) Origin() string

Origin returns the tab id that opened the overlay.

func (FilterOptions) Selections

func (f FilterOptions) Selections() map[string]string

Selections returns label → currently-selected-value for every row.

func (FilterOptions) ShowWithRows

func (f FilterOptions) ShowWithRows(origin string, rows []FilterRow) FilterOptions

ShowWithRows opens the overlay with the given rows and origin tag. Reassign: f = f.ShowWithRows("issues", IssueFilterRows(state)).

func (FilterOptions) Update

func (f FilterOptions) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (FilterOptions) View

func (f FilterOptions) View() tea.View

type FilterRow

type FilterRow struct {
	Label   string
	Choices []string
	Current int
}

FilterRow describes a single row in the filter overlay.

func IssueFilterRows

func IssueFilterRows(state IssueFilterState) []FilterRow

IssueFilterRows returns the default rows for the issues tab.

type Footer struct {
	Help helpbar.Model
}

func NewFooter

func NewFooter() Footer

func (Footer) Render

func (f Footer) Render() string
type Header struct {
	Profile string
	Tab     string
}

func (Header) Render

func (h Header) Render() string

type Help

type Help struct {
	Visible     bool
	CurrentView string
}

Help is a Bubble Tea model that renders a context-aware keybinding overlay.

func (Help) Init

func (h Help) Init() tea.Cmd

func (Help) Update

func (h Help) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Help) View

func (h Help) View() tea.View

type HintContext

type HintContext struct {
	View         string // "dashboard", "detail", "epics", "search", "activity"
	FilterActive bool
	Paused       bool
	Editing      bool
}

HintContext picks the right keybinding hints for the bottom hint line.

type InputCancelled

type InputCancelled struct{}

InputCancelled is emitted when the user dismisses a TextInput overlay.

type InputSubmitted

type InputSubmitted struct {
	Action   string
	Value    string
	IssueKey string
	Document *adf.Document
}

InputSubmitted is emitted when the user presses Enter in a TextInput overlay. Action labels the originating intent (e.g. "comment", "worklog") so the parent App can dispatch the correct mutation.

Rich-text actions (currently "comment") attach Document so the App can route the typed ADF document directly to Jira with no convert-on-submit step. Non-rich-text actions ("transition", "worklog") leave Document nil and the App reads Value as before.

type IssueFilterState

type IssueFilterState struct {
	// Assignment ∈ {all, me, unassigned, team}.
	Assignment string
	// Status ∈ {all, open, in-progress, done}.
	Status string
	// Priority ∈ {all, highest, high, medium, low, lowest}.
	Priority string
}

IssueFilterState captures the structured filter applied to the issue list. Defaults are the "show everything" values, so a fresh state matches all issues (other than the text filter, which is independent).

func DefaultIssueFilterState

func DefaultIssueFilterState() IssueFilterState

DefaultIssueFilterState returns the "match everything" defaults.

func (IssueFilterState) ChipSummary

func (s IssueFilterState) ChipSummary() string

ChipSummary returns a space-separated `key:value` summary of fields that differ from the defaults — used for the status bar hint and tests.

func (IssueFilterState) IsDefault

func (s IssueFilterState) IsDefault() bool

IsDefault reports whether the state matches DefaultIssueFilterState.

type StatusBar

type StatusBar struct {
	Profile     string
	Total       int
	Open        int
	Done        int
	LastRefresh time.Time
	Paused      bool
	Width       int
	StatusMsg   string
	Hint        HintContext
}

StatusBar renders the bottom chrome: a labeled separator with profile + refresh state, and a hint line of contextual keybindings.

func (StatusBar) Init

func (s StatusBar) Init() tea.Cmd

func (StatusBar) Update

func (s StatusBar) Update(_ tea.Msg) (tea.Model, tea.Cmd)

func (StatusBar) View

func (s StatusBar) View() tea.View

type Tabs

type Tabs struct {
	Items  []string
	Active int
}

func (Tabs) Render

func (t Tabs) Render() string

type TextInput

type TextInput struct {
	Visible bool
	// contains filtered or unexported fields
}

TextInput is a modal single-line input overlay.

When Action is a rich-text action ("comment"), an editor.Editor instance is the source of truth. Plain keystrokes are mirrored as Editor.InsertText / Editor.DeleteLastRune as they arrive. Markdown- style shortcut tokens (`**…**`) are detected at their CLOSING `**` by scanning the visible buffer; the markers are stripped from BOTH the visible buffer AND the editor's text, and a `strong` mark is applied to the inner run via Editor.ApplyMarkToCurrentParagraphRange.

Crucially, ApplyMarkToCurrentParagraphRange splits text nodes at the range boundaries — earlier marks (e.g., from a previous closed `**…**` run earlier in the same input) are PRESERVED. Backspace also routes through DeleteLastRune which preserves marks on the remaining text rather than rebuilding the editor from scratch.

On submit, Editor.Document() is attached to InputSubmitted; there is no adf.FromMarkdown call at submit: the TUI submit path MUST send the current ADF document directly to Jira with no convert-on-submit step.

func NewTextInput

func NewTextInput() TextInput

func (TextInput) Init

func (t TextInput) Init() tea.Cmd

func (TextInput) Show

func (t TextInput) Show(action, issueKey, prompt, placeholder string) TextInput

Show makes the overlay visible with the given context. Reassign:

t = t.Show("comment", "PROJ-1", "Add comment:", "")

func (TextInput) Update

func (t TextInput) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (TextInput) View

func (t TextInput) View() tea.View

type Toast

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

func (Toast) Active

func (t Toast) Active() bool

func (*Toast) Clear

func (t *Toast) Clear(msg flash.ClearMsg)

func (Toast) Render

func (t Toast) Render() string

func (*Toast) Set

func (t *Toast) Set(message string, isErr bool) flash.ClearMsg

Jump to

Keyboard shortcuts

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