group

package
v0.0.0-...-8b058bf Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateCreatingGroup compositor.State = iota + 300
	StateEditingGroup
	StateInitializingGroup
	StateInitializedGroup
)

Variables

This section is empty.

Functions

func AsSubModel

func AsSubModel() compositor.Option[*Model]

func WithCompany

func WithCompany(company *data.Company) compositor.Option[*Model]

func WithCompanyMaxPoints

func WithCompanyMaxPoints(max int) compositor.Option[*Model]

func WithGroup

func WithGroup(group *data.Group) compositor.Option[*Model]

func WithGroupMaxPoints

func WithGroupMaxPoints(max int) compositor.Option[*Model]

Types

type Indexes

type Indexes struct {
	CurrentTraitWithChoice int
	CurrentChoice          int
}

type Limits

type Limits struct {
	CompanyMaximumPoints int
	GroupMaximumPoints   int
}

type Model

type Model struct {
	tui.SharedModel
	*data.Group
	BaseProfile       data.Group
	Company           *data.Company
	Indexes           Indexes
	Limits            Limits
	Substate          Substate
	Temp              Temp
	TraitsWithChoices []*data.Trait
	// Could be any prompt, depends on the current choice
	TraitChooser *dynamic.Model
}

func NewModel

func NewModel(api *flfa.Api, options ...compositor.Option[*Model]) *Model

func (*Model) ApplicableProfiles

func (model *Model) ApplicableProfiles() (applicableProfiles []data.Profile)

func (*Model) ApplicableTraits

func (model *Model) ApplicableTraits() (applicableTraits []data.Trait)

func (*Model) CurrentTraitChoice

func (model *Model) CurrentTraitChoice() *data.TraitChoice

func (*Model) CurrentTraitWithChoice

func (model *Model) CurrentTraitWithChoice() *data.Trait

func (*Model) FormattedGroupName

func (model *Model) FormattedGroupName() string

func (*Model) GroupEditingOverview

func (model *Model) GroupEditingOverview() string

func (*Model) Init

func (model *Model) Init() tea.Cmd

func (*Model) InitializeGroup

func (model *Model) InitializeGroup(nextSubstate compositor.SubstateInterface[*Model]) tea.Cmd

func (*Model) RemovableTraits

func (model *Model) RemovableTraits() (removableTraits []data.Trait)

func (*Model) Return

func (model *Model) Return() *data.Group

func (*Model) SetAndStartState

func (model *Model) SetAndStartState(state compositor.State) (cmd tea.Cmd)

func (*Model) SetAndStartSubstate

func (model *Model) SetAndStartSubstate(substate compositor.SubstateInterface[*Model]) (cmd tea.Cmd)

func (*Model) Update

func (model *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Model) UpdateBaseProfile

func (model *Model) UpdateBaseProfile(updating bool) (cmd tea.Cmd)

func (*Model) UpdateCompanyWorkingPointTotal

func (model *Model) UpdateCompanyWorkingPointTotal()

func (*Model) UpdateCurrentTraitWithChoiceName

func (model *Model) UpdateCurrentTraitWithChoiceName()

func (*Model) UpdateEditingChoice

func (model *Model) UpdateEditingChoice() (cmd tea.Cmd)

func (*Model) UpdateFallThrough

func (model *Model) UpdateFallThrough(msg tea.Msg) (cmd tea.Cmd)

func (*Model) UpdateName

func (model *Model) UpdateName(nextSubstate compositor.SubstateInterface[*Model]) tea.Cmd

func (*Model) UpdateOnKeyPress

func (model *Model) UpdateOnKeyPress(msg tea.KeyMsg) (cmd tea.Cmd)

func (*Model) UpdateOnSubmodelEnded

func (model *Model) UpdateOnSubmodelEnded() (cmd tea.Cmd)

func (*Model) UpdateTrait

func (model *Model) UpdateTrait() (cmd tea.Cmd)

func (*Model) UpdateTraitAdd

func (model *Model) UpdateTraitAdd() tea.Cmd

func (*Model) UpdateTraitChoice

func (model *Model) UpdateTraitChoice() (cmd tea.Cmd)

func (*Model) UpdateTraitRemove

func (model *Model) UpdateTraitRemove() tea.Cmd

func (*Model) View

func (model *Model) View() (view string)

type Option

type Option func(model *Model)

type Substate

type Substate struct {
	Creation SubstateCreating
	Editing  SubstateEditing
}

type SubstateCreating

type SubstateCreating int
const (
	IdleCreating SubstateCreating = iota
	Naming
	SelectingProfile
)

func (SubstateCreating) Start

func (state SubstateCreating) Start(model *Model) (cmd tea.Cmd)

func (SubstateCreating) UpdateOnEnded

func (state SubstateCreating) UpdateOnEnded(model *Model) (cmd tea.Cmd)

func (SubstateCreating) UpdateOnEnter

func (state SubstateCreating) UpdateOnEnter(model *Model) (cmd tea.Cmd)

func (SubstateCreating) UpdateOnEsc

func (state SubstateCreating) UpdateOnEsc(model *Model) (cmd tea.Cmd)

func (SubstateCreating) UpdateOnFallThrough

func (state SubstateCreating) UpdateOnFallThrough(model *Model, msg tea.Msg) (cmd tea.Cmd)

func (SubstateCreating) View

func (state SubstateCreating) View(model *Model) (view string)

type SubstateEditing

type SubstateEditing int
const (
	IdleEditing SubstateEditing = iota
	SelectingOption
	Renaming
	ChangingBaseProfile
	ConfirmingBaseProfileUpdate
	AddingSpecialTrait
	RemovingSpecialTrait
	MakingTraitChoice
)

func (SubstateEditing) Start

func (state SubstateEditing) Start(model *Model) (cmd tea.Cmd)

func (SubstateEditing) UpdateOnEnded

func (state SubstateEditing) UpdateOnEnded(model *Model) (cmd tea.Cmd)

func (SubstateEditing) UpdateOnEnter

func (state SubstateEditing) UpdateOnEnter(model *Model) (cmd tea.Cmd)

func (SubstateEditing) UpdateOnEsc

func (state SubstateEditing) UpdateOnEsc(model *Model) (cmd tea.Cmd)

func (SubstateEditing) UpdateOnFallThrough

func (state SubstateEditing) UpdateOnFallThrough(model *Model, msg tea.Msg) (cmd tea.Cmd)

func (SubstateEditing) View

func (state SubstateEditing) View(model *Model) (view string)

type Temp

type Temp struct {
	CompanyPoints     int
	ProfileName       string
	TraitsWithChoices []*data.Trait
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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