month

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

License: GPL-3.0-only (c) 2022 Dakota Walsh <kota@nilsu.org>

License: GPL-3.0-only (c) 2022 Dakota Walsh <kota@nilsu.org>

Index

Constants

View Source
const (
	MonthHeight = 8
	MonthWidth  = 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Layout added in v0.2.0

type Layout uint8

Layout describes the arrangement of the month elements.

const (
	// LayoutColumn is when a column of month elements should be shown.
	LayoutColumn Layout = iota
	// LayoutGrid is when a grid of a full year of months should be shown.
	LayoutGrid
)

type Month

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

Month is the Bubble Tea model for this month element.

func New

func New(
	date, today, selected time.Time,
	layout Layout,
	holidays holiday.Holidays,
	conf *config.Config,
) Month

New creates a new month model. The list of styledDays is not calculated on creation. The Init method must be called to parse and load these concurrently.

func (Month) Date

func (m Month) Date() time.Time

Date returns this month's date.

func (*Month) Focus

func (m *Month) Focus()

Focus the preview.

func (Month) Init

func (m Month) Init() tea.Cmd

Init the month in Bubble Tea. Reads holidays and keywords to build out a list of styledDays.

func (Month) Select

func (m Month) Select(t time.Time) Month

Select updates the selected time.

func (Month) Selected

func (m Month) Selected() time.Time

Selected returns the current selection (from the perspective of this month).

func (*Month) SetToday

func (m *Month) SetToday(t time.Time)

SetToday sets the today value to a new time.

func (Month) String

func (m Month) String() string

String prints out the month's data for debugging.

func (*Month) Unfocus

func (m *Month) Unfocus()

Unfocus the preview.

func (Month) Update

func (m Month) Update(msg tea.Msg) (Month, tea.Cmd)

Updates the month in the Bubble Tea update loop.

func (Month) View

func (m Month) View() string

View renders the month in its current state.

Jump to

Keyboard shortcuts

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