2a6b3830d5
- cmd/tui/main.go: entry point with --server, --token, --version flags
- cmd/tui/config.go: config from ~/.config/dumpster/config.yaml or env vars
- cmd/tui/auth.go: login flow, session cookie management
- cmd/tui/api.go: HTTP client for servers, channels, messages, voice
- cmd/tui/model.go: root bubbletea model with state management
- cmd/tui/theme.go: Gruvbox dark lipgloss styles
- cmd/tui/servers.go: server bar with [D] style initials
- cmd/tui/channels.go: channel list with #text and 🔊 voice
- cmd/tui/chat.go: IRC-style message viewport with colored usernames
- cmd/tui/input.go: message input with > _ prompt
- cmd/tui/members.go: member list with ●/◐/○ status
- cmd/tui/ws.go: WebSocket client for real-time events
- cmd/tui/voice.go: voice state tracking and mute toggle
- cmd/tui/keys.go: vim-style keybindings (j/k, g/G, Tab, /, etc)
- cmd/tui/views.go: multi-pane layout rendering
- Makefile: added build-tui and run-tui targets
- go.mod/go.sum: added charmbracelet dependencies
40 lines
1006 B
Go
40 lines
1006 B
Go
package main
|
|
|
|
import (
|
|
"github.com/charmbracelet/bubbles/textinput"
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
"github.com/charmbracelet/lipgloss"
|
|
)
|
|
|
|
// NewInput creates a configured text input for message composition.
|
|
func NewInput() textinput.Model {
|
|
ti := textinput.New()
|
|
ti.Placeholder = "Type a message..."
|
|
ti.Focus()
|
|
ti.CharLimit = 4000
|
|
ti.Width = 60
|
|
|
|
ti.PromptStyle = lipgloss.NewStyle().Foreground(aqua).Bold(true)
|
|
ti.TextStyle = lipgloss.NewStyle().Foreground(fg)
|
|
ti.Cursor.Style = lipgloss.NewStyle().Foreground(aqua)
|
|
ti.PlaceholderStyle = lipgloss.NewStyle().Foreground(fgF)
|
|
|
|
return ti
|
|
}
|
|
|
|
// InputUpdate handles key events for the input when focused.
|
|
func InputUpdate(input textinput.Model, msg tea.KeyMsg) (textinput.Model, tea.Cmd) {
|
|
switch msg.String() {
|
|
case "enter":
|
|
// Send message - handled by parent model
|
|
return input, nil
|
|
case "esc":
|
|
// Unfocus - handled by parent model
|
|
return input, nil
|
|
}
|
|
|
|
var cmd tea.Cmd
|
|
input, cmd = input.Update(msg)
|
|
return input, cmd
|
|
}
|