company

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: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateChoosingCompany compositor.State = iota + 200
	StateCreatingCompany
	StateEditingCompany
	StateLoadingCompany
	StateLoadedCompany
	StateSavingCompany
	StateSavedCompany
)

Variables

This section is empty.

Functions

func AsSubModel

func AsSubModel() compositor.Option[*Model]

func WithAvailableCompanies

func WithAvailableCompanies(companies []data.Company) compositor.Option[*Model]

func WithCompany

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

func WithCompanyMaxPoints

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

func WithGroupMaxPoints

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

Types

type Indexes

type Indexes struct {
	EditingGroup       int
	CurrentCaptain     int
	ReplacementCaptain int
}

type Limits

type Limits struct {
	CompanyMaximumPoints int
	GroupMaximumPoints   int
}

type Model

type Model struct {
	tui.SharedModel
	*data.Company
	Limits             Limits
	Indexes            Indexes
	AvailableCompanies []data.Company
	Substate           Substate
	Group              *group.Model
}

func NewModel

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

func (*Model) AddGroup

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

func (*Model) CaptainSummary

func (model *Model) CaptainSummary() string

func (*Model) CaptainsGroup

func (model *Model) CaptainsGroup() (captain data.Group)

func (*Model) CompanyOverview

func (model *Model) CompanyOverview() string

func (*Model) FormattedCompanyDescription

func (model *Model) FormattedCompanyDescription() string

func (*Model) FormattedCompanyName

func (model *Model) FormattedCompanyName() string

func (*Model) HasCaptain

func (model *Model) HasCaptain() bool

func (*Model) Init

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

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) ShouldDisplayCaptainSummary

func (model *Model) ShouldDisplayCaptainSummary() bool

func (*Model) ShouldDisplayCompanyOverview

func (model *Model) ShouldDisplayCompanyOverview() bool

func (*Model) Update

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

func (*Model) UpdateCaptainDemotion

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

func (*Model) UpdateCaptainReplacement

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

func (*Model) UpdateCaptainSelection

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

func (*Model) UpdateCaptainTrait

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

func (*Model) UpdateDescription

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

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) UpdateGroup

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

func (*Model) UpdateGroupSelection

func (model *Model) UpdateGroupSelection() (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) UpdateRerolledCaptainTrait

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

func (*Model) UpdateSelectingCompany

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

func (*Model) View

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

type Substate

type Substate struct {
	Choosing SubstateChoosing
	Creating SubstateCreating
	Editing  SubstateEditing
}

type SubstateChoosing

type SubstateChoosing int
const (
	SelectingCompany SubstateChoosing = iota
)

func (SubstateChoosing) Start

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

func (SubstateChoosing) UpdateOnEnded

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

func (SubstateChoosing) UpdateOnEnter

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

func (SubstateChoosing) UpdateOnEsc

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

func (SubstateChoosing) UpdateOnFallThrough

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

func (SubstateChoosing) View

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

type SubstateCreating

type SubstateCreating int
const (
	Naming SubstateCreating = iota
	Describing
	AddingFirstGroup
)

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) string

type SubstateEditing

type SubstateEditing int
const (
	SelectingOption SubstateEditing = iota
	Renaming
	Redescribing
	AddingGroup
	SelectingGroupToEdit
	SelectingGroupToPromote
	EditingGroup
	CopyingGroup
	RemovingGroup
	SelectingCaptainOption
	RerollingCaptainTrait
	SelectingCaptainTrait
	SelectingCaptainReplacement
	ConfirmingCaptainReplacement
	ConfirmingCaptainDemotion
)

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) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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