Compare commits

...

2 commits

Author SHA1 Message Date
d050c0c040 rvv001 - docker folder removed 2024-09-23 21:46:00 -04:00
212c1f2867 rvv001 - Add Privacy Policy to TUI 2024-09-23 21:30:05 -04:00
2 changed files with 22 additions and 5 deletions

View file

@ -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 "" ""))
""

View file

@ -203,6 +203,7 @@ data PrivacyPolicy
| Medium
| Low
| None
deriving (Eq, Show, Read, Ord)
$(deriveJSON defaultOptions ''PrivacyPolicy)