summaryrefslogtreecommitdiff
path: root/internal/client/ui/core/chat/chat.go
blob: b3597a8f68b779c4319a501560ea7fed26203edd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package chat

import (
	"log"

	"github.com/charmbracelet/bubbles/textarea"
	tea "github.com/charmbracelet/bubbletea"
	"github.com/charmbracelet/lipgloss"

	"github.com/kyren223/eko/internal/client/ui/colors"
	"github.com/kyren223/eko/internal/client/ui/viminput"
)

type Model struct {
	vi  viminput.Model
}

func New() Model {
	vi := viminput.New(30, 3)
	vi.Placeholder = "Send a message..."
	vi.PlaceholderStyle = lipgloss.NewStyle().Foreground(colors.Gray)
	vi.LineDecoration = func(lnum int, line string, cursorLnum int) string {
		return "┃ "
	}
	// vi.ShowLineNumbers = false

	// vi.CharLimit = 280

	// vi.Focus()

	log.Println("Placeholder:", vi.Placeholder)

	return Model{
		vi:  vi,
	}
}

func (m Model) Init() tea.Cmd {
	return tea.Batch(textarea.Blink, nil)
}

func (m Model) View() string {
	return m.vi.View()
}

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
	return m, nil
}