From b05e4fcbcb59bdf20ca7b3e27f8ed15fea594cad Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Mon, 25 Nov 2024 23:49:40 +0200 Subject: Added typing and input validation to network creation popup --- internal/client/ui/core/core.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'internal/client/ui/core/core.go') diff --git a/internal/client/ui/core/core.go b/internal/client/ui/core/core.go index 070ab16..fba3ddb 100644 --- a/internal/client/ui/core/core.go +++ b/internal/client/ui/core/core.go @@ -137,7 +137,17 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.networkCreationPopup = &popup } - default: + case tea.KeyEscape: + if m.networkCreationPopup != nil { + m.networkCreationPopup = nil + } + + case tea.KeyEnter: + if m.networkCreationPopup != nil { + return m, m.networkCreationPopup.Select() + } + + default: if m.networkCreationPopup != nil { popup, cmd := m.networkCreationPopup.Update(msg) m.networkCreationPopup = &popup -- cgit v1.3.1