summaryrefslogtreecommitdiff
path: root/internal/client/ui/core/core.go
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2024-11-30 16:55:11 +0200
committerKyren223 <Kyren223@proton.me>2024-11-30 16:55:11 +0200
commit9bbf36550b4871299bad0ff0a7d42617914b543a (patch)
tree76ea564866d870dbf375a3eb5216ee25584704e9 /internal/client/ui/core/core.go
parentc54d791d139d02f8145bcb5b79ad8fd5809f189b (diff)
Added frequencies UI
Diffstat (limited to 'internal/client/ui/core/core.go')
-rw-r--r--internal/client/ui/core/core.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/internal/client/ui/core/core.go b/internal/client/ui/core/core.go
index 6949aee..6ba25c1 100644
--- a/internal/client/ui/core/core.go
+++ b/internal/client/ui/core/core.go
@@ -13,6 +13,7 @@ import (
"github.com/charmbracelet/lipgloss"
"github.com/kyren223/eko/internal/client/gateway"
"github.com/kyren223/eko/internal/client/ui"
+ "github.com/kyren223/eko/internal/client/ui/core/network"
"github.com/kyren223/eko/internal/client/ui/core/networkcreation"
"github.com/kyren223/eko/internal/client/ui/core/networklist"
"github.com/kyren223/eko/internal/client/ui/core/state"
@@ -32,9 +33,7 @@ var (
const (
FocusNetworkList = iota
- FocusFrequencies
- FocusChat
- FocusUsers
+ FocusNetwork
FocusMax
)
@@ -50,6 +49,7 @@ type Model struct {
networkCreationPopup *networkcreation.Model
networkList networklist.Model
+ network network.Model
focus int
}
@@ -78,7 +78,9 @@ func (m Model) View() string {
return m.loading.View()
}
- result := m.networkList.View()
+ networkList := m.networkList.View()
+ network := m.network.View()
+ result := lipgloss.JoinHorizontal(lipgloss.Top, networkList, network)
result = lipgloss.Place(
ui.Width, ui.Height,
@@ -201,6 +203,13 @@ func (m *Model) updateConnected(msg tea.Msg) tea.Cmd {
m.networkCreationPopup = &popup
return cmd
}
+
+ if msg.String() == "L" && m.focus == FocusNetworkList {
+ m.move(1)
+ } else if msg.String() == "H" && m.focus == FocusNetwork {
+ m.move(-1)
+ }
+
}
}
@@ -208,6 +217,9 @@ func (m *Model) updateConnected(msg tea.Msg) tea.Cmd {
switch m.focus {
case FocusNetworkList:
m.networkList, cmd = m.networkList.Update(msg)
+ m.network.Set(m.networkList.Index())
+ case FocusNetwork:
+ m.network, cmd = m.network.Update(msg)
}
return cmd
@@ -227,9 +239,12 @@ func (m *Model) move(direction int) {
m.focus = max(0, min(FocusMax-1, focus))
m.networkList.Blur()
+ m.network.Blur()
switch m.focus {
case FocusNetworkList:
m.networkList.Focus()
+ case FocusNetwork:
+ m.network.Focus()
default:
assert.Never("missing switch statement field in move", "focus", m.focus)
}