From 488a01c46d6cfa9fcd7e81208fe8f22d86dccba4 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 27 Feb 2024 11:17:36 -0600 Subject: [PATCH] Make input dialog generic --- src/Zenith/CLI.hs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Zenith/CLI.hs b/src/Zenith/CLI.hs index 16ac439..ebd3c93 100644 --- a/src/Zenith/CLI.hs +++ b/src/Zenith/CLI.hs @@ -20,6 +20,7 @@ import Brick.Forms , handleFormEvent , newForm , renderForm + , updateFormState ) import qualified Brick.Main as M 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 'q') [] -> M.halt V.EvKey (V.KChar '?') [] -> BT.modify $ set helpBox True - V.EvKey (V.KChar 'w') [] -> BT.modify $ set dialogBox WName - V.EvKey (V.KChar 'a') [] -> BT.modify $ set dialogBox AName + V.EvKey (V.KChar 'w') [] -> do + 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 -> case r of Just AList -> BT.zoom addresses $ L.handleListEvent ev