Add loading spinners for async operations

This commit is contained in:
Calmcacil
2026-01-12 23:18:57 +01:00
parent 1c03a706d1
commit 3631339f8b
6 changed files with 35 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"strings"
"github.com/calmcacil/wg-admin/internal/tui/components"
"github.com/calmcacil/wg-admin/internal/wireguard"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
@@ -63,13 +64,16 @@ func (s *QRScreen) Update(msg tea.Msg) (Screen, tea.Cmd) {
// View renders the QR screen
func (s *QRScreen) View() string {
// Breadcrumb: Clients > Client > QR Code
breadcrumb := components.RenderBreadcrumb([]components.BreadcrumbItem{{Label: "Clients", ID: "list"}, {Label: s.clientName, ID: "detail"}, {Label: "QR Code", ID: "qr"}})
if s.errorMsg != "" {
return s.renderError()
}
if s.qrCode == "" {
return "Loading QR code..."
}
return s.renderQR()
return breadcrumb + "\n" + s.renderQR()
}
// loadConfig loads the client configuration