| 277 | type localeChangedMsg struct{} |
| 278 | |
| 279 | func (a *App) refreshTabs() { |
| 280 | names := TabNames() |
| 281 | if a.logsEnabled { |
| 282 | a.tabs = names |
| 283 | } else { |
| 284 | filtered := make([]string, 0, len(names)-1) |
| 285 | for idx, name := range names { |
| 286 | if idx == tabLogs { |
| 287 | continue |
| 288 | } |
| 289 | filtered = append(filtered, name) |
| 290 | } |
| 291 | a.tabs = filtered |
| 292 | } |
| 293 | |
| 294 | if len(a.tabs) == 0 { |
| 295 | a.activeTab = tabDashboard |
| 296 | return |
| 297 | } |
| 298 | if a.activeTab >= len(a.tabs) { |
| 299 | a.activeTab = len(a.tabs) - 1 |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | func (a *App) initTabIfNeeded(_ int) tea.Cmd { |
| 304 | if a.initialized[a.activeTab] { |