popup

package
v0.0.0-...-bd6e9b7 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalPopupManager = NewPopupManager()

Global popup manager instance

Functions

func ClosePopup

func ClosePopup()

func CreateColorPreview

func CreateColorPreview(color string) string

CreateColorPreview creates a visual color preview block using foreground color and block characters

func HandlePopupKey

func HandlePopupKey(key string) tea.Cmd

func HasPopup

func HasPopup() bool

func RenderPopup

func RenderPopup(ctx PopupRenderContext) string

func ShowAgendaPicker

func ShowAgendaPicker(events []*types.EventInstance, targetDay int, dayName string, onAction func(AgendaPickerAction, *ical.Event) tea.Cmd)

ShowAgendaPicker shows the agenda picker popup

func ShowCalendarSelector

func ShowCalendarSelector(calendars []types.CalendarInfo, visibleState map[string]bool, onAction func(CalendarSelectorAction, string) tea.Cmd)

ShowCalendarSelector shows the calendar selector popup

func ShowEventDetailsPopup

func ShowEventDetailsPopup(event *ical.Event, calendarName string)

ShowEventDetailsPopup is a convenience function to show event details popup

func ShowPopup

func ShowPopup(popup Popup)

Convenience functions for global popup management

func ShowRecurringDialog

func ShowRecurringDialog(event *ical.Event, operationType types.RecurringEventOperationType, onChoice func(RecurringDialogChoice) tea.Cmd)

ShowRecurringDialog shows the recurring dialog popup

Types

type AgendaPickerAction

type AgendaPickerAction string

AgendaPickerAction represents available actions in the agenda picker

const (
	AgendaActionViewDetails AgendaPickerAction = "view_details"
	AgendaActionEdit        AgendaPickerAction = "edit"
	AgendaActionDelete      AgendaPickerAction = "delete"
	AgendaActionOpenURL     AgendaPickerAction = "open_url"
	AgendaActionClose       AgendaPickerAction = "close"
)

type AgendaPickerPopup

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

AgendaPickerPopup shows a list of events for a specific day

func NewAgendaPickerPopup

func NewAgendaPickerPopup(events []*types.EventInstance, targetDay int, dayName string, onAction func(AgendaPickerAction, *ical.Event) tea.Cmd) *AgendaPickerPopup

NewAgendaPickerPopup creates a new agenda picker popup

func (*AgendaPickerPopup) GetTitle

func (p *AgendaPickerPopup) GetTitle() string

GetTitle implements the Popup interface

func (*AgendaPickerPopup) HandleKey

func (p *AgendaPickerPopup) HandleKey(key string) (Popup, tea.Cmd)

HandleKey implements the Popup interface

func (*AgendaPickerPopup) Render

Render implements the Popup interface

type CalendarSelectorAction

type CalendarSelectorAction string

CalendarSelectorAction represents available actions in the calendar selector

const (
	CalendarActionToggle CalendarSelectorAction = "toggle"
	CalendarActionClose  CalendarSelectorAction = "close"
)

type CalendarSelectorPopup

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

CalendarSelectorPopup shows a list of calendars with toggle functionality

func NewCalendarSelectorPopup

func NewCalendarSelectorPopup(calendars []types.CalendarInfo, visibleState map[string]bool, onAction func(CalendarSelectorAction, string) tea.Cmd) *CalendarSelectorPopup

NewCalendarSelectorPopup creates a new calendar selector popup

func (*CalendarSelectorPopup) GetTitle

func (p *CalendarSelectorPopup) GetTitle() string

GetTitle implements the Popup interface

func (*CalendarSelectorPopup) HandleKey

func (p *CalendarSelectorPopup) HandleKey(key string) (Popup, tea.Cmd)

HandleKey implements the Popup interface

func (*CalendarSelectorPopup) Render

Render implements the Popup interface

type EventDetailsData

type EventDetailsData struct {
	Title       string
	StartTime   string
	EndTime     string
	Duration    string
	Location    string
	Description string
	Calendar    string
	Color       string
	AllDay      bool
}

EventDetailsData holds formatted event information for display

type EventDetailsPopup

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

EventDetailsPopup shows read-only event details

func NewEventDetailsPopup

func NewEventDetailsPopup(event *ical.Event, calendarName string) *EventDetailsPopup

NewEventDetailsPopup creates a new event details popup

func (*EventDetailsPopup) GetTitle

func (p *EventDetailsPopup) GetTitle() string

GetTitle returns the popup title for debugging

func (*EventDetailsPopup) HandleKey

func (p *EventDetailsPopup) HandleKey(key string) (Popup, tea.Cmd)

HandleKey processes keyboard input

func (*EventDetailsPopup) Render

Render returns the popup's visual representation

type Popup interface {
	// Render returns the popup's visual representation with context
	Render(ctx PopupRenderContext) string

	// HandleKey processes keyboard input and returns the next popup state
	// Returns nil to close popup, returns self to stay open, returns different popup to transition
	HandleKey(key string) (Popup, tea.Cmd)

	// GetTitle returns the popup title for debugging/logging purposes
	GetTitle() string
}

Popup represents any overlay that can be shown on top of the main UI

type PopupManager

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

PopupManager manages the global popup state

func NewPopupManager

func NewPopupManager() *PopupManager

NewPopupManager creates a new popup manager

func (*PopupManager) Close

func (pm *PopupManager) Close()

Close removes the current popup

func (*PopupManager) GetCurrent

func (pm *PopupManager) GetCurrent() Popup

GetCurrent returns the currently active popup (nil if none)

func (*PopupManager) HandleKey

func (pm *PopupManager) HandleKey(key string) tea.Cmd

HandleKey routes keyboard input to the current popup Returns (newPopup, cmd) - newPopup can be nil (close), self (stay), or different popup (transition)

func (*PopupManager) HasPopup

func (pm *PopupManager) HasPopup() bool

HasPopup returns true if there's an active popup (for UI flow control)

func (*PopupManager) Render

func (pm *PopupManager) Render(ctx PopupRenderContext) string

Render renders the current popup overlay with context

func (*PopupManager) Show

func (pm *PopupManager) Show(popup Popup)

Show displays a popup, replacing any currently shown popup

type PopupRenderContext

type PopupRenderContext struct {
	Width           int
	Height          int
	BackgroundColor string
	ForegroundColor string
	BorderColor     string
}

PopupRenderContext contains styling context passed to popups

type RecurringDialogChoice

type RecurringDialogChoice string

RecurringDialogChoice represents the user's choice for recurring operations

const (
	ChoiceThis   RecurringDialogChoice = "this"
	ChoiceFuture RecurringDialogChoice = "future"
	ChoiceAll    RecurringDialogChoice = "all"
	ChoiceCancel RecurringDialogChoice = "cancel"
)

type RecurringDialogPopup

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

RecurringDialogPopup shows the "This/Future/All" choice dialog for recurring events

func NewRecurringDialogPopup

func NewRecurringDialogPopup(event *ical.Event, operationType types.RecurringEventOperationType, onChoice func(RecurringDialogChoice) tea.Cmd) *RecurringDialogPopup

NewRecurringDialogPopup creates a new recurring dialog popup

func (*RecurringDialogPopup) GetTitle

func (p *RecurringDialogPopup) GetTitle() string

GetTitle implements the Popup interface

func (*RecurringDialogPopup) HandleKey

func (p *RecurringDialogPopup) HandleKey(key string) (Popup, tea.Cmd)

HandleKey implements the Popup interface

func (*RecurringDialogPopup) Render

Render implements the Popup interface

Jump to

Keyboard shortcuts

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