tui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Primary neons
	ColorCyan    = lipgloss.Color("#00FFFF")
	ColorMagenta = lipgloss.Color("#FF00FF")
	ColorGreen   = lipgloss.Color("#00FF88")
	ColorAmber   = lipgloss.Color("#FFB000")
	ColorRed     = lipgloss.Color("#FF0040")

	// Banner vertical gradient (top → bottom)
	ColorBannerGrad = [7]lipgloss.Color{
		"#00FFFF", "#00EEFF", "#00CCDD", "#00AACC",
		"#0088AA", "#006688", "#005577",
	}

	// Cyan shades for bars
	ColorCyanMid = lipgloss.Color("#00BBDD")
	ColorCyanDim = lipgloss.Color("#005577")

	// Magenta shades for bars
	ColorMagentaMid = lipgloss.Color("#CC00CC")
	ColorMagentaDim = lipgloss.Color("#660066")

	// Backgrounds & chrome
	ColorBg        = lipgloss.Color("#050510")
	ColorDimCyan   = lipgloss.Color("#005566")
	ColorDimWhite  = lipgloss.Color("#555555")
	ColorBrightWht = lipgloss.Color("#E0E0E0")
	ColorRowEven   = lipgloss.Color("#0A0A1A")
	ColorRowOdd    = lipgloss.Color("#070714")
	ColorRowSelect = lipgloss.Color("#0C2030")

	// Rank podium
	ColorGold   = lipgloss.Color("#FFD700")
	ColorSilver = lipgloss.Color("#C0C0C0")
	ColorBronze = lipgloss.Color("#CD7F32")
)
View Source
var (
	StyleApp = lipgloss.NewStyle().Background(ColorBg)

	// Header / title
	StyleTitle          = lipgloss.NewStyle().Foreground(ColorCyan).Bold(true)
	StyleSubtitle       = lipgloss.NewStyle().Foreground(ColorDimCyan)
	StyleClassification = lipgloss.NewStyle().Foreground(ColorMagenta).Bold(true)

	// Stat boxes — heavy border, more padding
	StyleStatBox = lipgloss.NewStyle().
					Border(lipgloss.ThickBorder()).
					BorderForeground(ColorDimCyan).
					Padding(0, 3).
					Align(lipgloss.Center)

	StyleStatValue = lipgloss.NewStyle().Foreground(ColorCyan).Bold(true)
	StyleStatLabel = lipgloss.NewStyle().Foreground(ColorDimCyan)

	// Table header
	StyleTableHeader  = lipgloss.NewStyle().Foreground(ColorCyan).Bold(true)
	StyleSectionLabel = lipgloss.NewStyle().Foreground(ColorDimCyan)

	// Row backgrounds
	StyleRowEven     = lipgloss.NewStyle().Background(ColorRowEven)
	StyleRowOdd      = lipgloss.NewStyle().Background(ColorRowOdd)
	StyleRowSelected = lipgloss.NewStyle().Background(ColorRowSelect).Bold(true).Foreground(ColorCyan)

	// Rank column
	StyleRank       = lipgloss.NewStyle().Foreground(ColorDimCyan)
	StyleRankGold   = lipgloss.NewStyle().Foreground(ColorGold).Bold(true)
	StyleRankSilver = lipgloss.NewStyle().Foreground(ColorSilver).Bold(true)
	StyleRankBronze = lipgloss.NewStyle().Foreground(ColorBronze).Bold(true)

	// Data cells
	StyleAuthor  = lipgloss.NewStyle().Foreground(ColorBrightWht)
	StyleNumeric = lipgloss.NewStyle().Foreground(ColorGreen)

	// Impact bars
	StyleBarCyan       = lipgloss.NewStyle().Foreground(ColorCyan)
	StyleBarCyanMid    = lipgloss.NewStyle().Foreground(ColorCyanMid)
	StyleBarCyanDim    = lipgloss.NewStyle().Foreground(ColorCyanDim)
	StyleBarMagenta    = lipgloss.NewStyle().Foreground(ColorMagenta)
	StyleBarMagentaMid = lipgloss.NewStyle().Foreground(ColorMagentaMid)
	StyleBarMagentaDim = lipgloss.NewStyle().Foreground(ColorMagentaDim)

	// Time picker
	StyleTimePickerActive = lipgloss.NewStyle().
							Foreground(ColorCyan).
							Bold(true)

	StyleTimePickerInactive = lipgloss.NewStyle().
							Foreground(ColorDimWhite).
							Padding(0, 1)

	// Footer & help
	StyleFooter   = lipgloss.NewStyle().Foreground(ColorDimCyan)
	StyleHelpKey  = lipgloss.NewStyle().Foreground(ColorCyan)
	StyleHelpDesc = lipgloss.NewStyle().Foreground(ColorDimWhite)

	// Reusable
	StyleDimWhite = lipgloss.NewStyle().Foreground(ColorDimWhite)
	StyleCyan     = lipgloss.NewStyle().Foreground(ColorCyan)
	StyleMagenta  = lipgloss.NewStyle().Foreground(ColorMagenta)
	StyleDimCyan  = lipgloss.NewStyle().Foreground(ColorDimCyan)
	StyleCursor   = lipgloss.NewStyle().Foreground(ColorCyan).Bold(true)

	StyleAmber      = lipgloss.NewStyle().Foreground(ColorAmber)
	StyleGlitchLine = lipgloss.NewStyle().Foreground(ColorCyan)

	// Repo overlay tags (kept for compatibility)
	StyleRepoTag = lipgloss.NewStyle().
					Foreground(ColorMagenta).
					Border(lipgloss.RoundedBorder()).
					BorderForeground(lipgloss.Color("#550055")).
					Padding(0, 1)

	StyleRepoTagActive = lipgloss.NewStyle().
						Foreground(ColorMagenta).
						Border(lipgloss.RoundedBorder()).
						BorderForeground(ColorMagenta).
						Bold(true).
						Padding(0, 1)

	StyleTimePicker = lipgloss.NewStyle().Foreground(ColorDimWhite)
)
View Source
var StyleGreen = lipgloss.NewStyle().Foreground(ColorGreen)

