Skip to content

Commit

Permalink
Merge pull request #22 from buildsafedev/ux-update#14
Browse files Browse the repository at this point in the history
  • Loading branch information
saiyam1814 committed Jun 11, 2024
2 parents b28bba5 + 23ad4a8 commit a719db2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions cmd/search/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (m *versionConstraintsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
case key.Matches(msg, KeyMap.Back):
return m.pkgoption.Update(msg)
case key.Matches(msg, KeyMap.Space):
case key.Matches(msg, KeyMap.Enter):
if m.constraint[m.choices[m.cursor]] {
m.constraint[m.choices[m.cursor]] = false
} else {
Expand All @@ -80,8 +80,6 @@ func (m *versionConstraintsModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
m.constraint[m.choices[m.cursor]] = true
}

case key.Matches(msg, KeyMap.Enter):
return m.updateVersionConstraint()
}
}
Expand All @@ -95,17 +93,15 @@ func (m versionConstraintsModel) View() string {
s.WriteString(styles.TitleStyle.Render(fmt.Sprintf("What type of updates would you like for %s-%s?", m.name, m.version)))
s.WriteString("\n\n")
for i, choice := range m.choices {
if m.constraint[choice] {
s.WriteString(styles.SelectedOptionStyle.Render("✔ " + choice))
} else if m.cursor == i {
if m.cursor == i {
s.WriteString(styles.CursorOptionStyle.Render("-> " + choice))
} else {
s.WriteString(styles.OptionStyle.Render(" " + choice))
}
s.WriteString("\n")

}
s.WriteString(styles.HelpStyle.Render("\n(↑↓ to move cursor, space to select/unselect, enter to submit)\n"))
s.WriteString(styles.HelpStyle.Render("\n(↑↓ to move cursor & enter to submit )\n"))

return s.String()
}
Expand Down

0 comments on commit a719db2

Please sign in to comment.