ui

package
v0.0.0-...-bc79f0a Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(style Style) (*ui, error)

Types

type Style

type Style struct {
	MessageLength int
	FullIndent    int
	SemiIndent    int

	// Post author line
	AuthorStart   tcell.Style
	AuthorName    tcell.Style
	UpVotesIcon   tcell.Style
	UpVotesNum    tcell.Style
	DownVotesIcon tcell.Style
	DownVotesNum  tcell.Style
	Time          tcell.Style
	Separator     tcell.Style

	// Characters
	AuthorStartChar rune
	UpVotesChar     rune
	DownVotesChar   rune
	SeparatorChar   rune

	// Post message
	ActiveMessage     tcell.Style
	RegularMessage    tcell.Style
	ActiveStubMessage tcell.Style
	StubMessage       tcell.Style

	// Characters
	ActiveMessageChar rune
	StubStartChar     rune

	// Command/Search
	Command tcell.Style

	// Info message
	LoadingMessage tcell.Style
	InfoMessage    tcell.Style
	ErrorMessage   tcell.Style
}

func DefaultStyle

func DefaultStyle() Style

type UI

type UI interface {
	// Draw
	DrawLoading(msg string)
	DrawViewer(threads model.Threads, activePostID string)
	DrawCommandPrompt(command string)
	DrawInfo(infoLevel info.InfoLevel, msg string)
	Refresh()

	// Nav
	HandleViewerInput(threads model.Threads, t, p int) (string, int, int)
	HandleCommandInput() (string, rune)
	PauseUntilInput()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