rvv001 - Shield / De-Shield
GUI - Forms for Shielding and De-shielding created TUI - Form to deshield is not implemented
This commit is contained in:
parent
e02551c9ff
commit
54d9f20fdd
2 changed files with 138 additions and 7 deletions
|
@ -676,12 +676,6 @@ mkshieldDeshieldForm bal =
|
|||
editShowableFieldWithValidate totalTransparent TotalTranspField (isAmountValid bal)
|
||||
, label "Total Shielded : " @@=
|
||||
editShowableFieldWithValidate totalShielded TotalShieldedField (isAmountValid bal)
|
||||
, label "Select :" @@=
|
||||
radioField
|
||||
shieldOp
|
||||
[ (Shield, ShieldField, "Shield")
|
||||
, (Deshield, DeshieldField, "De-Shield")
|
||||
]
|
||||
, label "Amount: " @@=
|
||||
editShowableFieldWithValidate shAmt AmtField (isAmountValid bal)
|
||||
]
|
||||
|
|
|
@ -126,6 +126,10 @@ data AppEvent
|
|||
| DeleteABEntry !T.Text
|
||||
| UpdateABDescrip !T.Text !T.Text
|
||||
| ResetRecipientValid
|
||||
| ShowShield
|
||||
| CloseShield
|
||||
| ShowDeShield
|
||||
| CloseDeShield
|
||||
deriving (Eq, Show)
|
||||
|
||||
data AppModel = AppModel
|
||||
|
@ -179,6 +183,12 @@ data AppModel = AppModel
|
|||
, _showABAddress :: !Bool
|
||||
, _updateABAddress :: !Bool
|
||||
, _privacyChoice :: !PrivacyPolicy
|
||||
, _shieldZec :: !Bool
|
||||
, _deShieldZec :: !Bool
|
||||
, _tBalance :: !Integer
|
||||
, _tBalanceValid :: !Bool
|
||||
, _sBalance :: !Integer
|
||||
, _sBalanceValid :: !Bool
|
||||
} deriving (Eq, Show)
|
||||
|
||||
makeLenses ''AppModel
|
||||
|
@ -228,6 +238,8 @@ buildUI wenv model = widgetTree
|
|||
, updateABAddressOverlay (model ^. abdescrip) (model ^. abaddress) `nodeVisible`
|
||||
model ^.
|
||||
updateABAddress
|
||||
, shieldOverlay `nodeVisible` model ^. shieldZec
|
||||
, deShieldOverlay `nodeVisible` model ^. deShieldZec
|
||||
, msgAdrBookOverlay `nodeVisible` isJust (model ^. msgAB)
|
||||
]
|
||||
mainWindow =
|
||||
|
@ -293,6 +305,10 @@ buildUI wenv model = widgetTree
|
|||
[bgColor white, borderB 1 gray, padding 3]
|
||||
, box_ [alignLeft, onClick ShowAdrBook] (label "Address Book") `styleBasic`
|
||||
[bgColor white, borderB 1 gray, padding 3]
|
||||
, box_ [alignLeft, onClick ShowShield] (label "Shield ZEC") `styleBasic`
|
||||
[bgColor white, borderB 1 gray, padding 3]
|
||||
, box_ [alignLeft, onClick ShowDeShield] (label "De-Shield ZEC") `styleBasic`
|
||||
[bgColor white, borderB 1 gray, padding 3]
|
||||
]) `styleBasic`
|
||||
[bgColor btnColor, padding 3]
|
||||
newBox =
|
||||
|
@ -958,7 +974,118 @@ buildUI wenv model = widgetTree
|
|||
, label_ (txtWrapN (fromMaybe "" (model ^. msgAB)) 64) [multiline]
|
||||
, filler
|
||||
]
|
||||
|
||||
shieldOverlay =
|
||||
alert CloseShield $
|
||||
box
|
||||
(vstack
|
||||
[ filler
|
||||
, hstack
|
||||
[ filler
|
||||
, box_
|
||||
[]
|
||||
(vstack
|
||||
[ box_
|
||||
[alignMiddle]
|
||||
(label "Shield Zcash" `styleBasic`
|
||||
[textFont "Bold", textSize 12])
|
||||
, separatorLine `styleBasic` [fgColor btnColor]
|
||||
, spacer
|
||||
, hstack
|
||||
[ label "Amount:" `styleBasic`
|
||||
[width 50, textFont "Bold"]
|
||||
, spacer
|
||||
, numericField_
|
||||
sendAmount
|
||||
[ decimals 8
|
||||
, minValue 0.0
|
||||
, maxValue
|
||||
(fromIntegral (model ^. tBalance) / 100000000.0)
|
||||
, validInput tBalanceValid
|
||||
, onChange CheckAmount
|
||||
] `styleBasic`
|
||||
[ width 150
|
||||
, styleIf
|
||||
(not $ model ^. tBalanceValid)
|
||||
(textColor red)
|
||||
]
|
||||
]
|
||||
, spacer
|
||||
, box_
|
||||
[alignMiddle]
|
||||
(hstack
|
||||
[ filler
|
||||
, mainButton "Proceed" NotImplemented `nodeEnabled`
|
||||
(model ^. amountValid && model ^. recipientValid)
|
||||
, filler
|
||||
])
|
||||
]) `styleBasic`
|
||||
[radius 4, border 2 btnColor, bgColor white, padding 4]
|
||||
, filler
|
||||
]
|
||||
, filler
|
||||
]) `styleBasic`
|
||||
[bgColor (white & L.a .~ 0.5)]
|
||||
deShieldOverlay =
|
||||
alert CloseDeShield $
|
||||
box
|
||||
(vstack
|
||||
[ filler
|
||||
, hstack
|
||||
[ filler
|
||||
, box_
|
||||
[]
|
||||
(vstack
|
||||
[ box_
|
||||
[alignMiddle]
|
||||
(label "De-Shield Zcash" `styleBasic`
|
||||
[textFont "Bold", textSize 12])
|
||||
, separatorLine `styleBasic` [fgColor btnColor]
|
||||
, spacer
|
||||
, hstack
|
||||
[ (label "Total Transparent : " `styleBasic` [ textFont "Bold" ])
|
||||
, (label "0.00" )
|
||||
]
|
||||
, spacer
|
||||
, hstack
|
||||
[ (label "Total Shielded : " `styleBasic` [ textFont "Bold" ])
|
||||
, (label "0.00" )
|
||||
]
|
||||
, spacer
|
||||
, hstack
|
||||
[ label "Amount:" `styleBasic`
|
||||
[width 50, textFont "Bold"]
|
||||
, spacer
|
||||
, numericField_
|
||||
sendAmount
|
||||
[ decimals 8
|
||||
, minValue 0.0
|
||||
, maxValue
|
||||
(fromIntegral (model ^. sBalance) / 100000000.0)
|
||||
, validInput sBalanceValid
|
||||
, onChange CheckAmount
|
||||
] `styleBasic`
|
||||
[ width 150
|
||||
, styleIf
|
||||
(not $ model ^. sBalanceValid)
|
||||
(textColor red)
|
||||
]
|
||||
]
|
||||
, spacer
|
||||
, box_
|
||||
[alignMiddle]
|
||||
(hstack
|
||||
[ filler
|
||||
, mainButton "Proceed" NotImplemented `nodeEnabled`
|
||||
(model ^. amountValid && model ^. recipientValid)
|
||||
, filler
|
||||
])
|
||||
]) `styleBasic`
|
||||
[radius 4, border 2 btnColor, bgColor white, padding 4]
|
||||
, filler
|
||||
]
|
||||
, filler
|
||||
]) `styleBasic`
|
||||
[bgColor (white & L.a .~ 0.5)]
|
||||
notImplemented = NotImplemented
|
||||
|
||||
generateQRCodes :: Config -> IO ()
|
||||
|
@ -1349,6 +1476,10 @@ handleEvent wenv node model evt =
|
|||
model & msgAB ?~ "Function not implemented..." & menuPopup .~ False
|
||||
]
|
||||
CloseMsgAB -> [Model $ model & msgAB .~ Nothing & inError .~ False]
|
||||
ShowShield -> [ Model $ model & shieldZec .~ True & menuPopup .~ False ]
|
||||
CloseShield -> [Model $ model & shieldZec .~ False]
|
||||
ShowDeShield -> [ Model $ model & deShieldZec .~ True & menuPopup .~ False ]
|
||||
CloseDeShield -> [Model $ model & deShieldZec .~ False]
|
||||
LoadAbList a -> [Model $ model & abaddressList .~ a]
|
||||
UpdateABDescrip d a ->
|
||||
[ Task $ updAddrBookDescrip (model ^. configuration) d a
|
||||
|
@ -1697,6 +1828,12 @@ runZenithGUI config = do
|
|||
False
|
||||
False
|
||||
Full
|
||||
False
|
||||
False
|
||||
0
|
||||
False
|
||||
0
|
||||
False
|
||||
startApp model handleEvent buildUI (params hD)
|
||||
Left _e -> print "Zebra not available"
|
||||
where
|
||||
|
|
Loading…
Reference in a new issue