rvv001 - TUI - Viewing Keys Display

Submenu created
This commit is contained in:
Rene V. Vergara 2024-12-22 21:33:25 -05:00
parent 62b6ee3f32
commit cb927a0ab3

View file

@ -197,6 +197,8 @@ data DialogType
| DeshieldForm
| ShieldForm
| ShowFIATBalance
| ViewingKeyMenu
| ViewingKeyShow
data DisplayType
= AddrDisplay
@ -250,6 +252,8 @@ data State = State
, _sBalance :: !Integer
, _currencyCode :: !T.Text
, _zprice :: !Double
, _vkName :: !T.Text
, _vkData :: !T.Text
}
makeLenses ''State
@ -314,6 +318,7 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
[ capCommand2 "Address " "B" "ook"
, capCommand2 "s" "H" "ield"
, capCommand "D" "e-shield"
, capCommand2 "Viewing " "K" "eys"
, capCommand "Q" "uit"
, capCommand "?" " Help"
, str $ show (st ^. timer)
@ -384,7 +389,7 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
else emptyWidget
where
keyList =
map (C.hCenter . str) ["?", "Esc", "w", "a", "v", "s", "b", "d", "l", "q"]
map (C.hCenter . str) ["?", "Esc", "w", "a", "v", "s", "b", "d", "k", "l", "q"]
actionList =
map
(hLimit 40 . str)
@ -396,6 +401,7 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
, "Send Tx"
, "Address Book"
, "Shield/De-Shield"
, "Viewing Keys"
, "Balance in Fiat"
, "Quit"
]
@ -474,6 +480,19 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
else displayTaz (st ^. tBalance) ++ "?") <=>
C.hCenter
(hBox [capCommand "P" "roceed", capCommand "<esc> " "Cancel"]))
ViewingKeyShow ->
D.renderDialog
(D.dialog (Just ( str ( " " ++ ( T.unpack ( st ^. vkName ) ) ++ " Viewing Key ") ) ) Nothing 50)
-- (D.dialog (Just (str " Viewin Key ")) Nothing 50)
(C.hCenter
(hBox [capCommand "C" "opy to Clipoard", capCommand3 "" "E" "xit"]))
ViewingKeyMenu ->
D.renderDialog
(D.dialog (Just (str " Viewing Keys ")) Nothing 50)
(C.hCenter
(hBox [capCommand "F" "ull", capCommand "I" "ncoming", capCommand "O" "utgoing", capCommand3 "" "E" "xit"])
)
Blank -> emptyWidget
-- Address Book List
AdrBook ->
@ -555,7 +574,7 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
(capCommand "R" "efresh" <+> capCommand3 "E" "x" "it")
]
])
--
--
splashDialog :: State -> Widget Name
splashDialog st =
if st ^. splashBox
@ -1035,6 +1054,8 @@ appEvent (BT.AppEvent t) = do
AdrBookDelForm -> return ()
DeshieldForm -> return ()
ShieldForm -> return ()
ViewingKeyShow -> return ()
ViewingKeyMenu -> return ()
ShowFIATBalance -> return()
Blank -> do
if s ^. timer == 90
@ -1631,6 +1652,25 @@ appEvent (BT.VtyEvent e) = do
-- Process any other event
ev -> BT.zoom abAddresses $ L.handleListEvent ev
--
--
ViewingKeyShow -> do
case e of
V.EvKey (V.KChar 'e') [] -> do
BT.modify $ set vkName ""
BT.modify $ set vkData ""
BT.modify $ set dialogBox ViewingKeyMenu
ev -> return ()
--
ViewingKeyMenu -> do
case e of
V.EvKey (V.KChar 'f') [] -> do
BT.modify $ set vkName "Full"
BT.modify $ set vkData "VKFull->ztestsapling1tgjr4zppwk4ne8xy6gdq4z2gwq7dmf5jq8z2ctpn8nlmtse0a74fa5z0m8z383gmpgqz6q6duu4"
BT.modify $ set dialogBox ViewingKeyShow
V.EvKey (V.KChar 'i') [] -> BT.modify $ set dialogBox Blank
V.EvKey (V.KChar 'o') [] -> BT.modify $ set dialogBox Blank
V.EvKey (V.KChar 'e') [] -> BT.modify $ set dialogBox Blank
ev -> return ()
-- Process any other event
Blank -> do
case e of
@ -1724,6 +1764,9 @@ appEvent (BT.VtyEvent e) = do
msg
"Not enough transparent funds in this account"
BT.modify $ set displayBox MsgDisplay
-- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
V.EvKey (V.KChar 'k') [] -> do
BT.modify $ set dialogBox ViewingKeyMenu
ev ->
case r of
@ -1879,6 +1922,8 @@ runZenithTUI config = do
sBal
currencyCode
0
""
""
Left _e -> do
print $
"No Zebra node available on port " <>