@@ -1,11 +1,12 @@
1package dialog
1package dialog
4 "charm.land/bubbles/v2/help"
6 "charm.land/bubbles/v2/help"
5 "charm.land/bubbles/v2/key"
7 "charm.land/bubbles/v2/key"
6 "charm.land/bubbles/v2/textinput"
8 "charm.land/bubbles/v2/textinput"
7 tea "charm.land/bubbletea/v2"
9 tea "charm.land/bubbletea/v2"
8− "github.com/charmbracelet/crush/internal/session"
9 "github.com/charmbracelet/crush/internal/ui/common"
10 "github.com/charmbracelet/crush/internal/ui/common"
10 "github.com/charmbracelet/crush/internal/ui/list"
11 "github.com/charmbracelet/crush/internal/ui/list"
@@ -32,9 +33,14 @@ type Session struct {
32var _ Dialog = (*Session)(nil)
33var _ Dialog = (*Session)(nil)
34// NewSessions creates a new Session dialog.
35// NewSessions creates a new Session dialog.
35−func NewSessions(com *common.Common, sessions ...session.Session) *Session {
36+func NewSessions(com *common.Common) (*Session, error) {
36 s := new(Session)
37 s := new(Session)
37 s.com = com
38 s.com = com
39+ sessions, err := com.App.Sessions.List(context.TODO())
38 help := help.New()
44 help := help.New()
39 help.Styles = com.Styles.DialogHelpStyles()
45 help.Styles = com.Styles.DialogHelpStyles()
@@ -62,7 +68,8 @@ func NewSessions(com *common.Common, sessions ...session.Session) *Session {
62 key.WithHelp("↑", "previous item"),
68 key.WithHelp("↑", "previous item"),
64 s.keyMap.Close = CloseKey
70 s.keyMap.Close = CloseKey
65− return s
72+ return s, nil
68// SetSize sets the size of the dialog.
75// SetSize sets the size of the dialog.