learning

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const PAGE_SIZE = 4096 // Each page is 4096 chars

Variables

This section is empty.

Functions

func LearningMaterialList

func LearningMaterialList(props LearningMaterialListProps) *dom.Node

func ReadingMaterialPage

func ReadingMaterialPage(props ReadingProps) *dom.Node

func Word

func Word(props WordProps) *dom.Node

Word renders a single word as an inline span element Each word can be individually focused and styled

func WordDefinitionPanel added in v0.0.26

func WordDefinitionPanel(word string) *dom.Node

WordDefinitionPanel renders a bordered panel showing word definition

Types

type LearningMaterialListProps

type LearningMaterialListProps struct {
	Materials        []*models.LearningMaterial
	SelectedIndex    int
	ContainerHeight  int
	ContainerWidth   int
	OnNavigateBack   func()
	OnReload         func()
	OnSelectMaterial func(index int)
	OnOpenMaterial   func(materialID int64)
	OnNavigateUp     func()
	OnNavigateDown   func()
}

type ReadingProps

type ReadingProps struct {
	MaterialID    int64
	MaterialTitle string
	CurrentPage   int
	TotalPages    int
	Content       string
	Loading       bool
	Error         string

	// Word navigation
	FocusedWordIndex int
	WordPositions    []models.WordPosition

	// Viewport scrolling
	ScrollOffset   int
	ViewportHeight int

	// Word definition
	ShowDefinition bool
	DefinitionWord string

	OnNavigateBack     func()
	OnNextPage         func()
	OnPrevPage         func()
	OnGoToPage         func(page int)
	OnNavigateWord     func(delta int) // Navigate by word (left/right)
	OnNavigateLine     func(delta int) // Navigate by line (up/down)
	OnPageNavigation   func(delta int) // Page navigation (h/l keys)
	OnJumpToFirst      func()          // Jump to first word (gg in vim)
	OnJumpToLast       func()          // Jump to last word (G in vim)
	OnKeyG             func()          // Handle 'g' key press for 'gg' sequence
	OnToggleDefinition func()          // Toggle word definition panel (Enter key)
}

type WordProps

type WordProps struct {
	Text    string
	Focused bool // Whether this word is currently focused
}

WordProps contains properties for rendering a single word

Jump to

Keyboard shortcuts

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