Compare commits
No commits in common. "995356f1f6dc46072c5fba98256ce80ad37627a6" and "e14ae0febd6cccd9dd5f2f1ff22ede2ba4b83e4e" have entirely different histories.
995356f1f6
...
e14ae0febd
2 changed files with 5 additions and 49 deletions
|
@ -7,14 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Added
|
- Add GUI module
|
||||||
|
|
||||||
- GUI module
|
|
||||||
- Address list
|
|
||||||
- Transaction list
|
|
||||||
- Balance display
|
|
||||||
- Account selector
|
|
||||||
|
|
||||||
|
|
||||||
## [0.5.3.0-beta]
|
## [0.5.3.0-beta]
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,8 @@ data AppEvent
|
||||||
| SetPool !ZcashPool
|
| SetPool !ZcashPool
|
||||||
| SwitchQr !(Maybe QrCode)
|
| SwitchQr !(Maybe QrCode)
|
||||||
| SwitchAddr !Int
|
| SwitchAddr !Int
|
||||||
| SwitchAcc !Int
|
|
||||||
| CopyAddr !(Maybe (Entity WalletAddress))
|
| CopyAddr !(Maybe (Entity WalletAddress))
|
||||||
| LoadTxs ![Entity UserTx]
|
| LoadTxs ![Entity UserTx]
|
||||||
| LoadAddrs ![Entity WalletAddress]
|
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
data AppModel = AppModel
|
data AppModel = AppModel
|
||||||
|
@ -69,7 +67,6 @@ data AppModel = AppModel
|
||||||
, _unconfBalance :: !(Maybe Integer)
|
, _unconfBalance :: !(Maybe Integer)
|
||||||
, _selPool :: !ZcashPool
|
, _selPool :: !ZcashPool
|
||||||
, _qrCodeWidget :: !(Maybe QrCode)
|
, _qrCodeWidget :: !(Maybe QrCode)
|
||||||
, _accPopup :: !Bool
|
|
||||||
} deriving (Eq, Show)
|
} deriving (Eq, Show)
|
||||||
|
|
||||||
makeLenses ''AppModel
|
makeLenses ''AppModel
|
||||||
|
@ -118,12 +115,9 @@ buildUI wenv model = widgetTree
|
||||||
[ box_ [onClick WalletClicked, alignMiddle] walletButton `styleBasic`
|
[ box_ [onClick WalletClicked, alignMiddle] walletButton `styleBasic`
|
||||||
[cursorHand, height 25, padding 3] `styleHover`
|
[cursorHand, height 25, padding 3] `styleHover`
|
||||||
[bgColor btnHiLite]
|
[bgColor btnHiLite]
|
||||||
, vstack
|
, box_ [onClick AccountClicked, alignMiddle] accountButton `styleBasic`
|
||||||
[ box_ [onClick AccountClicked, alignMiddle] accountButton `styleBasic`
|
|
||||||
[cursorHand, height 25, padding 3] `styleHover`
|
[cursorHand, height 25, padding 3] `styleHover`
|
||||||
[bgColor btnHiLite]
|
[bgColor btnHiLite]
|
||||||
, popup accPopup accListPopup
|
|
||||||
]
|
|
||||||
, filler
|
, filler
|
||||||
, remixIcon remixErrorWarningFill `styleBasic` [textColor white]
|
, remixIcon remixErrorWarningFill `styleBasic` [textColor white]
|
||||||
, label "Testnet" `styleBasic` [textColor white] `nodeVisible`
|
, label "Testnet" `styleBasic` [textColor white] `nodeVisible`
|
||||||
|
@ -144,20 +138,6 @@ buildUI wenv model = widgetTree
|
||||||
[textFont "Regular", textColor white]
|
[textFont "Regular", textColor white]
|
||||||
, remixIcon remixArrowRightWideLine `styleBasic` [textColor white]
|
, remixIcon remixArrowRightWideLine `styleBasic` [textColor white]
|
||||||
]
|
]
|
||||||
accListPopup =
|
|
||||||
box_ [alignMiddle] dispAccList `styleBasic` [bgColor btnColor, padding 3]
|
|
||||||
dispAccList = vstack (zipWith accRow [0 ..] (model ^. accounts))
|
|
||||||
accRow :: Int -> Entity ZcashAccount -> WidgetNode AppModel AppEvent
|
|
||||||
accRow idx wAcc =
|
|
||||||
box_
|
|
||||||
[onClick $ SwitchAcc idx, alignLeft]
|
|
||||||
(label (zcashAccountName (entityVal wAcc))) `styleBasic`
|
|
||||||
[ padding 1
|
|
||||||
, borderB 1 gray
|
|
||||||
, bgColor white
|
|
||||||
, styleIf (model ^. selAcc == idx) (borderL 2 btnHiLite)
|
|
||||||
, styleIf (model ^. selAcc == idx) (borderR 2 btnHiLite)
|
|
||||||
]
|
|
||||||
mainPane = box_ [alignMiddle] $ hstack [addressBox, txBox]
|
mainPane = box_ [alignMiddle] $ hstack [addressBox, txBox]
|
||||||
balanceBox =
|
balanceBox =
|
||||||
hstack
|
hstack
|
||||||
|
@ -435,7 +415,7 @@ handleEvent wenv node model evt =
|
||||||
AppInit -> []
|
AppInit -> []
|
||||||
ShowMsg t -> [Model $ model & msg ?~ t]
|
ShowMsg t -> [Model $ model & msg ?~ t]
|
||||||
WalletClicked -> [Model $ model & msg ?~ "You clicked Wallet!"]
|
WalletClicked -> [Model $ model & msg ?~ "You clicked Wallet!"]
|
||||||
AccountClicked -> [Model $ model & accPopup .~ True]
|
AccountClicked -> [Model $ model & msg ?~ "You clicked Account!"]
|
||||||
SetPool p ->
|
SetPool p ->
|
||||||
[ Model $ model & selPool .~ p
|
[ Model $ model & selPool .~ p
|
||||||
, Task $
|
, Task $
|
||||||
|
@ -453,16 +433,6 @@ handleEvent wenv node model evt =
|
||||||
]
|
]
|
||||||
SwitchQr q -> [Model $ model & qrCodeWidget .~ q]
|
SwitchQr q -> [Model $ model & qrCodeWidget .~ q]
|
||||||
SwitchAddr i -> [Model $ model & selAddr .~ i, Event $ SetPool Orchard]
|
SwitchAddr i -> [Model $ model & selAddr .~ i, Event $ SetPool Orchard]
|
||||||
SwitchAcc i ->
|
|
||||||
[ Model $ model & selAcc .~ i
|
|
||||||
, Task $
|
|
||||||
LoadAddrs <$> do
|
|
||||||
dbPool <- runNoLoggingT $ initPool $ c_dbPath $ model ^. configuration
|
|
||||||
case selectAccount i of
|
|
||||||
Nothing -> return []
|
|
||||||
Just acc -> runNoLoggingT $ getAddresses dbPool $ entityKey acc
|
|
||||||
, Event $ SetPool Orchard
|
|
||||||
]
|
|
||||||
CopyAddr a ->
|
CopyAddr a ->
|
||||||
[ setClipboardData $
|
[ setClipboardData $
|
||||||
ClipboardText $
|
ClipboardText $
|
||||||
|
@ -483,7 +453,6 @@ handleEvent wenv node model evt =
|
||||||
, Event $ ShowMsg "Copied address!"
|
, Event $ ShowMsg "Copied address!"
|
||||||
]
|
]
|
||||||
LoadTxs t -> [Model $ model & transactions .~ t]
|
LoadTxs t -> [Model $ model & transactions .~ t]
|
||||||
LoadAddrs a -> [Model $ model & addresses .~ a, Event $ SetPool Orchard]
|
|
||||||
CloseMsg -> [Model $ model & msg .~ Nothing]
|
CloseMsg -> [Model $ model & msg .~ Nothing]
|
||||||
where
|
where
|
||||||
currentWallet =
|
currentWallet =
|
||||||
|
@ -494,10 +463,6 @@ handleEvent wenv node model evt =
|
||||||
if null (model ^. accounts)
|
if null (model ^. accounts)
|
||||||
then Nothing
|
then Nothing
|
||||||
else Just ((model ^. accounts) !! (model ^. selAcc))
|
else Just ((model ^. accounts) !! (model ^. selAcc))
|
||||||
selectAccount i =
|
|
||||||
if null (model ^. accounts)
|
|
||||||
then Nothing
|
|
||||||
else Just ((model ^. accounts) !! i)
|
|
||||||
currentAddress =
|
currentAddress =
|
||||||
if null (model ^. addresses)
|
if null (model ^. addresses)
|
||||||
then Nothing
|
then Nothing
|
||||||
|
@ -555,7 +520,6 @@ runZenithGUI config = do
|
||||||
(Just 300000)
|
(Just 300000)
|
||||||
Orchard
|
Orchard
|
||||||
qr
|
qr
|
||||||
False
|
|
||||||
startApp model handleEvent buildUI params
|
startApp model handleEvent buildUI params
|
||||||
Left e -> do
|
Left e -> do
|
||||||
initDb dbFilePath
|
initDb dbFilePath
|
||||||
|
@ -579,7 +543,6 @@ runZenithGUI config = do
|
||||||
(Just 30000)
|
(Just 30000)
|
||||||
Orchard
|
Orchard
|
||||||
Nothing
|
Nothing
|
||||||
False
|
|
||||||
startApp model handleEvent buildUI params
|
startApp model handleEvent buildUI params
|
||||||
where
|
where
|
||||||
params =
|
params =
|
||||||
|
|
Loading…
Reference in a new issue