Make input dialog generic

This commit is contained in:
Rene Vergara 2024-02-27 11:17:36 -06:00
parent 67e303af38
commit 488a01c46d
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -20,6 +20,7 @@ import Brick.Forms
, handleFormEvent , handleFormEvent
, newForm , newForm
, renderForm , renderForm
, updateFormState
) )
import qualified Brick.Main as M import qualified Brick.Main as M
import qualified Brick.Types as BT import qualified Brick.Types as BT
@ -215,8 +216,18 @@ appEvent (BT.VtyEvent e) = do
V.EvKey (V.KChar '\t') [] -> focusRing %= F.focusNext V.EvKey (V.KChar '\t') [] -> focusRing %= F.focusNext
V.EvKey (V.KChar 'q') [] -> M.halt V.EvKey (V.KChar 'q') [] -> M.halt
V.EvKey (V.KChar '?') [] -> BT.modify $ set helpBox True V.EvKey (V.KChar '?') [] -> BT.modify $ set helpBox True
V.EvKey (V.KChar 'w') [] -> BT.modify $ set dialogBox WName V.EvKey (V.KChar 'w') [] -> do
V.EvKey (V.KChar 'a') [] -> BT.modify $ set dialogBox AName BT.modify $
set inputForm $
updateFormState (DialogInput "New Wallet") $
s ^. inputForm
BT.modify $ set dialogBox WName
V.EvKey (V.KChar 'a') [] -> do
BT.modify $
set inputForm $
updateFormState (DialogInput "New Account") $
s ^. inputForm
BT.modify $ set dialogBox AName
ev -> ev ->
case r of case r of
Just AList -> BT.zoom addresses $ L.handleListEvent ev Just AList -> BT.zoom addresses $ L.handleListEvent ev