Style forms; [WIP] Draw table
This commit is contained in:
@ -35,9 +35,12 @@ func NewContextPickerPage(common *common.Common) *ContextPickerPage {
|
||||
selected := common.TW.GetActiveContext().Name
|
||||
options := make([]string, 0)
|
||||
for _, c := range p.contexts {
|
||||
options = append(options, c.Name)
|
||||
if c.Name != "none" {
|
||||
options = append(options, c.Name)
|
||||
}
|
||||
}
|
||||
slices.Sort(options)
|
||||
options = append([]string{"(none)"}, options...)
|
||||
|
||||
p.form = huh.NewForm(
|
||||
huh.NewGroup(
|
||||
@ -50,7 +53,8 @@ func NewContextPickerPage(common *common.Common) *ContextPickerPage {
|
||||
),
|
||||
).
|
||||
WithShowHelp(false).
|
||||
WithShowErrors(true)
|
||||
WithShowErrors(true).
|
||||
WithTheme(p.common.Styles.Form)
|
||||
|
||||
return p
|
||||
}
|
||||
@ -99,7 +103,11 @@ func (p *ContextPickerPage) View() string {
|
||||
}
|
||||
|
||||
func (p *ContextPickerPage) updateContextCmd() tea.Msg {
|
||||
return UpdateContextMsg(p.common.TW.GetContext(p.form.GetString("context")))
|
||||
context := p.form.GetString("context")
|
||||
if context == "(none)" {
|
||||
context = "none"
|
||||
}
|
||||
return UpdateContextMsg(p.common.TW.GetContext(context))
|
||||
}
|
||||
|
||||
type UpdateContextMsg *taskwarrior.Context
|
||||
|
||||
Reference in New Issue
Block a user