Fix Poke timeout, input CommandLow handling, and add Poke Popup
All checks were successful
Build and Release / build-linux (push) Successful in 35s
Build and Release / build-windows (push) Successful in 2m35s
Build and Release / release (push) Has been skipped

This commit is contained in:
Jose Luis Montañes Ojados
2026-01-17 15:57:34 +01:00
parent 99f26c4485
commit 356b492629
5 changed files with 147 additions and 34 deletions

View File

@@ -104,6 +104,11 @@ type Model struct {
isMuted bool // Mic muted
isPTT bool // Push-to-talk active
// Popup State
showPokePopup bool
pokePopupSender string
pokePopupMessage string
// Program reference for sending messages from event handlers
program *tea.Program
showLog bool
@@ -398,12 +403,19 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil
case pokeMsg:
// Append to chat as well
m.chatMessages = append(m.chatMessages, ChatMessage{
Time: time.Now(),
Sender: "POKE",
Content: fmt.Sprintf("[%s]: %s", msg.senderName, msg.message),
})
m.addLog("Received poke from %s: %s", msg.senderName, msg.message)
// Trigger Popup
m.showPokePopup = true
m.pokePopupSender = msg.senderName
m.pokePopupMessage = msg.message
return m, nil
case chatMsg:
@@ -545,8 +557,18 @@ func (m *Model) updateChannelList(channels []*ts3client.Channel) {
}
func (m *Model) handleKeyPress(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
key := msg.String()
// Global Key Handling for Popup
if m.showPokePopup {
if key == "esc" || key == "enter" || key == "q" {
m.showPokePopup = false
}
return m, nil
}
// 1. Absolute Globals (Always active)
switch msg.String() {
switch key {
case "ctrl+c":
if m.client != nil {
m.client.Disconnect()
@@ -836,6 +858,32 @@ func (m *Model) handleInputKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
// View renders the UI
func (m *Model) View() string {
if m.showPokePopup {
boxStyle := lipgloss.NewStyle().
Border(lipgloss.DoubleBorder()).
BorderForeground(lipgloss.Color("196")). // Red for Poke
Padding(1, 2).
Width(50).
Align(lipgloss.Center)
titleStyle := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("226")).MarginBottom(1)
senderStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("208")).Bold(true)
msgStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("255")).Italic(true)
helpStyle := lipgloss.NewStyle().Faint(true).MarginTop(2)
content := lipgloss.JoinVertical(lipgloss.Center,
titleStyle.Render("YOU WERE POKED!"),
"",
fmt.Sprintf("From: %s", senderStyle.Render(m.pokePopupSender)),
"",
msgStyle.Render(fmt.Sprintf("%q", m.pokePopupMessage)),
"",
helpStyle.Render("(Press Esc/Enter to close)"),
)
return lipgloss.Place(m.width, m.height, lipgloss.Center, lipgloss.Center, boxStyle.Render(content))
}
if m.focus == FocusAbout {
return m.renderAboutView()
}