Compare commits
No commits in common. "246fa05d11a10aabb0fc2f4c08b1bbf8460abe2f" and "bd32eb4f38a55efa9aec9fcf4a736d223c744e04" have entirely different histories.
246fa05d11
...
bd32eb4f38
2 changed files with 10 additions and 55 deletions
|
@ -28,7 +28,6 @@ import Brick.Widgets.Core
|
|||
, (<=>)
|
||||
, emptyWidget
|
||||
, fill
|
||||
, hBox
|
||||
, hLimit
|
||||
, joinBorders
|
||||
, padAll
|
||||
|
@ -36,7 +35,6 @@ import Brick.Widgets.Core
|
|||
, str
|
||||
, strWrap
|
||||
, txt
|
||||
, txtWrap
|
||||
, txtWrapWith
|
||||
, vBox
|
||||
, vLimit
|
||||
|
@ -50,7 +48,6 @@ import Control.Monad (void)
|
|||
import Control.Monad.IO.Class (liftIO)
|
||||
import Data.Maybe
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.Encoding as E
|
||||
import qualified Data.Vector as Vec
|
||||
import Database.Persist
|
||||
import qualified Graphics.Vty as V
|
||||
|
@ -91,7 +88,6 @@ data DialogType
|
|||
data DisplayType
|
||||
= AddrDisplay
|
||||
| MsgDisplay
|
||||
| PhraseDisplay
|
||||
| BlankDisplay
|
||||
|
||||
data State = State
|
||||
|
@ -139,14 +135,7 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
|
|||
(\(_, a) -> zcashAccountName $ entityVal a)
|
||||
(L.listSelectedElement (st ^. accounts))))) <=>
|
||||
listAddressBox "Addresses" (st ^. addresses) <+>
|
||||
B.vBorder <+> C.center (listBox "Transactions" (st ^. transactions))) <=>
|
||||
C.hCenter
|
||||
(hBox
|
||||
[ capCommand "W" "allets"
|
||||
, capCommand "A" "ccounts"
|
||||
, capCommand "V" "iew address"
|
||||
, capCommand "Q" "uit"
|
||||
])
|
||||
B.vBorder <+> C.center (listBox "Transactions" (st ^. transactions)))
|
||||
listBox :: Show e => String -> L.List Name e -> Widget Name
|
||||
listBox titleLabel l =
|
||||
C.vCenter $
|
||||
|
@ -169,6 +158,7 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
|
|||
(B.borderWithLabel (str titleLabel) $
|
||||
hLimit 25 $ vLimit 15 $ L.renderList drawF True l)
|
||||
, str " "
|
||||
, C.hCenter $ str "Select "
|
||||
]
|
||||
listAddressBox ::
|
||||
String -> L.List Name (Entity WalletAddress) -> Widget Name
|
||||
|
@ -219,26 +209,11 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
|
|||
WSelect ->
|
||||
D.renderDialog
|
||||
(D.dialog (Just (str "Select Wallet")) Nothing 50)
|
||||
(selectListBox "Wallets" (st ^. wallets) listDrawWallet <=>
|
||||
C.hCenter
|
||||
(hBox
|
||||
[ capCommand "↑↓ " "move"
|
||||
, capCommand "↲ " "select"
|
||||
, capCommand "N" "ew"
|
||||
, capCommand "S" "how phrase"
|
||||
, xCommand
|
||||
]))
|
||||
(selectListBox "Wallets" (st ^. wallets) listDrawWallet)
|
||||
ASelect ->
|
||||
D.renderDialog
|
||||
(D.dialog (Just (str "Select Account")) Nothing 50)
|
||||
(selectListBox "Accounts" (st ^. accounts) listDrawAccount <=>
|
||||
C.hCenter
|
||||
(hBox
|
||||
[ capCommand "↑↓ " "move"
|
||||
, capCommand "↲ " "select"
|
||||
, capCommand "N" "ew"
|
||||
, xCommand
|
||||
]))
|
||||
(selectListBox "Accounts" (st ^. accounts) listDrawAccount)
|
||||
Blank -> emptyWidget
|
||||
splashDialog :: State -> Widget Name
|
||||
splashDialog st =
|
||||
|
@ -250,13 +225,9 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
|
|||
titleAttr
|
||||
(str
|
||||
" _____ _ _ _ \n|__ /___ _ __ (_) |_| |__\n / // _ \\ '_ \\| | __| '_ \\\n / /| __/ | | | | |_| | | |\n/____\\___|_| |_|_|\\__|_| |_|") <=>
|
||||
C.hCenter (withAttr titleAttr (str "Zcash Wallet v0.4.4.0")) <=>
|
||||
C.hCenter (withAttr titleAttr (str "Zcash Wallet v0.4.3.0")) <=>
|
||||
C.hCenter (withAttr blinkAttr $ str "Press any key..."))
|
||||
else emptyWidget
|
||||
capCommand :: String -> String -> Widget Name
|
||||
capCommand k comm = hBox [withAttr titleAttr (str k), str comm, str " | "]
|
||||
xCommand :: Widget Name
|
||||
xCommand = hBox [str "E", withAttr titleAttr (str "x"), str "it"]
|
||||
displayDialog :: State -> Widget Name
|
||||
displayDialog st =
|
||||
case st ^. displayBox of
|
||||
|
@ -273,17 +244,6 @@ drawUI s = [splashDialog s, helpDialog s, displayDialog s, inputDialog s, ui s]
|
|||
txtWrapWith (WrapSettings False True NoFill FillAfterFirst) $
|
||||
getUA $ walletAddressUAddress $ entityVal a)
|
||||
Nothing -> emptyWidget
|
||||
PhraseDisplay ->
|
||||
case L.listSelectedElement $ st ^. wallets of
|
||||
Just (_, w) ->
|
||||
withBorderStyle unicodeBold $
|
||||
D.renderDialog
|
||||
(D.dialog (Just $ txt "Seed Phrase") Nothing 50)
|
||||
(padAll 1 $
|
||||
txtWrap $
|
||||
E.decodeUtf8Lenient $
|
||||
getBytes $ getPhrase $ zcashWalletSeedPhrase $ entityVal w)
|
||||
Nothing -> emptyWidget
|
||||
MsgDisplay ->
|
||||
withBorderStyle unicodeBold $
|
||||
D.renderDialog
|
||||
|
@ -359,7 +319,6 @@ appEvent (BT.VtyEvent e) = do
|
|||
case s ^. displayBox of
|
||||
AddrDisplay -> BT.modify $ set displayBox BlankDisplay
|
||||
MsgDisplay -> BT.modify $ set displayBox BlankDisplay
|
||||
PhraseDisplay -> BT.modify $ set displayBox BlankDisplay
|
||||
BlankDisplay -> do
|
||||
case s ^. dialogBox of
|
||||
WName -> do
|
||||
|
@ -413,30 +372,26 @@ appEvent (BT.VtyEvent e) = do
|
|||
BT.zoom inputForm $ handleFormEvent (BT.VtyEvent ev)
|
||||
WSelect -> do
|
||||
case e of
|
||||
V.EvKey (V.KChar 'x') [] ->
|
||||
BT.modify $ set dialogBox Blank
|
||||
V.EvKey V.KEsc [] -> BT.modify $ set dialogBox Blank
|
||||
V.EvKey V.KEnter [] -> do
|
||||
ns <- liftIO $ refreshWallet s
|
||||
BT.put ns
|
||||
BT.modify $ set dialogBox Blank
|
||||
V.EvKey (V.KChar 'n') [] -> do
|
||||
V.EvKey (V.KChar 'c') [] -> do
|
||||
BT.modify $
|
||||
set inputForm $
|
||||
updateFormState (DialogInput "New Wallet") $
|
||||
s ^. inputForm
|
||||
BT.modify $ set dialogBox WName
|
||||
V.EvKey (V.KChar 's') [] ->
|
||||
BT.modify $ set displayBox PhraseDisplay
|
||||
ev -> BT.zoom wallets $ L.handleListEvent ev
|
||||
ASelect -> do
|
||||
case e of
|
||||
V.EvKey (V.KChar 'x') [] ->
|
||||
BT.modify $ set dialogBox Blank
|
||||
V.EvKey V.KEsc [] -> BT.modify $ set dialogBox Blank
|
||||
V.EvKey V.KEnter [] -> do
|
||||
ns <- liftIO $ refreshAccount s
|
||||
BT.put ns
|
||||
BT.modify $ set dialogBox Blank
|
||||
V.EvKey (V.KChar 'n') [] -> do
|
||||
V.EvKey (V.KChar 'c') [] -> do
|
||||
BT.modify $
|
||||
set inputForm $
|
||||
updateFormState (DialogInput "New Account") $
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
cabal-version: 3.0
|
||||
name: zenith
|
||||
version: 0.4.4.1
|
||||
version: 0.4.4.0
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Rene Vergara
|
||||
|
|
Loading…
Reference in a new issue