diff --git a/.logs/2021-05-26T16:34:12Z.log b/.logs/2021-05-26T16:34:12Z.log new file mode 100644 index 0000000..e69de29 diff --git a/.logs/2021-05-26T16:35:20Z.log b/.logs/2021-05-26T16:35:20Z.log new file mode 100644 index 0000000..e69de29 diff --git a/.logs/2021-05-26T16:35:32Z.log b/.logs/2021-05-26T16:35:32Z.log new file mode 100644 index 0000000..e69de29 diff --git a/.logs/2021-05-26T16:45:29Z.log b/.logs/2021-05-26T16:45:29Z.log new file mode 100644 index 0000000..e69de29 diff --git a/.logs/2021-05-26T16:45:42Z.log b/.logs/2021-05-26T16:45:42Z.log new file mode 100644 index 0000000..e69de29 diff --git a/tui.go b/tui.go index 3b237e8..54a2915 100644 --- a/tui.go +++ b/tui.go @@ -129,9 +129,12 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { case projVars.DiscoveredDevice: - for _, v := range m.choices { + for k, v := range m.choices { if strings.HasPrefix(v, fmt.Sprintf("address: %s", msg.ScanResult.Address.String())) { - // TODO update RSSI + m.choices[k] = fmt.Sprintf("address: %s rssi: %d", + msg.ScanResult.Address.String(), + msg.ScanResult.RSSI) + return m, listenForScanResults } } @@ -146,7 +149,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { fmt.Sprintf("address: %s rssi: %d", msg.ScanResult.Address.String(), msg.ScanResult.RSSI)) */ m.choices = append(m.choices, - fmt.Sprintf("address: %s rssi: %d", msg.ScanResult.Address.String(), msg.ScanResult.RSSI)) + fmt.Sprintf("address: %s rssi: %d", + msg.ScanResult.Address.String(), + msg.ScanResult.RSSI)) return m, listenForScanResults @@ -199,13 +204,13 @@ func (m model) View() string { s := m.spinner.View( ) + lipgloss.NewStyle( ).Bold(true, - ).Foreground(lipgloss.Color("#FAFAFA"), - ).Background(lipgloss.Color("#7D56F4"), - ).PaddingTop(0, - ).PaddingLeft(0, - ).Width(80, - ).Render("Scanning for devices", - ) + "\n\n" + ).Foreground(lipgloss.Color("#FAFAFA"), + ).Background(lipgloss.Color("#7D56F4"), + ).PaddingTop(0, + ).PaddingLeft(0, + ).Width(80, + ).Render("Scanning for devices", + ) + "\n\n" // Iterate over our choices for i, choice := range m.choices { @@ -213,13 +218,19 @@ func (m model) View() string { // Is the cursor pointing at this choice? cursor := " " // no cursor if m.cursor == i { - cursor = ">" // cursor! + //cursor = ">" // cursor! + cursor = lipgloss.NewStyle( + ).Blink(true, + ).Render(">") } // Is this choice selected? checked := " " // not selected if _, ok := m.selected[i]; ok { - checked = "x" // selected! + //checked = "x" // selected! + checked = lipgloss.NewStyle( + ).Bold(true, + ).Render("x") } // Render the row