Compare commits

..

No commits in common. "995356f1f6dc46072c5fba98256ce80ad37627a6" and "e14ae0febd6cccd9dd5f2f1ff22ede2ba4b83e4e" have entirely different histories.

2 changed files with 5 additions and 49 deletions

View file

@ -7,14 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- GUI module
- Address list
- Transaction list
- Balance display
- Account selector
- Add GUI module
## [0.5.3.0-beta]

View file

@ -46,10 +46,8 @@ data AppEvent
| SetPool !ZcashPool
| SwitchQr !(Maybe QrCode)
| SwitchAddr !Int
| SwitchAcc !Int
| CopyAddr !(Maybe (Entity WalletAddress))
| LoadTxs ![Entity UserTx]
| LoadAddrs ![Entity WalletAddress]
deriving (Eq, Show)
data AppModel = AppModel
@ -69,7 +67,6 @@ data AppModel = AppModel
, _unconfBalance :: !(Maybe Integer)
, _selPool :: !ZcashPool
, _qrCodeWidget :: !(Maybe QrCode)
, _accPopup :: !Bool
} deriving (Eq, Show)
makeLenses ''AppModel
@ -118,12 +115,9 @@ buildUI wenv model = widgetTree
[ box_ [onClick WalletClicked, alignMiddle] walletButton `styleBasic`
[cursorHand, height 25, padding 3] `styleHover`
[bgColor btnHiLite]
, vstack
[ box_ [onClick AccountClicked, alignMiddle] accountButton `styleBasic`
, box_ [onClick AccountClicked, alignMiddle] accountButton `styleBasic`
[cursorHand, height 25, padding 3] `styleHover`
[bgColor btnHiLite]
, popup accPopup accListPopup
]
, filler
, remixIcon remixErrorWarningFill `styleBasic` [textColor white]
, label "Testnet" `styleBasic` [textColor white] `nodeVisible`
@ -144,20 +138,6 @@ buildUI wenv model = widgetTree
[textFont "Regular", 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]
balanceBox =
hstack
@ -435,7 +415,7 @@ handleEvent wenv node model evt =
AppInit -> []
ShowMsg t -> [Model $ model & msg ?~ t]
WalletClicked -> [Model $ model & msg ?~ "You clicked Wallet!"]
AccountClicked -> [Model $ model & accPopup .~ True]
AccountClicked -> [Model $ model & msg ?~ "You clicked Account!"]
SetPool p ->
[ Model $ model & selPool .~ p
, Task $
@ -453,16 +433,6 @@ handleEvent wenv node model evt =
]
SwitchQr q -> [Model $ model & qrCodeWidget .~ q]
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 ->
[ setClipboardData $
ClipboardText $
@ -483,7 +453,6 @@ handleEvent wenv node model evt =
, Event $ ShowMsg "Copied address!"
]
LoadTxs t -> [Model $ model & transactions .~ t]
LoadAddrs a -> [Model $ model & addresses .~ a, Event $ SetPool Orchard]
CloseMsg -> [Model $ model & msg .~ Nothing]
where
currentWallet =
@ -494,10 +463,6 @@ handleEvent wenv node model evt =
if null (model ^. accounts)
then Nothing
else Just ((model ^. accounts) !! (model ^. selAcc))
selectAccount i =
if null (model ^. accounts)
then Nothing
else Just ((model ^. accounts) !! i)
currentAddress =
if null (model ^. addresses)
then Nothing
@ -555,7 +520,6 @@ runZenithGUI config = do
(Just 300000)
Orchard
qr
False
startApp model handleEvent buildUI params
Left e -> do
initDb dbFilePath
@ -579,7 +543,6 @@ runZenithGUI config = do
(Just 30000)
Orchard
Nothing
False
startApp model handleEvent buildUI params
where
params =