|
|
@@ -4,6 +4,7 @@ package tui
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
+ "slices"
|
|
|
"time"
|
|
|
|
|
|
"github.com/NimbleMarkets/ntcharts/linechart/streamlinechart"
|
|
|
@@ -48,10 +49,6 @@ func (m Model) Tick() tea.Cmd {
|
|
|
}
|
|
|
|
|
|
func (m Model) content() string {
|
|
|
- var headerStyle = lipgloss.NewStyle().
|
|
|
- Bold(true).
|
|
|
- Italic(true)
|
|
|
-
|
|
|
var blockStyle = lipgloss.NewStyle().
|
|
|
Width(m.width).
|
|
|
Align(lipgloss.Center)
|
|
|
@@ -61,7 +58,18 @@ func (m Model) content() string {
|
|
|
if len(address.results) == 0 {
|
|
|
output = output + fmt.Sprintf("\n%s\tloading...", headerStyle.Render(address.Address))
|
|
|
} else if m.viewport.Width != 0 && m.viewport.Height != 0 {
|
|
|
- output = output + fmt.Sprintf("\n%s", blockStyle.Render(headerStyle.Render(address.Address)))
|
|
|
+ if slices.Contains(address.results, -1) {
|
|
|
+ output = output + fmt.Sprintf("\n%s",
|
|
|
+ blockStyle.Render(headerStyle.Render(
|
|
|
+ fmt.Sprintf("%s\t%s",
|
|
|
+ secondaryColor.Render(address.Address),
|
|
|
+ infoStyle.Render("(connection unstable)"),
|
|
|
+ ),
|
|
|
+ )))
|
|
|
+ } else {
|
|
|
+ output = output + fmt.Sprintf("\n%s",
|
|
|
+ blockStyle.Render(headerStyle.Render(address.Address)))
|
|
|
+ }
|
|
|
|
|
|
// Linechart // TODO(complexity): too many if branches
|
|
|
var slc streamlinechart.Model
|
|
|
@@ -85,6 +93,7 @@ func (m Model) content() string {
|
|
|
|
|
|
return output
|
|
|
}
|
|
|
+
|
|
|
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
|
var cmd tea.Cmd
|
|
|
var cmds []tea.Cmd
|