ui

package
v0.0.0-...-1effcde Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DepthColors cycles through these for nested comment bars.
	DepthColors = []lipgloss.Color{
		"#FF6600",
		"#828282",
		"#00BFFF",
		"#32CD32",
		"#FFD700",
		"#FF69B4",
		"#9370DB",
		"#20B2AA",
	}

	TitleStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(lipgloss.Color("#FFFFFF"))

	URLStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#828282"))

	MetaStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#828282"))

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

	AuthorStyle = lipgloss.NewStyle().
				Foreground(hnOrange).
				Bold(true)

	OPBadgeStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color("#000000")).
					Background(hnOrange).
					Bold(true).
					Padding(0, 1)

	SelectedStyle = lipgloss.NewStyle().
					Border(lipgloss.NormalBorder(), false, false, false, true).
					BorderForeground(hnOrange).
					PaddingLeft(1)

	StatusBarStyle = lipgloss.NewStyle().
					Background(lipgloss.Color("#333333")).
					Foreground(lipgloss.Color("#FFFFFF")).
					Padding(0, 1)

	StatusBarActiveTab = lipgloss.NewStyle().
						Background(hnOrange).
						Foreground(lipgloss.Color("#FFFFFF")).
						Bold(true).
						Padding(0, 1)

	StatusBarTab = lipgloss.NewStyle().
					Background(lipgloss.Color("#555555")).
					Foreground(lipgloss.Color("#CCCCCC")).
					Padding(0, 1)

	DimStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#666666"))

	CodeStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#A0D0A0"))

	NotificationBadge = lipgloss.NewStyle().
						Background(lipgloss.Color("#FF0000")).
						Foreground(lipgloss.Color("#FFFFFF")).
						Bold(true).
						Padding(0, 1)
)

HN orange and depth colors for comment nesting.

View Source
var Keys = KeyMap{
	Quit:       key.NewBinding(key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "quit")),
	Back:       key.NewBinding(key.WithKeys("esc"), key.WithHelp("esc", "back")),
	Help:       key.NewBinding(key.WithKeys("?"), key.WithHelp("?", "help")),
	Enter:      key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "open")),
	Refresh:    key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "refresh")),
	Login:      key.NewBinding(key.WithKeys("L"), key.WithHelp("L", "login")),
	Notify:     key.NewBinding(key.WithKeys("n"), key.WithHelp("n", "notifications")),
	OpenURL:    key.NewBinding(key.WithKeys("o"), key.WithHelp("o", "open url")),
	Upvote:     key.NewBinding(key.WithKeys("u"), key.WithHelp("u", "upvote")),
	Reply:      key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "reply")),
	Up:         key.NewBinding(key.WithKeys("k", "up"), key.WithHelp("k/up", "up")),
	Down:       key.NewBinding(key.WithKeys("j", "down"), key.WithHelp("j/down", "down")),
	PageUp:     key.NewBinding(key.WithKeys("ctrl+u", "pgup"), key.WithHelp("ctrl+u", "page up")),
	PageDown:   key.NewBinding(key.WithKeys("ctrl+d", "pgdown"), key.WithHelp("ctrl+d", "page down")),
	Home:       key.NewBinding(key.WithKeys("g", "home"), key.WithHelp("g", "top")),
	End:        key.NewBinding(key.WithKeys("G", "end"), key.WithHelp("G", "bottom")),
	Collapse:   key.NewBinding(key.WithKeys(" "), key.WithHelp("space", "collapse")),
	Parent:     key.NewBinding(key.WithKeys("[", "p"), key.WithHelp("p/[", "parent")),
	NextSib:    key.NewBinding(key.WithKeys("]"), key.WithHelp("]", "next sibling")),
	Tab1:       key.NewBinding(key.WithKeys("1"), key.WithHelp("1", "top")),
	Tab2:       key.NewBinding(key.WithKeys("2"), key.WithHelp("2", "new")),
	Tab3:       key.NewBinding(key.WithKeys("3"), key.WithHelp("3", "best")),
	Tab4:       key.NewBinding(key.WithKeys("4"), key.WithHelp("4", "ask")),
	Tab5:       key.NewBinding(key.WithKeys("5"), key.WithHelp("5", "show")),
	Tab6:       key.NewBinding(key.WithKeys("6"), key.WithHelp("6", "jobs")),
	Submit:     key.NewBinding(key.WithKeys("ctrl+s"), key.WithHelp("ctrl+s", "submit")),
	Filter:     key.NewBinding(key.WithKeys("/"), key.WithHelp("/", "filter")),
	Edit:       key.NewBinding(key.WithKeys("e"), key.WithHelp("e", "edit")),
	UserDetail: key.NewBinding(key.WithKeys("P"), key.WithHelp("P", "user profile")),
}

Functions

This section is empty.

Types

type App

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

App is the root Bubble Tea model.

func NewApp

func NewApp(cfg config.Config, client *api.Client, db *cache.DB) *App

NewApp creates the root application model.

func (*App) Init

func (a *App) Init() tea.Cmd

Init starts the application.

func (*App) SetProgram

func (a *App) SetProgram(p *tea.Program)

SetProgram stores the tea.Program reference for the background monitor.

func (*App) Update

func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles all messages.

func (*App) View

func (a *App) View() string

View renders the application.

type KeyMap

type KeyMap struct {
	Quit       key.Binding
	Back       key.Binding
	Help       key.Binding
	Enter      key.Binding
	Refresh    key.Binding
	Login      key.Binding
	Notify     key.Binding
	OpenURL    key.Binding
	Upvote     key.Binding
	Reply      key.Binding
	Up         key.Binding
	Down       key.Binding
	PageUp     key.Binding
	PageDown   key.Binding
	Home       key.Binding
	End        key.Binding
	Collapse   key.Binding
	Parent     key.Binding
	NextSib    key.Binding
	Tab1       key.Binding
	Tab2       key.Binding
	Tab3       key.Binding
	Tab4       key.Binding
	Tab5       key.Binding
	Tab6       key.Binding
	Submit     key.Binding
	Filter     key.Binding
	Edit       key.Binding
	UserDetail key.Binding
}

type ViewType

type ViewType int

ViewType identifies the active view.

const (
	ViewStoryList ViewType = iota
	ViewCommentFeed
	ViewStoryDetail
	ViewLogin
	ViewReply
	ViewEdit
	ViewSubmit
	ViewNotifications
	ViewUserProfile
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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