StyleGreen is used for status indicators.

View Source
var TimePresets = []TimePreset{
	{Label: "1d", Duration: 24 * time.Hour},
	{Label: "7d", Duration: 7 * 24 * time.Hour},
	{Label: "14d", Duration: 14 * 24 * time.Hour},
	{Label: "30d", Duration: 30 * 24 * time.Hour},
	{Label: "90d", Duration: 90 * 24 * time.Hour},
	{Label: "1y", Duration: 365 * 24 * time.Hour},
	{Label: "ALL", Duration: 0},
}

Functions

func FormatNumber

func FormatNumber(n int) string

FormatNumber formats an integer with thousand separators.

func LoadDataCmd

func LoadDataCmd(repoPaths []string) tea.Cmd

LoadDataCmd returns a Cmd that concurrently collects commits from all repos.

func RenderFooter

func RenderFooter(repoCount, excludedCount, width int, version string) string

RenderFooter renders the repo count and timestamp status line. The timestamp right-aligns to the separator width (width - 4).

func RenderHeader

func RenderHeader(width, repoCount, excludedCount int, version string) string

RenderHeader renders the ASCII banner with a vertical color gradient, subtitle, classification stamp, and a heavy separator.

func RenderHelpBar

func RenderHelpBar(ctx HelpContext) string

RenderHelpBar renders context-aware key binding hints with bracket styling.

func RenderImpactBar

func RenderImpactBar(added, removed, maxValue, barWidth int) string

RenderImpactBar renders a gradient bar: solid core fading to ▓▒░ at the edge. Cyan for added, magenta for removed.

func RenderRepoCount

func RenderRepoCount(total, excluded int) string

RenderRepoCount renders the repo count indicator.

func RenderSectionHeader

func RenderSectionHeader(label string, width int) string

RenderSectionHeader renders a labeled separator line: ── LABEL ──────────

func RenderStatBoxes

func RenderStatBoxes(commits, added, removed, aiCommits int) string

RenderStatBoxes renders heavy-bordered stat boxes for aggregate metrics.

func RenderTimePicker

func RenderTimePicker(activeIdx int) string

RenderTimePicker renders time presets with the active one styled differently.

func Truncate

func Truncate(s string, width int) string

Truncate truncates s to width, adding "..." if needed.

Types

type AggregateView

type AggregateView struct{}

AggregateView renders the aggregate leaderboard table.

func (AggregateView) RenderTable

func (v AggregateView) RenderTable(authors []stats.AuthorStats, selectedRow int, sortField stats.SortField, width int) string

RenderTable returns a styled leaderboard string for the given authors.

type DataLoadedMsg

type DataLoadedMsg struct {
	Records   []git.CommitRecord
	RepoNames []string
	Err       error
}

DataLoadedMsg is sent after background data collection completes. Exported so main.go can construct it.

type HelpContext

type HelpContext struct {
	View string // "aggregate", "operative"
}

HelpContext describes the current UI state for context-aware help.

type Model

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

Model is the root Bubble Tea model.

func NewModel

func NewModel(repoPaths []string, initialSort stats.SortField, excluded map[string]bool, version string) Model

NewModel creates an initial Model ready to display the loading state.

func (Model) Init

func (m Model) Init() tea.Cmd

Init satisfies tea.Model; data loading is kicked off by the caller via Cmd.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles all incoming messages.

func (Model) View

func (m Model) View() string

View renders the current UI state.

type MonthActivity

type MonthActivity struct {
	Month   time.Time
	Commits int
	Added   int
	Removed int
}

MonthActivity holds commit stats for a single month.

type OperativeView

type OperativeView struct{}

OperativeView renders a contributor detail screen.

func (OperativeView) RenderOperativeDetail

func (v OperativeView) RenderOperativeDetail(
	authorName string,
	authorStats *stats.AuthorStats,
	records []git.CommitRecord,
	width int,
	timeIdx int,
	repoCount int,
	excludedCount int,
) string

RenderOperativeDetail renders the full operative detail view.

type TimePreset

type TimePreset struct {
	Label    string
	Duration time.Duration // 0 means "all time"
}

TimePreset represents a time range filter option.

type ViewMode

type ViewMode int

ViewMode controls which screen is displayed.

const (
	ViewAggregate ViewMode = iota
	ViewOperative
	ViewRepoOverlay
)

Jump to

Keyboard shortcuts

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