ui

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAnimeListKeyMap

func DefaultAnimeListKeyMap() animeListKeyMap

DefaultAnimeListKeyMap returns the default keybindings

func DefaultMainMenuKeyMap

func DefaultMainMenuKeyMap() mainMenuKeyMap

DefaultMainMenuKeyMap returns the default keybindings

func ForceRefreshCacheInBackground

func ForceRefreshCacheInBackground(cfg *config.Config, client *anilist.Client)

ForceRefreshCacheInBackground forces a cache refresh in the background This bypasses the 5-minute freshness check and is used when updates are made

func GetBanner

func GetBanner() string

GetBanner returns the colorized ONI banner

func GetBannerGradient

func GetBannerGradient() string

GetBannerGradient returns the ONI banner with gradient colors

func GetBannerGradientIncognito

func GetBannerGradientIncognito() string

GetBannerGradientIncognito returns the ONI banner with hot pink gradient for incognito mode

func RefreshCacheInBackground

func RefreshCacheInBackground(cfg *config.Config, client *anilist.Client)

RefreshCacheInBackground refreshes the anime list cache in the background This can be called on app startup to pre-warm the cache It skips refresh if cache was updated less than 5 minutes ago to prevent rate limits

Types

type AllListsResultMsg

type AllListsResultMsg struct {
	AllEntries map[string][]anilist.MediaListEntry
	Err        error
	IsRefresh  bool
}

AllListsResultMsg is sent when all lists are ready

type AniListAuth

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

AniListAuth handles AniList authentication

func NewAniListAuth

func NewAniListAuth(cfg *config.Config) *AniListAuth

NewAniListAuth creates a new AniList authentication screen

func (*AniListAuth) Init

func (m *AniListAuth) Init() tea.Cmd

func (*AniListAuth) Update

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

func (*AniListAuth) View

func (m *AniListAuth) View() string

type AniListAuthErrorMsg

type AniListAuthErrorMsg struct {
	Err error
}

AniListAuthErrorMsg is sent when authentication fails

type AniListAuthSuccessMsg

type AniListAuthSuccessMsg struct {
	Client *anilist.Client
}

AniListAuthSuccessMsg is sent when authentication succeeds

type AnimeItem

type AnimeItem struct {
	Entry anilist.MediaListEntry
}

AnimeItem represents an anime entry in the list

func (AnimeItem) Description

func (i AnimeItem) Description() string

func (AnimeItem) FilterValue

func (i AnimeItem) FilterValue() string

func (AnimeItem) Title

func (i AnimeItem) Title() string

type AnimeList

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

AnimeList represents the anime list model

func NewAnimeList

func NewAnimeList(cfg *config.Config, client *anilist.Client) *AnimeList

NewAnimeList creates a new anime list

func (*AnimeList) GetSelectedEntry

func (m *AnimeList) GetSelectedEntry() *anilist.MediaListEntry

GetSelectedEntry returns the currently selected entry

func (*AnimeList) Init

func (m *AnimeList) Init() tea.Cmd

Init initializes the anime list

func (*AnimeList) Update

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

Update handles messages

func (*AnimeList) View

func (m *AnimeList) View() string

View renders the anime list

type AnimeListState

type AnimeListState int

AnimeListState represents the list state

const (
	ListLoading AnimeListState = iota
	ListResults
	ListSearchInput
	ListSearchResults
	ListSearchLoading
)

type AnimeSearch

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

AnimeSearch represents the anime search model

func NewAnimeSearch

func NewAnimeSearch(cfg *config.Config, client *anilist.Client) *AnimeSearch

NewAnimeSearch creates a new anime search

func (*AnimeSearch) Init

func (m *AnimeSearch) Init() tea.Cmd

Init initializes the anime search

func (*AnimeSearch) Update

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

Update handles messages

func (*AnimeSearch) View

func (m *AnimeSearch) View() string

View renders the anime search

type AnimeSearchState

type AnimeSearchState int

AnimeSearchState represents the search state

const (
	SearchInput AnimeSearchState = iota
	SearchResults
	SearchLoading
)

type AnimeSelectedMsg

type AnimeSelectedMsg struct {
	Anime             anilist.Anime
	Entry             *anilist.MediaListEntry // Optional: entry from user's list with progress
	ShowEpisodeSelect bool                    // If true, show episode selection; if false, auto-play
}

