Documentation
¶
Index ¶
- Constants
- func HappeningListPage(state *State, height int) *dom.Node
- func HelpPage(state *State, window *dom.Window) *dom.Node
- func HumanStatePage(state *State) *dom.Node
- func LearningPage(state *State, width int, height int) *dom.Node
- func ReadingPage(state *State, materialID int64, width int, height int) *dom.Node
- type ConfigPageState
- type ConfigPhase
- type DetailPageState
- type HappeningListPageState
- type HappeningState
- type HelpPageState
- type HumanStatePageState
- type LearningPageState
- type LearningState
- type MainPageState
- type MutexMap
- type ReadingPageState
- type ReadingState
- type Route
- type RouteType
- type Routes
- type SelectedEntryMode
- type SelectedSource
- type State
- func (state *State) ClearSearch()
- func (state *State) ClearSearchSelectedEntry()
- func (state *State) ClearSelectedEntry()
- func (state *State) Deselect()
- func (state *State) Enqueue(action func(ctx context.Context) error)
- func (state *State) FindEntryByID(entryID int64) *models.LogEntryView
- func (state *State) FindGroupForEntry(entryID int64) int64
- func (state *State) IsDescendantOf(potentialChild models.EntryIdentity, potentialParent models.EntryIdentity) bool
- func (state *State) PopFromNavigationStack() (models.EntryIdentity, bool)
- func (state *State) PushToNavigationStack(entry models.EntryIdentity)
- func (state *State) Requesting() bool
- func (state *State) ResetAllChildrenVisibility()
- func (state *State) Select(entyType models.LogEntryViewType, id int64)
- func (state *State) SelectNote(noteID int64, entryID int64)
- func (state *State) SetSearchSelectedEntry(entry models.EntryIdentity)
- type StatusBar
- type StorageType
- type TreeEntry
- type TreeFocusedItem
- type TreeGroup
- type TreeLog
- type TreeNote
- type ViewMode
Constants ¶
const ( GROUP_DEADLINE_ID = 1 GROUP_WORKPERF_ID = 2 GROUP_LIFEENHANCE_ID = 3 GROUP_WORKHACK_ID = 4 GROUP_LIFEHACK_ID = 5 GROUP_OTHER_ID = 6 )
Group IDs for organizing entries in group mode
const ( SelectedEntryMode_Default = iota SelectedEntryMode_Editing SelectedEntryMode_ShowActions SelectedEntryMode_DeleteConfirm SelectedEntryMode_AddingChild )
const PAGE_SIZE = 4096 // Each page is 4096 bytes
Variables ¶
This section is empty.
Functions ¶
func HappeningListPage ¶
HappeningListPage renders the happening list page
func HumanStatePage ¶
HumanStatePage renders the human state page
func LearningPage ¶
LearningPage renders the learning materials page
Types ¶
type ConfigPageState ¶
type ConfigPageState struct {
ConfigPhase ConfigPhase
SelectedStorageType StorageType
PickingStorageType StorageType
ServerAddr models.InputState
ServerAuthToken models.InputState
ConfirmButtonFocused bool
CancelButtonFocused bool
}
type ConfigPhase ¶
type ConfigPhase int
const ( ConfigPhase_PickingStorageType ConfigPhase = iota ConfigPhase_PickingStorageDetail )
type DetailPageState ¶
type DetailPageState struct {
EntryID int64
}
type HappeningListPageState ¶
type HappeningListPageState struct {
}
type HappeningState ¶
type HappeningState struct {
Loading bool
Happenings []*models.Happening
Error string
Input models.InputState
SubmitState submit.SubmitState // Submission state management
SelectedItemIndex int
// Edit/Delete state
EditingItemID int64
EditInputState models.InputState
DeletingItemID int64
DeleteConfirmButton int // 0 = Delete, 1 = Cancel
LoadHappenings func(ctx context.Context) ([]*models.Happening, error)
AddHappening func(ctx context.Context, content string) (*models.Happening, error)
UpdateHappening func(ctx context.Context, id int64, update *models.HappeningOptional) (*models.Happening, error)
DeleteHappening func(ctx context.Context, id int64) error
}
type HelpPageState ¶
type HelpPageState struct {
ScrollOffset int // Current scroll position (line offset from top)
}
type HumanStatePageState ¶
type HumanStatePageState struct {
}
type LearningPageState ¶
type LearningPageState struct {
}
type LearningState ¶
type LearningState struct {
Loading bool
Materials []*models.LearningMaterial
Error string
LoadMaterials func(ctx context.Context, offset int, limit int) ([]*models.LearningMaterial, int64, error)
LoadMaterialsOnce func() // Load materials once on first access
// Selected material for reading
SelectedMaterialIndex int
}
type MainPageState ¶
type MainPageState struct {
Entries []TreeEntry
}
type MutexMap ¶
type MutexMap struct {
// contains filtered or unexported fields
}
MutexMap provides thread-safe access to a map[int64]bool
type ReadingPageState ¶
type ReadingPageState struct {
MaterialID int64
}
type ReadingState ¶
type ReadingState struct {
MaterialID int64
CurrentPage int
TotalBytes int
Loading bool
Error string
ContentCache map[int]string // Cache content by page number (each page is 4096 bytes)
// Word-level navigation
FocusedWordIndex int // Index of currently focused word in the current page
WordPositions []models.WordPosition // Positions of all words in current page
// Viewport scrolling
ScrollOffset int // Current scroll position (line offset from top)
// Vim-like navigation
LastKeyWasG bool // Track if last key was 'g' for 'gg' sequence
// Search functionality
SearchMode bool // Whether in search mode (typing query)
SearchQuery string // Current search query
SearchMatches []int // Indices of words that match the search
CurrentMatchIndex int // Index in SearchMatches array
// Word definition functionality
ShowDefinition bool // Whether to show word definition panel
DefinitionWord string // The word to show definition for
LoadContent func(ctx context.Context, materialID int64, offset int, limit int) (content string, totalBytes int, lastOffset int64, err error)
SavePosition func(ctx context.Context, materialID int64, offset int64) error
}
type Route ¶
type Route struct {
Type RouteType
MainPage *MainPageState
DetailPage *DetailPageState
ConfigPage *ConfigPageState
HappeningListPage *HappeningListPageState
HumanStatePage *HumanStatePageState
HelpPage *HelpPageState
LearningPage *LearningPageState
ReadingPage *ReadingPageState
}
func ConfigRoute ¶
func ConfigRoute(state ConfigPageState) Route
func DetailRoute ¶
func HappeningListRoute ¶
func HappeningListRoute() Route
func HumanStateRoute ¶
func HumanStateRoute() Route
func LearningRoute ¶
func LearningRoute() Route
func ReadingRoute ¶
type SelectedEntryMode ¶
type SelectedEntryMode int
type SelectedSource ¶
type SelectedSource int
const ( SelectedSource_Default SelectedSource = iota SelectedSource_Search )
type State ¶
type State struct {
Entries models.LogEntryViews
Input models.InputState
SubmitState submit.SubmitState // Submission state management
SelectedEntry models.EntryIdentity
LastSelectedEntry models.EntryIdentity
EntrySliceStart int // Slice start for VScroller to preserve window frame position
SelectedNoteID int64 // ID of the selected note (0 if none)
SelectedNoteEntryID int64 // ID of the entry that owns the selected note
SelectFromSource SelectedSource
SelectedEntryMode SelectedEntryMode
SelectedInputState models.InputState
ChildInputState models.InputState
ChildSubmitState submit.SubmitState // Submission state management for child entries
SelectedDeleteConfirmButton int
// in ZenMode, only show highlighted and
// unfinished entries
ZenMode bool
SelectedActionIndex int
Routes Routes
// Happening functionality
Happening HappeningState
// Human state functionality
HumanState *human_state.HumanState
// Learning functionality
Learning LearningState
// Reading functionality
Reading ReadingState
ShowHistory bool // Whether to show historical (done) todos from before today
ShowNotes bool // Whether to show all notes globally
ExpandAll bool // Whether to expand all entries, ignoring individual collapse flags
// Search functionality
SearchQuery string // Current search query (without the ? prefix)
IsSearchActive bool // Whether search mode is active
SearchSelectedEntry models.EntryIdentity
// Cut/Paste functionality
CuttingEntry models.EntryIdentity // ID of the entry currently being cut (0 if none)
// Focused mode functionality
FocusedEntry models.EntryIdentity // ID of the entry currently focused on (0 if none)
// View mode functionality
ViewMode ViewMode // Current view mode (default or group)
// Group collapse state (for group mode entries that don't exist in DB)
GroupCollapseState *MutexMap // Thread-safe map for group collapse states
NavigationStack []models.EntryIdentity // Stack to track navigation history
Quit func()
Refresh func()
OnAdd func(ctx context.Context, viewType models.LogEntryViewType, text string) error
OnAddChild func(ctx context.Context, viewType models.LogEntryViewType, parentID int64, text string) (models.LogEntryViewType, int64, error)
OnUpdate func(viewType models.LogEntryViewType, id int64, text string) error
OnDelete func(viewType models.LogEntryViewType, id int64) error
OnRemoveFromGroup func(viewType models.LogEntryViewType, id int64) error
OnToggle func(viewType models.LogEntryViewType, id int64) error
OnPromote func(viewType models.LogEntryViewType, id int64) error
OnUpdateHighlight func(viewType models.LogEntryViewType, id int64, highlightLevel int)
OnMove func(id models.EntryIdentity, newParentID models.EntryIdentity) error
OnAddNote func(id int64, text string) error
OnUpdateNote func(entryID int64, noteID int64, text string)
OnDeleteNote func(entryID int64, noteID int64)
RefreshEntries func(ctx context.Context) error // Callback to refresh entries when ShowHistory changes
OnShowTop func(id int64, text string, duration time.Duration) // Callback to show todo in macOS floating bar
OnToggleVisibility func(id int64) error // Callback to toggle visibility of all children including history
OnToggleNotesDisplay func(id int64) error // Callback to toggle notes display for entry and its subtree
OnToggleCollapsed func(ctx context.Context, entryType models.LogEntryViewType, id int64) error // Callback to toggle collapsed state for entry
LastCtrlC time.Time
StatusBar StatusBar
// contains filtered or unexported fields
}
func (*State) ClearSearch ¶
func (state *State) ClearSearch()
func (*State) ClearSearchSelectedEntry ¶ added in v0.0.30
func (state *State) ClearSearchSelectedEntry()
func (*State) ClearSelectedEntry ¶ added in v0.0.30
func (state *State) ClearSelectedEntry()
func (*State) FindEntryByID ¶
func (state *State) FindEntryByID(entryID int64) *models.LogEntryView
FindEntryByID finds an entry by its ID in the entries tree
func (*State) FindGroupForEntry ¶
findGroupForEntry finds which group an entry belongs to in group mode
func (*State) IsDescendantOf ¶
func (state *State) IsDescendantOf(potentialChild models.EntryIdentity, potentialParent models.EntryIdentity) bool
IsDescendant checks if potentialChild is a descendant of potentialParent cannot paste a parent into its child
func (*State) PopFromNavigationStack ¶
func (state *State) PopFromNavigationStack() (models.EntryIdentity, bool)
PopFromNavigationStack pops and returns the last entry from the navigation stack
func (*State) PushToNavigationStack ¶
func (state *State) PushToNavigationStack(entry models.EntryIdentity)
PushToNavigationStack pushes the current selected entry to the navigation stack
func (*State) Requesting ¶
Requesting returns true if there are ongoing actions
func (*State) ResetAllChildrenVisibility ¶
func (state *State) ResetAllChildrenVisibility()
ResetAllChildrenVisibility resets all IncludeHistory states to false This is used when /history is toggled off to reset all 'v' command states
func (*State) SelectNote ¶
func (*State) SetSearchSelectedEntry ¶ added in v0.0.30
func (state *State) SetSearchSelectedEntry(entry models.EntryIdentity)
type StorageType ¶
type StorageType int
const ( StorageType_LocalFile StorageType = iota StorageType_LocalSqlite StorageType_Server )
type TreeEntry ¶
type TreeEntry struct {
Type models.LogEntryViewType
Prefix string
IsLast bool
// for all
Entry *models.LogEntryView
Log *TreeLog
Note *TreeNote // TODO: remove
FocusedItem *TreeFocusedItem
Group *TreeGroup
}
TreeEntry wraps either a log entry or a note for unified tree rendering
type TreeFocusedItem ¶
type TreeFocusedItem struct {
RootPath []string
}
TreeFocusedItem represents the focused root path