Phase 5: TUI client (Bubbletea)
- 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
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package main
|
||||
|
||||
// Voice state tracking for the TUI client.
|
||||
|
||||
// VoiceState holds the current voice connection state.
|
||||
type VoiceState struct {
|
||||
Connected bool
|
||||
RoomName string
|
||||
LiveKitURL string
|
||||
Token string
|
||||
Muted bool
|
||||
Deafened bool
|
||||
Participants []VoiceParticipant
|
||||
}
|
||||
|
||||
// VoiceParticipant is someone in the current voice channel.
|
||||
type VoiceParticipant struct {
|
||||
UserID string
|
||||
Username string
|
||||
State string // connected, disconnected
|
||||
}
|
||||
|
||||
// VoiceStatusText returns a human-readable status for the status bar.
|
||||
func (vs *VoiceState) StatusText() string {
|
||||
if !vs.Connected {
|
||||
return ""
|
||||
}
|
||||
muteIcon := "🔊"
|
||||
if vs.Muted {
|
||||
muteIcon = "🔇"
|
||||
}
|
||||
return muteIcon + " " + vs.RoomName
|
||||
}
|
||||
|
||||
// ToggleMute flips the muted state.
|
||||
func (vs *VoiceState) ToggleMute() {
|
||||
vs.Muted = !vs.Muted
|
||||
}
|
||||
|
||||
// ToggleDeafen flips the deafened state.
|
||||
func (vs *VoiceState) ToggleDeafen() {
|
||||
vs.Deafened = !vs.Deafened
|
||||
if vs.Deafened {
|
||||
vs.Muted = true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user