@@ -1,11 +1,12 @@
11package dialog
22
33import (
4+ "context"
5+
46 "charm.land/bubbles/v2/help"
57 "charm.land/bubbles/v2/key"
68 "charm.land/bubbles/v2/textinput"
79 tea "charm.land/bubbletea/v2"
8− "github.com/charmbracelet/crush/internal/session"
910 "github.com/charmbracelet/crush/internal/ui/common"
1011 "github.com/charmbracelet/crush/internal/ui/list"
1112)
@@ -32,9 +33,14 @@ type Session struct {
3233var _ Dialog = (*Session)(nil)
3334
3435// NewSessions creates a new Session dialog.
35−func NewSessions(com *common.Common, sessions ...session.Session) *Session {
36+func NewSessions(com *common.Common) (*Session, error) {
3637 s := new(Session)
3738 s.com = com
39+ sessions, err := com.App.Sessions.List(context.TODO())
40+ if err != nil {
41+ return nil, err
42+ }
43+
3844 help := help.New()
3945 help.Styles = com.Styles.DialogHelpStyles()
4046
@@ -62,7 +68,8 @@ func NewSessions(com *common.Common, sessions ...session.Session) *Session {
6268 key.WithHelp("↑", "previous item"),
6369 )
6470 s.keyMap.Close = CloseKey
65− return s
71+
72+ return s, nil
6673}
6774
6875// SetSize sets the size of the dialog.