2024-05-30 00:44:40 -06:00
|
|
|
package shared
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.mlow.ca/mlow/lmcli/pkg/lmcli"
|
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Values struct {
|
|
|
|
ConvShortname string
|
|
|
|
}
|
|
|
|
|
2024-06-08 16:01:16 -06:00
|
|
|
type Shared struct {
|
2024-05-30 00:44:40 -06:00
|
|
|
Ctx *lmcli.Context
|
|
|
|
Values *Values
|
|
|
|
Width int
|
|
|
|
Height int
|
|
|
|
Err error
|
|
|
|
}
|
|
|
|
|
2024-05-30 01:04:55 -06:00
|
|
|
// a convenience struct for holding rendered content for indiviudal UI
|
|
|
|
// elements
|
|
|
|
type Sections struct {
|
2024-05-30 00:44:40 -06:00
|
|
|
Header string
|
|
|
|
Content string
|
|
|
|
Error string
|
|
|
|
Input string
|
|
|
|
Footer string
|
|
|
|
}
|
|
|
|
|
|
|
|
type (
|
|
|
|
// send to change the current state
|
|
|
|
MsgViewChange View
|
|
|
|
// sent to a state when it is entered
|
|
|
|
MsgViewEnter struct{}
|
|
|
|
// sent when an error occurs
|
|
|
|
MsgError error
|
|
|
|
)
|
|
|
|
|
|
|
|
func WrapError(err error) tea.Cmd {
|
|
|
|
return func() tea.Msg {
|
|
|
|
return MsgError(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type View int
|
|
|
|
|
|
|
|
const (
|
|
|
|
StateChat View = iota
|
|
|
|
StateConversations
|
|
|
|
//StateSettings
|
|
|
|
//StateHelp
|
|
|
|
)
|