diff --git a/cmd/tui/model.go b/cmd/tui/model.go index cda1f87..f079887 100644 --- a/cmd/tui/model.go +++ b/cmd/tui/model.go @@ -22,6 +22,7 @@ const ( FocusChat FocusInput FocusUserView + FocusAbout ) // ListItem represents an item in the navigation tree (Channel or User) @@ -79,6 +80,7 @@ type Model struct { // UI State focus Focus + lastFocus Focus // To return from About view width, height int channels []ChannelNode items []ListItem // Flattened list for navigation @@ -560,7 +562,16 @@ func (m *Model) handleKeyPress(msg tea.KeyMsg) (tea.Model, tea.Cmd) { case "tab": // Cycle focus - m.focus = (m.focus + 1) % 3 + m.focus = (m.focus + 1) % 4 // FocusChannels, FocusChat, FocusInput, FocusUserView + return m, nil + + case "f1": + if m.focus == FocusAbout { + m.focus = m.lastFocus + } else { + m.lastFocus = m.focus + m.focus = FocusAbout + } return m, nil } @@ -570,8 +581,8 @@ func (m *Model) handleKeyPress(msg tea.KeyMsg) (tea.Model, tea.Cmd) { return m.handleInputKeys(msg) } - // 3. Global Shortcuts (Only when NOT in Input) - if m.focus != FocusInput && m.focus != FocusUserView { + // 3. Global Shortcuts (Only when NOT in Input or About) + if m.focus != FocusInput && m.focus != FocusUserView && m.focus != FocusAbout { switch msg.String() { case "q": // Quit (same as ctrl+c) @@ -649,6 +660,8 @@ func (m *Model) handleKeyPress(msg tea.KeyMsg) (tea.Model, tea.Cmd) { return m.handleChatKeys(msg) case FocusUserView: return m.handleUserViewKeys(msg) + case FocusAbout: + return m.handleAboutViewKeys(msg) } return m, nil } @@ -657,6 +670,13 @@ func (m *Model) handleChatKeys(_ tea.KeyMsg) (tea.Model, tea.Cmd) { return m, nil } +func (m *Model) handleAboutViewKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) { + if msg.String() == "esc" || msg.String() == "f1" { + m.focus = m.lastFocus + } + return m, nil +} + func (m *Model) handleUserViewKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) { if m.viewUser == nil || m.audioPlayer == nil { if msg.String() == "esc" || msg.String() == "q" { @@ -816,6 +836,10 @@ func (m *Model) handleInputKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) { // View renders the UI func (m *Model) View() string { + if m.focus == FocusAbout { + return m.renderAboutView() + } + if m.width == 0 { return "Loading..." } @@ -1203,3 +1227,35 @@ func (m *Model) renderUserView() string { return lipgloss.JoinVertical(lipgloss.Left, info...) } + +func (m *Model) renderAboutView() string { + titleStyle := lipgloss.NewStyle(). + Bold(true). + Foreground(lipgloss.Color("205")). + MarginBottom(1). + Align(lipgloss.Center) + + boxStyle := lipgloss.NewStyle(). + Border(lipgloss.RoundedBorder()). + BorderForeground(lipgloss.Color("62")). + Padding(2). + Width(60). + Align(lipgloss.Center) + + mainContent := lipgloss.JoinVertical(lipgloss.Center, + titleStyle.Render("TS3 TUI CLIENT"), + lipgloss.NewStyle().Foreground(lipgloss.Color("250")).Render("Una terminal potente para tus comunidades."), + "", + lipgloss.NewStyle().Bold(true).Render("Hecho en Antigravity"), + "", + lipgloss.NewStyle().Bold(true).Render("Con la ayuda de:"), + lipgloss.NewStyle().Foreground(lipgloss.Color("212")).Render("- Gemini 3 Pro"), + lipgloss.NewStyle().Foreground(lipgloss.Color("212")).Render("- Claude Opus 4.5"), + "", + "", + lipgloss.NewStyle().Faint(true).Render("(Presiona ESC o F1 para volver)"), + ) + + // Center everything on screen + return lipgloss.Place(m.width, m.height, lipgloss.Center, lipgloss.Center, boxStyle.Render(mainContent)) +}