cards

package
v0.3.23 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCard

func AddCard(front, back string) tea.Cmd

func SelectCard added in v0.3.2

func SelectCard(selectedCard *ListItem) tea.Cmd

func UpdateCard

func UpdateCard(frontVal, backVal string) tea.Cmd

Types

type AddCardMsg

type AddCardMsg struct {
	Front, Back string
}

type CardSelectedMsg added in v0.3.2

type CardSelectedMsg struct {
	CardItem ListItem
}

type ListItem added in v0.3.2

type ListItem struct {
	DBItem flashcard.Card
}

ListItem to represent card in cards list.

It contains front side of card as Title and back side of card as Description.

Also it keeps dbItem that helps to manipulatie corresponding card object in repository.

func (ListItem) Back added in v0.3.22

func (i ListItem) Back() string

Back side of card.

func (ListItem) Description added in v0.3.2

func (i ListItem) Description() string

Description of the item, that is actually a card's masked back side.

The Description is masked in order to don't spoil the fun of learning.

func (ListItem) FilterValue added in v0.3.2

func (i ListItem) FilterValue() string

FilterValue by its front and back side.

func (ListItem) Front added in v0.3.22

func (i ListItem) Front() string

Front side of card.

func (ListItem) Title added in v0.3.2

func (i ListItem) Title() string

Title of the item, that is actually a card's front side.

type Model

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

Model represents state of cards pane.

Cards pane manages all cards stored in the selected deck.

func New

func New() *Model

func (*Model) Focus

func (m *Model) Focus()

Focus changes style of borders from '--' to '=='.

func (*Model) GetHeight added in v0.3.2

func (m *Model) GetHeight() int

func (*Model) GetWidth added in v0.3.2

func (m *Model) GetWidth() int

func (*Model) Init added in v0.3.22

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

func (*Model) IsTyping

func (m *Model) IsTyping() bool

func (*Model) SelectedCard added in v0.3.2

func (m *Model) SelectedCard() (int, *ListItem)

func (*Model) SetHeight

func (m *Model) SetHeight(height int)

func (*Model) SetWidth

func (m *Model) SetWidth(width int)

func (*Model) Unfocus

func (m *Model) Unfocus()

Focus changes style of borders from '==' to '--'.

func (*Model) Update

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

func (*Model) View

func (m *Model) View() string

type NoCardSelectedMsg added in v0.3.4

type NoCardSelectedMsg struct{}

type UpdateCardMsg

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

Jump to

Keyboard shortcuts

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