Documentation
¶
Overview ¶
Package components contains reusable Bubble Tea overlays and chrome for the Jira TUI. Patterns mirror pagerduty-client/internal/tui/components.
Index ¶
- func ColorToANSIBg(c color.Color) string
- func LabelledBorder(width int, borderStyle lipgloss.Style, left, right string) string
- func PersistBg(line, bg string) string
- func PersistBgFull(line, bg string, width int) string
- func RenderOverlay(content string, minWidth int) string
- type Confirm
- type ConfirmResult
- type FilterAppliedMsg
- type FilterClosed
- type FilterOptions
- func (f FilterOptions) Init() tea.Cmd
- func (f FilterOptions) IssueState() IssueFilterState
- func (f FilterOptions) Origin() string
- func (f FilterOptions) Selections() map[string]string
- func (f FilterOptions) ShowWithRows(origin string, rows []FilterRow) FilterOptions
- func (f FilterOptions) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (f FilterOptions) View() tea.View
- type FilterRow
- type Footer
- type Header
- type Help
- type HintContext
- type InputCancelled
- type InputSubmitted
- type IssueFilterState
- type StatusBar
- type Tabs
- type TextInput
- type Toast
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorToANSIBg ¶
ColorToANSIBg converts a color to an ANSI 24-bit bg escape.
func LabelledBorder ¶
LabelledBorder renders ── left ────────── right ── as a horizontal rule.
func PersistBg ¶
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 ¶
PersistBgFull right-pads `line` to `width` then applies PersistBg so the background spans the full terminal row even after wrapping.
func RenderOverlay ¶
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.
type ConfirmResult ¶
ConfirmResult is emitted when the user accepts or cancels a confirmation. When Confirmed is true, OnYes carries the action command to execute.
type FilterAppliedMsg ¶
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) View ¶
func (f FilterOptions) View() tea.View
type FilterRow ¶
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 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 ¶
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.
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