Documentation
¶
Index ¶
- Variables
- func ConfirmPrompt(message string) (bool, error)
- func NumberPrompt(message string, defaultVal float64) (float64, error)
- func RunProgram(model tea.Model) error
- func TextPrompt(message, placeholder string) (string, error)
- func WithSpinner[T any](message string, fn func() (T, error)) (T, error)
- type ClientItem
- type DashboardModel
- type DateStep
- type HoursStep
- type NotesStep
- type Picker
- type PickerItem
- type ProjectItem
- type ProjectStep
- type Spinner
- type TaskItem
- type TaskStep
- type TimeEntryData
- type UserItem
- type Wizard
- type WizardStep
Constants ¶
This section is empty.
Variables ¶
var ( // TitleStyle for headers and titles. TitleStyle lipgloss.Style // SelectedStyle for currently selected items. SelectedStyle lipgloss.Style // NormalStyle for regular text. NormalStyle lipgloss.Style // DimStyle for secondary/muted text. DimStyle lipgloss.Style // ErrorStyle for error messages. ErrorStyle lipgloss.Style // SuccessStyle for success messages. SuccessStyle lipgloss.Style // SpinnerStyle for loading spinners. SpinnerStyle lipgloss.Style // HelpStyle for help text. HelpStyle lipgloss.Style // BorderStyle for bordered containers. BorderStyle lipgloss.Style // HighlightStyle for emphasized content. HighlightStyle lipgloss.Style // InputStyle for text inputs. InputStyle lipgloss.Style // PromptStyle for prompts and labels. PromptStyle lipgloss.Style )
var ErrCanceled = errors.New("operation canceled")
ErrCanceled indicates user canceled the operation.
Functions ¶
func ConfirmPrompt ¶
ConfirmPrompt displays a yes/no confirmation prompt.
func NumberPrompt ¶
NumberPrompt displays a numeric input prompt.
func RunProgram ¶
RunProgram executes a bubbletea program and returns any error.
func TextPrompt ¶
TextPrompt displays a text input prompt.
Types ¶
type ClientItem ¶
ClientItem implements PickerItem for Harvest clients.
func (ClientItem) Description ¶
func (c ClientItem) Description() string
func (ClientItem) ID ¶
func (c ClientItem) ID() int64
func (ClientItem) Title ¶
func (c ClientItem) Title() string
type DashboardModel ¶
type DashboardModel struct {
Running *api.TimeEntry
TodayHours float64
WeekHours float64
WeekTarget float64
DailyHours map[string]float64 // key: "Mon", "Tue", etc.
WeekStart time.Time
}
DashboardModel holds dashboard state and data.
func NewDashboard ¶
func NewDashboard(entries []api.TimeEntry, running *api.TimeEntry, weekStart time.Time, weekTarget float64) *DashboardModel
NewDashboard creates a dashboard model from entries.
func (*DashboardModel) View ¶
func (m *DashboardModel) View() string
View renders the dashboard as a string.
type Picker ¶
type Picker struct {
// contains filtered or unexported fields
}
Picker is a searchable list picker for selecting items.
func NewPicker ¶
func NewPicker(title string, items []PickerItem) *Picker
NewPicker creates a new picker with the given title and items.
func (*Picker) Run ¶
func (p *Picker) Run() (PickerItem, error)
Run executes the picker and returns the selected item.
func (*Picker) Selected ¶
func (p *Picker) Selected() PickerItem
Selected returns the selected item (nil if none).
type PickerItem ¶
PickerItem interface for items displayed in the picker.
type ProjectItem ¶
ProjectItem implements PickerItem for Harvest projects.
func PickProject ¶
func PickProject(title string, projects []ProjectItem) (*ProjectItem, error)
PickProject shows a project picker and returns the selected project.
func (ProjectItem) Description ¶
func (p ProjectItem) Description() string
func (ProjectItem) ID ¶
func (p ProjectItem) ID() int64
func (ProjectItem) Title ¶
func (p ProjectItem) Title() string
type ProjectStep ¶
type ProjectStep struct {
Projects []ProjectItem
}
ProjectStep prompts for project selection.
func (*ProjectStep) Name ¶
func (s *ProjectStep) Name() string
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner displays a loading indicator with a message.
func NewSpinner ¶
NewSpinner creates a new spinner with the given message.
type TaskItem ¶
TaskItem implements PickerItem for Harvest tasks.
func (TaskItem) Description ¶
type TimeEntryData ¶
type TimeEntryData struct {
ProjectID int64
ProjectName string
TaskID int64
TaskName string
SpentDate string
Hours float64
Notes string
}
TimeEntryFromWizard extracts time entry data from wizard results.
func ParseTimeEntryData ¶
func ParseTimeEntryData(data map[string]any) (*TimeEntryData, error)
ParseTimeEntryData extracts structured data from wizard results.
type Wizard ¶
type Wizard struct {
// contains filtered or unexported fields
}
Wizard is a multi-step form for collecting data.
func NewTimeEntryWizard ¶
func NewTimeEntryWizard(projects []ProjectItem, tasksFn func(int64) ([]TaskItem, error)) *Wizard
NewTimeEntryWizard creates a wizard for creating time entries.
func NewWizard ¶
func NewWizard(steps ...WizardStep) *Wizard
NewWizard creates a new wizard with the given steps.