@@ -14,13 +14,16 @@ import (
1414 uv "github.com/charmbracelet/ultraviolet"
1515)
1616
17+// uiState represents the current focus state of the UI.
1718type uiState uint8
1819
20+// Possible uiState values.
1921const (
2022 uiChat uiState = iota
2123 uiEdit
2224)
2325
26+// UI represents the main user interface model.
2427type UI struct {
2528 app *app.App
2629 com *common.Common
@@ -37,6 +40,7 @@ type UI struct {
3740 layout layout
3841}
3942
43+// New creates a new instance of the [UI] model.
4044func New(com *common.Common, app *app.App) *UI {
4145 return &UI{
4246 app: app,
@@ -48,10 +52,12 @@ func New(com *common.Common, app *app.App) *UI {
4852 }
4953}
5054
55+// Init initializes the UI model.
5156func (m *UI) Init() tea.Cmd {
5257 return nil
5358}
5459
60+// Update handles updates to the UI model.
5561func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
5662 var cmds []tea.Cmd
5763 switch msg := msg.(type) {
@@ -89,6 +95,7 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
8995 return m, tea.Batch(cmds...)
9096}
9197
98+// View renders the UI model's view.
9299func (m *UI) View() tea.View {
93100 var v tea.View
94101 v.AltScreen = true