AnimeSelectedMsg is sent when an anime is selected

type AutoplayPrompt

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

AutoplayPrompt displays a prompt asking if the user wants to enable autoplay

func NewAutoplayPrompt

func NewAutoplayPrompt(cfg *config.Config, animeTitle string, nextEpisode int) *AutoplayPrompt

NewAutoplayPrompt creates a new autoplay prompt

func (*AutoplayPrompt) Init

func (m *AutoplayPrompt) Init() tea.Cmd

func (*AutoplayPrompt) Update

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

func (*AutoplayPrompt) View

func (m *AutoplayPrompt) View() string

type AutoplayPromptMsg

type AutoplayPromptMsg struct {
	EnableAutoplay bool
}

AutoplayPromptMsg is sent when user makes a choice

type BackMsg

type BackMsg struct{}

BackMsg is sent when the user wants to go back

type CacheData

type CacheData struct {
	Entries   map[string][]anilist.MediaListEntry `json:"entries"`
	Timestamp time.Time                           `json:"timestamp"`
}

CacheData represents the cache file structure

type ConfigEditor

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

ConfigEditor represents the config editor model

func NewConfigEditor

func NewConfigEditor(cfg *config.Config) *ConfigEditor

NewConfigEditor creates a new config editor

func (*ConfigEditor) Init

func (m *ConfigEditor) Init() tea.Cmd

Init initializes the config editor

func (*ConfigEditor) Update

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

Update handles messages

func (*ConfigEditor) View

func (m *ConfigEditor) View() string

View renders the config editor

type ConfigEditorState

type ConfigEditorState int

ConfigEditorState represents the config editor state

const (
	ConfigMenuSelection ConfigEditorState = iota
	ConfigTextEdit
	ConfigToggleEdit
	ConfigSelectEdit
	ConfigSaving
	ConfigSaved
)

type ConfigItem

type ConfigItem struct {
	Name        string
	DisplayName string
	Value       interface{}
	Type        ConfigItemType
	Category    string
	Options     []string // For select type
}

ConfigItem represents a configuration item

type ConfigItemType

type ConfigItemType int

ConfigItemType represents the type of config item

const (
	ConfigTypeText ConfigItemType = iota
	ConfigTypeToggle
	ConfigTypeSelect
)

type ConfigSavedMsg

type ConfigSavedMsg struct {
	Err error
}

ConfigSavedMsg is sent when config is saved

type ContinueWatchingAnimeMsg

type ContinueWatchingAnimeMsg struct {
	AnimeName string
	Episode   int
}

ContinueWatchingAnimeMsg is sent when the continue watching anime is fetched

type EpisodeReadyMsg

type EpisodeReadyMsg struct {
	Episode  int
	SubOrDub string
}

EpisodeReadyMsg is sent when episode selection is complete

type EpisodeSelect

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

EpisodeSelect represents the episode selection model

func NewEpisodeSelect

func NewEpisodeSelect(cfg *config.Config, anime anilist.Anime, progress int) *EpisodeSelect

NewEpisodeSelect creates a new episode selector

func (*EpisodeSelect) GetSelectedEpisode

func (m *EpisodeSelect) GetSelectedEpisode() int

GetSelectedEpisode returns the selected episode number

func (*EpisodeSelect) GetSubOrDub

func (m *EpisodeSelect) GetSubOrDub() string

GetSubOrDub returns the selected audio type

func (*EpisodeSelect) Init

func (m *EpisodeSelect) Init() tea.Cmd

Init initializes the episode selector

func (*EpisodeSelect) Update

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

Update handles messages

func (*EpisodeSelect) View

func (m *EpisodeSelect) View() string

View renders the episode selector

type EpisodeSelectState

type EpisodeSelectState int

EpisodeSelectState represents the episode selection state

const (
	EpisodeSubDubSelect EpisodeSelectState = iota
	EpisodeNumberInput
	EpisodeReady
)

type ExtendedKeyMap

type ExtendedKeyMap struct {
	Universal UniversalKeys
	ViewKeys  []key.Binding   // View-specific keys for short help
	ViewFull  [][]key.Binding // View-specific keys for full help
}

ExtendedKeyMap wraps a view-specific keymap with universal keys

func (ExtendedKeyMap) FullHelp

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

func (ExtendedKeyMap) ShortHelp

