Compare commits
2 commits
7189ddcb2a
...
d050c0c040
Author | SHA1 | Date | |
---|---|---|---|
d050c0c040 | |||
212c1f2867 |
2 changed files with 22 additions and 5 deletions
|
@ -10,7 +10,7 @@ import qualified Brick.BChan as BC
|
|||
import qualified Brick.Focus as F
|
||||
import Brick.Forms
|
||||
( Form(..)
|
||||
, (@@=)
|
||||
, radioField
|
||||
, allFieldsValid
|
||||
, editShowableFieldWithValidate
|
||||
, editTextField
|
||||
|
@ -21,6 +21,7 @@ import Brick.Forms
|
|||
, renderForm
|
||||
, setFieldValid
|
||||
, updateFormState
|
||||
, (@@=)
|
||||
)
|
||||
import qualified Brick.Main as M
|
||||
import qualified Brick.Types as BT
|
||||
|
@ -94,6 +95,7 @@ import Zenith.Types
|
|||
, PhraseDB(..)
|
||||
, UnifiedAddressDB(..)
|
||||
, ZcashNetDB(..)
|
||||
, PrivacyPolicy(..)
|
||||
)
|
||||
import Zenith.Utils
|
||||
( displayTaz
|
||||
|
@ -119,6 +121,10 @@ data Name
|
|||
| ABList
|
||||
| DescripField
|
||||
| AddressField
|
||||
| PrivacyNoneField
|
||||
| PrivacyLowField
|
||||
| PrivacyMediumField
|
||||
| PrivacyFullField
|
||||
deriving (Eq, Show, Ord)
|
||||
|
||||
data DialogInput = DialogInput
|
||||
|
@ -131,6 +137,7 @@ data SendInput = SendInput
|
|||
{ _sendTo :: !T.Text
|
||||
, _sendAmt :: !Float
|
||||
, _sendMemo :: !T.Text
|
||||
, _policyField :: !PrivacyPolicy
|
||||
} deriving (Show)
|
||||
|
||||
makeLenses ''SendInput
|
||||
|
@ -171,6 +178,8 @@ data Tick
|
|||
| TickMsg !String
|
||||
| TickTx !HexString
|
||||
|
||||
data DropDownItem = DropdownItem String
|
||||
|
||||
data State = State
|
||||
{ _network :: !ZcashNet
|
||||
, _wallets :: !(L.List Name (Entity ZcashWallet))
|
||||
|
@ -607,6 +616,12 @@ mkSendForm bal =
|
|||
, label "Amount: " @@=
|
||||
editShowableFieldWithValidate sendAmt AmtField (isAmountValid bal)
|
||||
, label "Memo: " @@= editTextField sendMemo MemoField (Just 1)
|
||||
, label "Privacy Level :" @@=
|
||||
radioField policyField [ (None, PrivacyNoneField, "None")
|
||||
, (Low, PrivacyLowField, "Low")
|
||||
, (Medium, PrivacyMediumField, "Medium")
|
||||
, (Full, PrivacyFullField, "Full")
|
||||
]
|
||||
]
|
||||
where
|
||||
isAmountValid :: Integer -> Float -> Bool
|
||||
|
@ -1125,7 +1140,8 @@ appEvent (BT.VtyEvent e) = do
|
|||
(SendInput
|
||||
(addressBookAbaddress (entityVal a))
|
||||
0.0
|
||||
"")
|
||||
""
|
||||
None)
|
||||
BT.modify $ set dialogBox SendTx
|
||||
_ -> do
|
||||
BT.modify $
|
||||
|
@ -1297,7 +1313,7 @@ appEvent (BT.VtyEvent e) = do
|
|||
V.EvKey (V.KChar 's') [] -> do
|
||||
BT.modify $
|
||||
set txForm $
|
||||
mkSendForm (s ^. balance) (SendInput "" 0.0 "")
|
||||
mkSendForm (s ^. balance) (SendInput "" 0.0 "" None)
|
||||
BT.modify $ set dialogBox SendTx
|
||||
V.EvKey (V.KChar 'b') [] ->
|
||||
BT.modify $ set dialogBox AdrBook
|
||||
|
@ -1432,7 +1448,7 @@ runZenithTUI config = do
|
|||
1.0
|
||||
eventChan
|
||||
0
|
||||
(mkSendForm 0 $ SendInput "" 0.0 "")
|
||||
(mkSendForm 0 $ SendInput "" 0.0 "" None)
|
||||
(L.list ABList (Vec.fromList abookList) 1)
|
||||
(mkNewABForm (AdrBookEntry "" ""))
|
||||
""
|
||||
|
|
|
@ -203,7 +203,8 @@ data PrivacyPolicy
|
|||
| Medium
|
||||
| Low
|
||||
| None
|
||||
|
||||
deriving (Eq, Show, Read, Ord)
|
||||
|
||||
$(deriveJSON defaultOptions ''PrivacyPolicy)
|
||||
|
||||
-- ** `zebrad`
|
||||
|
|
Loading…
Reference in a new issue