From c24085c585b1458834a32a371300a3b055977096 Mon Sep 17 00:00:00 2001 From: Adem Baccara <71262172+Adembc@users.noreply.github.com> Date: Tue, 26 Aug 2025 19:52:16 +0100 Subject: [PATCH] remove help model --- internal/adapters/ui/handlers.go | 49 ++++++++---------------------- internal/adapters/ui/hint_bar.go | 2 +- internal/adapters/ui/status_bar.go | 2 +- 3 files changed, 14 insertions(+), 39 deletions(-) diff --git a/internal/adapters/ui/handlers.go b/internal/adapters/ui/handlers.go index 143a508..0d7b8f7 100644 --- a/internal/adapters/ui/handlers.go +++ b/internal/adapters/ui/handlers.go @@ -72,9 +72,6 @@ func (t *tui) handleGlobalKeys(event *tcell.EventKey) *tcell.EventKey { case 't': t.handleTagsEdit() return nil - case '?': - t.handleHelpShow() - return nil } if event.Key() == tcell.KeyEnter { @@ -200,10 +197,6 @@ func (t *tui) handleFormCancel() { t.returnToMain() } -func (t *tui) handleHelpShow() { - t.showHelpModal() -} - func (t *tui) handlePingSelected() { if server, ok := t.serverList.GetSelectedServer(); ok { alias := server.Alias @@ -286,8 +279,18 @@ func (t *tui) showConnectModal(server domain.Server) { SetDoneFunc(func(buttonIndex int, buttonLabel string) { if buttonIndex == 0 { // Suspend the TUI while running the external ssh command. - t.app.Suspend(func() { - _ = t.serverService.SSH(server.Alias) + t.app.Suspend(func() { + err := t.serverService.SSH(server.Alias) + if err != nil { + // Show a brief status after we resume + t.app.QueueUpdateDraw(func() { + if strings.Contains(strings.ToLower(err.Error()), "timeout") { + t.showStatusTempColor("SSH timeout, returning to list", "#FF6B6B") + } else { + t.showStatusTempColor("SSH failed: "+err.Error(), "#FF6B6B") + } + }) + } }) // Refresh to reflect updated last seen and ssh count t.refreshServerList() @@ -350,34 +353,6 @@ func (t *tui) showEditTagsForm(server domain.Server) { t.app.SetFocus(form) } -func (t *tui) showHelpModal() { - text := "Keyboard shortcuts:\n\n" + - " ↑/↓ Navigate\n" + - " Enter SSH connect \n" + - " c Copy SSH command \n" + - " g Ping server (TCP to SSH port)\n" + - " r Refresh list (background)\n" + - " a Add server \n" + - " e Edit server \n" + - " t Edit tags (quick)\n" + - " d Delete entry \n" + - " p Pin/Unpin server \n" + - " s Switch sort field (Alias ↔ Last SSH), keep direction\n" + - " Shift+S Toggle sort direction (↑/↓) for current field\n" + - " / Focus search\n" + - " q Quit\n" + - " ? Help\n" - - modal := tview.NewModal(). - SetText(text). - AddButtons([]string{"Close"}). - SetDoneFunc(func(buttonIndex int, buttonLabel string) { - t.handleModalClose() - }) - - t.app.SetRoot(modal, true) -} - // ============================================================================= // UI State Management (hide UI elements) // ============================================================================= diff --git a/internal/adapters/ui/hint_bar.go b/internal/adapters/ui/hint_bar.go index e69c7dd..de94973 100644 --- a/internal/adapters/ui/hint_bar.go +++ b/internal/adapters/ui/hint_bar.go @@ -22,6 +22,6 @@ import ( func NewHintBar() *tview.TextView { hint := tview.NewTextView().SetDynamicColors(true) hint.SetBackgroundColor(tcell.Color233) - hint.SetText("[#BBBBBB]Press [::b]/[-:-:b] to search… • ↑↓ Navigate • Enter SSH • c Copy SSH • g Ping • r Refresh • a Add • e Edit • t Tags • d Delete • p Pin/Unpin • s Sort • ? Help[-]") + hint.SetText("[#BBBBBB]Press [::b]/[-:-:b] to search… • ↑↓ Navigate • Enter SSH • c Copy SSH • g Ping • r Refresh • a Add • e Edit • t Tags • d Delete • p Pin/Unpin • s Sort[-]") return hint } diff --git a/internal/adapters/ui/status_bar.go b/internal/adapters/ui/status_bar.go index e347bba..d8ca0aa 100644 --- a/internal/adapters/ui/status_bar.go +++ b/internal/adapters/ui/status_bar.go @@ -20,7 +20,7 @@ import ( ) func DefaultStatusText() string { - return "[white]↑↓[-] Navigate • [white]Enter[-] SSH • [white]c[-] Copy SSH • [white]a[-] Add • [white]e[-] Edit • [white]g[-] Ping • [white]d[-] Delete • [white]p[-] Pin/Unpin • [white]/[-] Search • [white]q[-] Quit • [white]?[-] Help" + return "[white]↑↓[-] Navigate • [white]Enter[-] SSH • [white]c[-] Copy SSH • [white]a[-] Add • [white]e[-] Edit • [white]g[-] Ping • [white]d[-] Delete • [white]p[-] Pin/Unpin • [white]/[-] Search • [white]q[-] Quit" } func NewStatusBar() *tview.TextView {