ui

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BacklogColor = lipgloss.Color("#6c757d") // Gray
	PlannedColor = lipgloss.Color("#ffffff") // White
	DoingColor   = lipgloss.Color("#198754") // Green
	BlockedColor = lipgloss.Color("#dc3545") // Red
	DoneColor    = lipgloss.Color("#adb5bd") // Light Gray

	AccentColor = lipgloss.Color("#6f42c1") // Purple
	MutedColor  = lipgloss.Color("#6c757d") // Gray
	WhiteColor  = lipgloss.Color("#ffffff")
)

--- Color Constants ---

View Source
var (
	WhiteStyle  = lipgloss.NewStyle().Foreground(WhiteColor)
	AccentStyle = lipgloss.NewStyle().Foreground(AccentColor)
	MutedStyle  = lipgloss.NewStyle().Foreground(MutedColor)
	BoldStyle   = lipgloss.NewStyle().Bold(true)
)

--- Base Styles ---

View Source
var (
	ErrorPrefix = "✗"
	OKPrefix    = "✓"
	NotePrefix  = "ℹ"
)
View Source
var HeaderStyle = lipgloss.NewStyle().
	Bold(true).
	Border(lipgloss.NormalBorder(), false, false, true, false).
	BorderForeground(lipgloss.Color("240"))

HeaderStyle matches the list command header style

View Source
var WarningStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#ffc107")).Bold(true)

WarningStyle is used for warning messages.

Functions

func CalculateColumnWidths

func CalculateColumnWidths(totalWidth int, columns []Column) []int

CalculateColumnWidths helper

func EditInteractive

func EditInteractive(template string) (string, error)

EditInteractive opens the user's EDITOR to edit the given template. Returns the content or an empty string if aborted/unchanged.

func ExtractEmail

func ExtractEmail(user string) string

ExtractEmail extracts the email from a "Name <email>" formatted string.

func ExtractName

func ExtractName(user string) string

ExtractName extracts the name from a "Name <email>" formatted string.

func FormatBranchStats

func FormatBranchStats(stats *model.BranchStats) string

FormatBranchStats renders a compact commit count badge like "⊙ 3". Returns empty string if stats is nil or the branch has no commits.

func FormatID

func FormatID(id string, maxWidth int) string

FormatID formats an issue ID for display.

func FormatLabels

func FormatLabels(labels []string) string

FormatLabels renders a list of labels as styled tags.

func FormatLabelsBadge

func FormatLabelsBadge(labels []string) string

FormatLabelsBadge renders a list of labels as [label] badges.

func GetRecentDoneIDs

func GetRecentDoneIDs(issues []*model.Issue, count int) map[string]bool

GetRecentDoneIDs returns a map of the most recently updated DONE issue IDs

func GetRecentDoneIDsFromMap

func GetRecentDoneIDsFromMap(issuesMap map[string]*model.Issue, count int) map[string]bool

GetRecentDoneIDsFromMap is a convenience wrapper for map-based issue collections

func Indent

func Indent(level int) string

Indent returns a string with the given indentation level.

func LabelColor

func LabelColor(label string) lipgloss.Color

LabelColor returns a color for a label, checking config colors first, then falling back to a deterministic hash-based color.

func RenderCell

func RenderCell(content string, width int, style lipgloss.Style) string

RenderCell renders a table cell padded to a given width.

func RenderHeader

func RenderHeader(title string) string

RenderHeader renders a section header.

func RenderHistory

func RenderHistory(events []model.Event, termWidth int)

RenderHistory renders the event history for an issue.

func RenderIssueDetails

func RenderIssueDetails(issue *model.Issue, children []*model.Issue, isArchived bool, termWidth int) string

RenderIssueDetails renders a detailed view of an issue.

func RenderIssueList

func RenderIssueList(issues []*model.Issue, termWidth int, prefix string) string

RenderIssueList renders a formatted issue list for the terminal. The prefix parameter is the configured issue ID prefix (e.g. "xpo-"); it determines the width of the ID column.

func RenderReview

func RenderReview(data ReviewData, termWidth int) string

RenderReview renders the review summary for an issue with a matching branch.

func ScreenWidth

func ScreenWidth() int

ScreenWidth is an alias for TerminalWidth.

func SetLabelColors

func SetLabelColors(labels map[string]string)

SetLabelColors sets the label color map from config. Call this once after loading config to enable config-driven label colors in CLI output.

func StatusIcon

func StatusIcon(status model.IssueStatus) string

StatusIcon returns the icon for a given status.

func StatusIconForIssue

func StatusIconForIssue(issue *model.Issue) string

StatusIconForIssue returns the status icon, using a distinct icon for issues whose DOING status was inferred from a remote git branch.

func StatusStyle

func StatusStyle(status model.IssueStatus) lipgloss.Style

StatusStyle returns the style for a given status.

func Stylize

func Stylize(s string) string

Stylize applies basic styling to a string for terminal output.

func TerminalWidth

func TerminalWidth() int

TerminalWidth returns the current terminal width with a default fallback.

func Truncate

func Truncate(s string, maxWidth int) string

Truncate truncates a string to a given visual width, preserving ANSI escape sequences and handling wide characters correctly.

Types

type Column

type Column struct {
	Title string
	Width int  // Fixed width or minimum width if Flex is true
	Flex  bool // If true, expands to fill available space
}

Column defines a table column

type ReviewCommit

type ReviewCommit struct {
	SHA     string
	Message string
}

type ReviewData

type ReviewData struct {
	Issue   *model.Issue
	Base    string
	Commits []ReviewCommit
	Files   []ReviewFile
}

type ReviewFile

type ReviewFile struct {
	Status     string
	Path       string
	Insertions int
	Deletions  int
}

Jump to

Keyboard shortcuts

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