func (k ExtendedKeyMap) ShortHelp() []key.Binding
type MainMenu struct {
	// contains filtered or unexported fields
}

MainMenu represents the main menu model

func NewMainMenu

func NewMainMenu(cfg *config.Config) *MainMenu

NewMainMenu creates a new main menu

func NewMainMenuWithClient

func NewMainMenuWithClient(cfg *config.Config, client *anilist.Client) *MainMenu

NewMainMenuWithClient creates a new main menu with an AniList client

func (m *MainMenu) GetIncognitoMode() bool

GetIncognitoMode returns the current incognito mode state

func (m *MainMenu) GetSelected() string

GetSelected returns the selected option

func (m *MainMenu) Init() tea.Cmd

Init initializes the main menu

func (m *MainMenu) SetClient(client *anilist.Client)

SetClient sets the AniList client and fetches continue watching anime

func (m *MainMenu) SetLoadingMsg(msg string)

SetLoadingMsg sets the loading message

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

Update handles messages

func (m *MainMenu) View() string

View renders the main menu

type MenuSelectionMsg struct {
	Selection         string
	ShowEpisodeSelect bool // If true, show episode selection instead of auto-playing
}

MenuSelectionMsg is sent when a menu item is selected

type SearchAnimeItem

type SearchAnimeItem struct {
	Anime anilist.Anime
}

SearchAnimeItem represents a search result anime

func (SearchAnimeItem) Description

func (i SearchAnimeItem) Description() string

func (SearchAnimeItem) FilterValue

func (i SearchAnimeItem) FilterValue() string

func (SearchAnimeItem) Title

func (i SearchAnimeItem) Title() string

type SearchResultMsg

type SearchResultMsg struct {
	Results []anilist.Anime
	Err     error
}

SearchResultMsg is sent when search results are ready

type Styles

type Styles struct {
	Title        lipgloss.Style
	Subtitle     lipgloss.Style
	MenuItem     lipgloss.Style
	SelectedItem lipgloss.Style
	Info         lipgloss.Style
	Error        lipgloss.Style
	Success      lipgloss.Style
	Prompt       lipgloss.Style
	Border       lipgloss.Style
	Help         lipgloss.Style
	StatusBar    lipgloss.Style
	AnimeTitle   lipgloss.Style
	EpisodeInfo  lipgloss.Style
}

Styles contains all the lipgloss styles used in the UI

func DefaultStyles

func DefaultStyles() Styles

DefaultStyles returns the default styles with enhanced colors

func IncognitoStyles

func IncognitoStyles() Styles

IncognitoStyles returns styles with hot pink color scheme for incognito mode

type UniversalKeyMap

type UniversalKeyMap struct {
	UniversalKeys
}

UniversalKeyMap implements help.KeyMap for universal keys

func (UniversalKeyMap) FullHelp

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

func (UniversalKeyMap) ShortHelp

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

type UniversalKeys

type UniversalKeys struct {
	Help key.Binding
	Quit key.Binding
}

UniversalKeys defines keybindings available in all views

func DefaultUniversalKeys

func DefaultUniversalKeys() UniversalKeys

DefaultUniversalKeys returns the default universal keybindings

type UpdateCompleteMsg

type UpdateCompleteMsg struct {
	Success bool
	Message string
	Err     error
}

UpdateCompleteMsg is sent when update is complete

type UpdateProgress

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

UpdateProgress represents the update progress model

func NewUpdateProgress

func NewUpdateProgress(cfg *config.Config, client *anilist.Client) *UpdateProgress

NewUpdateProgress creates a new update progress UI

func (*UpdateProgress) Init

func (m *UpdateProgress) Init() tea.Cmd

Init initializes the update progress UI

func (*UpdateProgress) Update

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

Update handles messages

func (*UpdateProgress) View

func (m *UpdateProgress) View() string

View renders the update progress UI

type UpdateProgressState

type UpdateProgressState int

UpdateProgressState represents the update state

const (
	UpdateTypeSelection UpdateProgressState = iota
	UpdateAnimeSelection
	UpdateInputEntry
	UpdateProcessing
	UpdateComplete
)

type UpdateType

type UpdateType int

UpdateType represents the type of update

const (
	UpdateEpisode UpdateType = iota
	UpdateStatus
	UpdateScore
)

Jump to

Keyboard shortcuts

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