Reduce status refresh interval to 3 seconds and add last updated indicator
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user