Reduce status refresh interval to 3 seconds and add last updated indicator

This commit is contained in:
Calmcacil
2026-01-12 23:04:48 +01:00
parent 5136484cd2
commit 68939cdc08
6 changed files with 56 additions and 41 deletions

View File

@@ -137,9 +137,13 @@ func (s *ListScreen) Update(msg tea.Msg) (Screen, tea.Cmd) {
// View renders the list screen
func (s *ListScreen) View() string {
// Breadcrumb: Home
breadcrumb := components.RenderBreadcrumb([]components.BreadcrumbItem{
{Label: "Clients", ID: "list"},
})
if len(s.clients) == 0 {
// Empty state with helpful guidance
return s.search.View() + "\n\n" +
return breadcrumb + "\n" + s.search.View() + "\n\n" +
lipgloss.NewStyle().
Foreground(lipgloss.Color("226")).
Bold(true).
@@ -164,7 +168,7 @@ func (s *ListScreen) View() string {
// Check if there are no matches
if s.search.IsActive() && len(s.filtered) == 0 && s.search.GetQuery() != "" {
// Empty search results with helpful tips
return s.search.View() + "\n\n" +
return breadcrumb + "\n" + s.search.View() + "\n\n" +
lipgloss.NewStyle().
Foreground(lipgloss.Color("226")).
Bold(true).
@@ -200,7 +204,7 @@ func (s *ListScreen) View() string {
Foreground(lipgloss.Color("241")).
Render("Last updated: " + timeAgo)
return s.search.View() + "\n" + s.table.View() + "\n" + lastUpdatedText
return breadcrumb + "\n" + s.search.View() + "\n" + s.table.View() + "\n" + lastUpdatedText
}
// formatDuration returns a human-readable string for the duration
@@ -218,7 +222,7 @@ func formatDuration(d time.Duration) string {
func (s *ListScreen) loadClients() tea.Msg {
clients, err := wireguard.ListClients()
if err != nil {
return errMsg{err: err}
return ErrMsg{Err: err}
}
// Get status for each client