ui

package
v0.0.0-...-2a17ef4 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: ISC Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorGreen   = lipgloss.Color("#25A065")
	ColorRed     = lipgloss.Color("#FF4040")
	ColorYellow  = lipgloss.Color("#FFD700")
	ColorPink    = lipgloss.Color("#FF5F87")
	ColorWhite   = lipgloss.Color("#FFFDF5")
	ColorGray    = lipgloss.Color("#666666")
	ColorDimGray = lipgloss.Color("#444444")
	ColorDarkBg  = lipgloss.Color("#202020")
	ColorLightFg = lipgloss.Color("#DDDDDD")
)

Color palette

Variables

View Source
var (
	// AppStyle is the main application container style
	AppStyle = lipgloss.NewStyle().
				Padding(1, 0).
				Border(lipgloss.HiddenBorder())

	// TitleStyle is the style for the application title
	TitleStyle = lipgloss.NewStyle().
				Foreground(ColorWhite).
				Background(ColorGreen).
				Width(100).
				Padding(0, 1).
				Bold(true)

	// TabStyle is the style for inactive tabs
	TabStyle = lipgloss.NewStyle().
				Foreground(ColorLightFg).
				Background(ColorDimGray).
				Padding(0, 2)

	// ActiveTabStyle is the style for the active tab
	ActiveTabStyle = lipgloss.NewStyle().
					Foreground(ColorWhite).
					Background(ColorGreen).
					Padding(0, 2).
					Bold(true)

	// TabBarStyle is the container for the tab bar
	TabBarStyle = lipgloss.NewStyle().
				Background(ColorDimGray)

	// StatusBarStyle is the style for the status bar
	StatusBarStyle = lipgloss.NewStyle().
					Foreground(ColorWhite).
					Background(ColorGray).
					Width(100).
					Padding(0, 1)

	// HelpStyle is used for the help bar
	HelpStyle = lipgloss.NewStyle().
				Padding(0, 1).
				Background(ColorDarkBg).
				Foreground(ColorLightFg)

	// ErrorStyle is for error messages
	ErrorStyle = lipgloss.NewStyle().
				Foreground(ColorWhite).
				Background(ColorRed).
				Padding(0, 1).
				Width(100).
				Bold(true)

	// SectionHeaderStyle is used for report section headers
	SectionHeaderStyle = lipgloss.NewStyle().
						Foreground(ColorPink).
						Bold(true)

	// SelectedItemStyle is used for highlighting selected items
	SelectedItemStyle = lipgloss.NewStyle().
						Foreground(ColorGreen).
						Bold(true)

	// PassStyle renders pass results in green
	PassStyle = lipgloss.NewStyle().
				Foreground(ColorGreen).
				Bold(true)

	// FailStyle renders fail results in red
	FailStyle = lipgloss.NewStyle().
				Foreground(ColorRed).
				Bold(true)

	// WarnStyle renders soft-fail/neutral results in yellow
	WarnStyle = lipgloss.NewStyle().
				Foreground(ColorYellow)

	// TableHeaderStyle is for table headers
	TableHeaderStyle = lipgloss.NewStyle().
						Bold(true).
						Foreground(ColorPink).
						Padding(0, 1)

	// TableCellStyle is for table cells
	TableCellStyle = lipgloss.NewStyle().
					Padding(0, 1)

	// SearchStyle is for the search input
	SearchStyle = lipgloss.NewStyle().
				Foreground(ColorWhite).
				Background(ColorDimGray).
				Padding(0, 1)
)

Functions

func ColorizeDisposition

func ColorizeDisposition(disp string) string

ColorizeDisposition returns a styled string for dispositions

func ColorizeResult

func ColorizeResult(result string) string

ColorizeResult returns a styled string for auth results (pass/fail/softfail)

func CreateReportListItems

func CreateReportListItems(reports []model.DMARCReport) []list.Item

CreateReportListItems creates list items from DMARC reports

func RenderHelp

func RenderHelp(showReport bool, activeTab int, searching bool, keys KeyMap) string

RenderHelp renders a simplified help view based on view state

func SetupReportList

func SetupReportList(
	reports []model.DMARCReport,
	width, height int,
) list.Model

SetupReportList initializes a list with DMARC reports

func UpdateStyles

func UpdateStyles(width int)

UpdateStyles updates the styles based on the window width

Types

type KeyMap

type KeyMap struct {
	Up     key.Binding
	Down   key.Binding
	Enter  key.Binding
	Back   key.Binding
	Quit   key.Binding
	Reload key.Binding
	Search key.Binding
	Tab1   key.Binding
	Tab2   key.Binding
	Tab3   key.Binding
}

KeyMap defines the keybindings for the application

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default key bindings

type Model

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

Model represents the state of the application

func NewModel

func NewModel() (Model, error)

NewModel creates a new application model

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model

func (Model) Update

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

Update handles messages and updates the model

func (Model) View

func (m Model) View() string

View renders the UI

type ReportItem

type ReportItem struct {
	Report model.DMARCReport
}

ReportItem is a list item for the list model

func (ReportItem) Description

func (r ReportItem) Description() string

Description returns the description for the item

func (ReportItem) FilterValue

func (r ReportItem) FilterValue() string

FilterValue returns the value used for filtering

func (ReportItem) Title

func (r ReportItem) Title() string

Title returns the title for the item

Jump to

Keyboard shortcuts

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