tui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package tui provides a terminal user interface for cf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run() error

Run starts the TUI application

Types

type App

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

App is the main application model

func New

func New() *App

New creates a new App instance

func (*App) Init

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

Init initializes the application

func (*App) Update

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

Update handles messages

func (*App) View

func (a *App) View() string

View renders the application

type ContestsLoadedMsg

type ContestsLoadedMsg struct {
	Contests []cfapi.Contest
}

ContestsLoadedMsg is sent when contests are loaded

type ErrorMsg

type ErrorMsg struct {
	Err error
}

ErrorMsg represents an error

type KeyMap

type KeyMap struct {
	// Navigation
	Up       key.Binding
	Down     key.Binding
	Left     key.Binding
	Right    key.Binding
	PageUp   key.Binding
	PageDown key.Binding
	Home     key.Binding
	End      key.Binding

	// Tab navigation
	Tab1    key.Binding
	Tab2    key.Binding
	Tab3    key.Binding
	Tab4    key.Binding
	Tab5    key.Binding
	NextTab key.Binding
	PrevTab key.Binding

	// Actions
	Enter   key.Binding
	Back    key.Binding
	Refresh key.Binding
	Search  key.Binding
	Filter  key.Binding
	Sort    key.Binding
	Open    key.Binding
	Help    key.Binding
	Quit    key.Binding
}

KeyMap defines the keybindings for the application

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default keybindings

func (KeyMap) FullHelp

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

FullHelp returns the full help

func (KeyMap) ShortHelp

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

ShortHelp returns a short help string

type LoadingMsg

type LoadingMsg struct {
	Loading bool
	Message string
}

LoadingMsg indicates loading state

type ProblemsLoadedMsg

type ProblemsLoadedMsg struct {
	Problems []cfapi.Problem
}

ProblemsLoadedMsg is sent when problems are loaded

type RatingLoadedMsg

type RatingLoadedMsg struct {
	RatingChanges []cfapi.RatingChange
}

RatingLoadedMsg is sent when rating history is loaded

type RefreshMsg

type RefreshMsg struct{}

RefreshMsg triggers a data refresh

type StatsLoadedMsg

type StatsLoadedMsg struct {
	TotalSolved      int
	TotalSubmissions int
	AcceptanceRate   float64
	ByRating         map[int]int
	ByTag            map[string]int
	RecentSolved     int
	Streak           int
}

StatsLoadedMsg is sent when statistics are loaded

type StatusMsg

type StatusMsg struct {
	Message string
}

StatusMsg represents a status update

type SubmissionsLoadedMsg

type SubmissionsLoadedMsg struct {
	Submissions []cfapi.Submission
}

SubmissionsLoadedMsg is sent when submissions are loaded

type SwitchViewMsg

type SwitchViewMsg struct {
	View View
}

SwitchViewMsg switches to a different view

type TickMsg

type TickMsg struct{}

TickMsg is sent periodically for animations

type UserLoadedMsg

type UserLoadedMsg struct {
	User cfapi.User
}

UserLoadedMsg is sent when user data is loaded

type View

type View int

View represents different views/tabs in the application

const (
	ViewDashboard View = iota
	ViewProblems
	ViewSubmissions
	ViewProfile
	ViewSettings
)

func (View) Icon

func (v View) Icon() string

Icon returns an icon for the view

func (View) String

func (v View) String() string

String returns the view name

type WindowSizeMsg

type WindowSizeMsg struct {
	Width  int
	Height int
}

WindowSizeMsg is sent when the window is resized

Directories

Path Synopsis
Package styles provides theming and styling for the TUI
Package styles provides theming and styling for the TUI
Package views provides TUI view models
Package views provides TUI view models

Jump to

Keyboard shortcuts

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