summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-01-12 17:15:00 +0200
committerKyren223 <Kyren223@proton.me>2025-01-12 17:15:00 +0200
commit1c09d173d733b491970841add0a20bf2ecf078cd (patch)
treeb504c05ee3b07cc9d3b2942b043293f0b2fcc5f1 /internal
parentf0365e5438a0958a2c5c3f889abb83f96f9d6efa (diff)
Fixed bug where it wasn't possible to type n/i in popups
Diffstat (limited to 'internal')
-rw-r--r--internal/client/ui/core/core.go48
1 files changed, 37 insertions, 11 deletions
diff --git a/internal/client/ui/core/core.go b/internal/client/ui/core/core.go
index da91352..4dc50e2 100644
--- a/internal/client/ui/core/core.go
+++ b/internal/client/ui/core/core.go
@@ -208,6 +208,11 @@ func (m *Model) updateConnected(msg tea.Msg) tea.Cmd {
if m.networkCreationPopup == nil && m.networkJoinPopup == nil {
popup := networkcreation.New()
m.networkCreationPopup = &popup
+ } else {
+ cmd := m.updatePopups(msg)
+ if cmd != nil {
+ return cmd
+ }
}
case FocusFrequencyList:
if m.frequencyCreationPopup == nil {
@@ -217,6 +222,17 @@ func (m *Model) updateConnected(msg tea.Msg) tea.Cmd {
popup := frequencycreation.New(*networkId)
m.frequencyCreationPopup = &popup
}
+ } else {
+ cmd := m.updatePopups(msg)
+ if cmd != nil {
+ return cmd
+ }
+ }
+
+ default:
+ cmd := m.updatePopups(msg)
+ if cmd != nil {
+ return cmd
}
}
@@ -224,6 +240,8 @@ func (m *Model) updateConnected(msg tea.Msg) tea.Cmd {
if m.focus == FocusNetworkList && m.networkJoinPopup == nil && m.networkCreationPopup == nil {
popup := networkjoin.New()
m.networkJoinPopup = &popup
+ } else {
+ m.updatePopups(msg)
}
case "esc":
@@ -257,17 +275,8 @@ func (m *Model) updateConnected(msg tea.Msg) tea.Cmd {
}
default:
- if m.networkCreationPopup != nil {
- popup, cmd := m.networkCreationPopup.Update(msg)
- m.networkCreationPopup = &popup
- return cmd
- } else if m.frequencyCreationPopup != nil {
- popup, cmd := m.frequencyCreationPopup.Update(msg)
- m.frequencyCreationPopup = &popup
- return cmd
- } else if m.networkJoinPopup != nil {
- popup, cmd := m.networkJoinPopup.Update(msg)
- m.networkJoinPopup = &popup
+ cmd := m.updatePopups(msg)
+ if cmd != nil {
return cmd
}
@@ -340,3 +349,20 @@ func (m *Model) move(direction int) {
assert.Never("missing switch statement field in move", "focus", m.focus)
}
}
+
+func (m *Model) updatePopups(msg tea.Msg) tea.Cmd {
+ if m.networkCreationPopup != nil {
+ popup, cmd := m.networkCreationPopup.Update(msg)
+ m.networkCreationPopup = &popup
+ return cmd
+ } else if m.frequencyCreationPopup != nil {
+ popup, cmd := m.frequencyCreationPopup.Update(msg)
+ m.frequencyCreationPopup = &popup
+ return cmd
+ } else if m.networkJoinPopup != nil {
+ popup, cmd := m.networkJoinPopup.Update(msg)
+ m.networkJoinPopup = &popup
+ return cmd
+ }
+ return nil
+}