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