fix(ui): dry up session dialog key bindings

Ayman Bagabas created

Change summary

internal/ui/dialog/sessions.go | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

Detailed changes

internal/ui/dialog/sessions.go 🔗

@@ -27,6 +27,7 @@ type Session struct {
 		Select   key.Binding
 		Next     key.Binding
 		Previous key.Binding
+		UpDown   key.Binding
 		Close    key.Binding
 	}
 }
@@ -74,6 +75,10 @@ func NewSessions(com *common.Common, selectedSessionID string) (*Session, error)
 		key.WithKeys("up", "ctrl+p"),
 		key.WithHelp("↑", "previous item"),
 	)
+	s.keyMap.UpDown = key.NewBinding(
+		key.WithKeys("up", "down"),
+		key.WithHelp("↑↓", "choose"),
+	)
 	s.keyMap.Close = CloseKey
 
 	return s, nil
@@ -167,12 +172,8 @@ func (s *Session) View() string {
 
 // ShortHelp implements [help.KeyMap].
 func (s *Session) ShortHelp() []key.Binding {
-	updown := key.NewBinding(
-		key.WithKeys("down", "up"),
-		key.WithHelp("↑↓", "choose"),
-	)
 	return []key.Binding{
-		updown,
+		s.keyMap.UpDown,
 		s.keyMap.Select,
 		s.keyMap.Close,
 	}