rvv001 - Show Balance in FIAT - GUI version

First commit
This commit is contained in:
Rene V. Vergara A. 2024-12-15 19:41:06 -05:00
parent a290f9c912
commit 843821232d
2 changed files with 18 additions and 1 deletions

View file

@ -556,7 +556,6 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
(capCommand "R" "efresh" <+> capCommand3 "E" "x" "it") (capCommand "R" "efresh" <+> capCommand3 "E" "x" "it")
] ]
]) ])
-- --
splashDialog :: State -> Widget Name splashDialog :: State -> Widget Name
splashDialog st = splashDialog st =

View file

@ -147,6 +147,8 @@ data AppEvent
| SendShield | SendShield
| StartSync | StartSync
| TreeSync | TreeSync
| ShowFIATBalance
| CloseFIATBalance
deriving (Eq, Show) deriving (Eq, Show)
data AppModel = AppModel data AppModel = AppModel
@ -206,6 +208,7 @@ data AppModel = AppModel
, _tBalanceValid :: !Bool , _tBalanceValid :: !Bool
, _sBalance :: !Integer , _sBalance :: !Integer
, _sBalanceValid :: !Bool , _sBalanceValid :: !Bool
, _showFIATBalance :: !Bool
} deriving (Eq, Show) } deriving (Eq, Show)
makeLenses ''AppModel makeLenses ''AppModel
@ -249,6 +252,7 @@ buildUI wenv model = widgetTree
, modalOverlay `nodeVisible` isJust (model ^. modalMsg) , modalOverlay `nodeVisible` isJust (model ^. modalMsg)
, adrbookOverlay `nodeVisible` model ^. showAdrBook , adrbookOverlay `nodeVisible` model ^. showAdrBook
, newAdrBkOverlay `nodeVisible` model ^. newAdrBkEntry , newAdrBkOverlay `nodeVisible` model ^. newAdrBkEntry
, sfBalOverlay `nodeVisible` model ^. showFIATBalance
, showABAddressOverlay (model ^. abdescrip) (model ^. abaddress) `nodeVisible` , showABAddressOverlay (model ^. abdescrip) (model ^. abaddress) `nodeVisible`
model ^. model ^.
showABAddress showABAddress
@ -326,6 +330,8 @@ buildUI wenv model = widgetTree
[bgColor white, borderB 1 gray, padding 3] [bgColor white, borderB 1 gray, padding 3]
, box_ [alignLeft, onClick ShowDeShield] (label "De-Shield ZEC") `styleBasic` , box_ [alignLeft, onClick ShowDeShield] (label "De-Shield ZEC") `styleBasic`
[bgColor white, borderB 1 gray, padding 3] [bgColor white, borderB 1 gray, padding 3]
, box_ [alignLeft, onClick ShowFIATBalance] (label "Balance in (") `styleBasic`
[bgColor white, borderB 1 gray, padding 3]
]) `styleBasic` ]) `styleBasic`
[bgColor btnColor, padding 3] [bgColor btnColor, padding 3]
newBox = newBox =
@ -991,6 +997,13 @@ buildUI wenv model = widgetTree
, label_ (txtWrapN (fromMaybe "" (model ^. msgAB)) 64) [multiline] , label_ (txtWrapN (fromMaybe "" (model ^. msgAB)) 64) [multiline]
, filler , filler
] ]
sfBalOverlay =
alert CloseFIATBalance $
hstack
[ filler
, label "Account Balance in FIAT" `styleBasic` [textFont "Bold"]
, filler
]
shieldOverlay = shieldOverlay =
box box
(vstack (vstack
@ -1505,6 +1518,10 @@ handleEvent wenv node model evt =
model & msgAB ?~ "Function not implemented..." & menuPopup .~ False model & msgAB ?~ "Function not implemented..." & menuPopup .~ False
] ]
CloseMsgAB -> [Model $ model & msgAB .~ Nothing & inError .~ False] CloseMsgAB -> [Model $ model & msgAB .~ Nothing & inError .~ False]
--
ShowFIATBalance -> [Model $ model & showFIATBalance .~ True & menuPopup .~ False]
CloseFIATBalance -> [Model $ model & showFIATBalance .~ False]
--
ShowShield -> ShowShield ->
if model ^. tBalance > 0 if model ^. tBalance > 0
then [Model $ model & shieldZec .~ True & menuPopup .~ False] then [Model $ model & shieldZec .~ True & menuPopup .~ False]
@ -2019,6 +2036,7 @@ runZenithGUI config = do
False False
shieldBal shieldBal
False False
False
startApp model handleEvent buildUI (params hD) startApp model handleEvent buildUI (params hD)
Left _e -> print "Zebra not available" Left _e -> print "Zebra not available"
where where