ui

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Header
	HeaderStyle = lipgloss.NewStyle().
				Background(orange).
				Foreground(lipgloss.Color("#000000")).
				Bold(true).
				Padding(0, 1)

	TabStyle = lipgloss.NewStyle().
				Foreground(dimText).
				Padding(0, 1)

	ActiveTabStyle = lipgloss.NewStyle().
					Foreground(highlight).
					Bold(true).
					Padding(0, 1).
					Underline(true)

	// Story list
	TitleStyle = lipgloss.NewStyle().
				Foreground(highlight).
				Bold(true)

	SelectedTitleStyle = lipgloss.NewStyle().
						Foreground(orange).
						Bold(true)

	URLStyle = lipgloss.NewStyle().
				Foreground(subtle)

	MetaStyle = lipgloss.NewStyle().
				Foreground(dimText)

	ScoreStyle = lipgloss.NewStyle().
				Foreground(orange)

	// Comments
	CommentAuthorStyle = lipgloss.NewStyle().
						Foreground(orange).
						Bold(true)

	CommentTextStyle = lipgloss.NewStyle().
						Foreground(lipgloss.Color("#CCCCCC"))

	CommentMetaStyle = lipgloss.NewStyle().
						Foreground(dimText)

	// General
	HelpStyle = lipgloss.NewStyle().
				Foreground(dimText)

	ErrorStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#FF0000"))

	SpinnerStyle = lipgloss.NewStyle().
					Foreground(orange)

	// Status bar
	StatusBarStyle = lipgloss.NewStyle().
					Background(lipgloss.Color("#333333")).
					Foreground(dimText).
					Padding(0, 1)

	// Visual mode selection - bright highlight
	VisualSelectStyle = lipgloss.NewStyle().
						Background(lipgloss.Color("#264F78")).
						Foreground(lipgloss.Color("#FFFFFF"))
)

Functions

func IndentStyle

func IndentStyle(depth int) lipgloss.Style

IndentStyle returns a style for comment indentation

Types

type KeyMap

type KeyMap struct {
	Up           key.Binding
	Down         key.Binding
	Enter        key.Binding
	Back         key.Binding
	Comments     key.Binding
	Open         key.Binding
	NextTab      key.Binding
	PrevTab      key.Binding
	Refresh      key.Binding
	Help         key.Binding
	Quit         key.Binding
	PageDown     key.Binding
	PageUp       key.Binding
	Home         key.Binding
	End          key.Binding
	ToggleMouse  key.Binding
	SwitchSource key.Binding
	Visual       key.Binding
	Yank         key.Binding
	Update       key.Binding
}

KeyMap defines all keybindings

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default keybindings

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns the full help strings

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns a short help string

type Model

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

Model is the main application model

func New

func New() Model

New creates a new Model with the default HN source

func NewWithSource

func NewWithSource(source api.Source, updateChan <-chan *api.UpdateInfo) Model

NewWithSource creates a new Model with a specific source

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

func (Model) View

func (m Model) View() string

View renders the model

type View

type View int

View represents the current view

const (
	StoriesView View = iota
	CommentsView
	SourcePickerView
)

Jump to

Keyboard shortcuts

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