Add input form
This commit is contained in:
parent
c4a3ccadb1
commit
71cc28434a
3 changed files with 99 additions and 47 deletions
|
@ -57,6 +57,8 @@ data AppEvent
|
||||||
| LoadTxs ![Entity UserTx]
|
| LoadTxs ![Entity UserTx]
|
||||||
| LoadAddrs ![Entity WalletAddress]
|
| LoadAddrs ![Entity WalletAddress]
|
||||||
| LoadAccs ![Entity ZcashAccount]
|
| LoadAccs ![Entity ZcashAccount]
|
||||||
|
| ConfirmCancel
|
||||||
|
| SaveAddress
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
data AppModel = AppModel
|
data AppModel = AppModel
|
||||||
|
@ -80,6 +82,11 @@ data AppModel = AppModel
|
||||||
, _walPopup :: !Bool
|
, _walPopup :: !Bool
|
||||||
, _menuPopup :: !Bool
|
, _menuPopup :: !Bool
|
||||||
, _newPopup :: !Bool
|
, _newPopup :: !Bool
|
||||||
|
, _mainInput :: !T.Text
|
||||||
|
, _confirmTitle :: !(Maybe T.Text)
|
||||||
|
, _confirmAccept :: !T.Text
|
||||||
|
, _confirmCancel :: !T.Text
|
||||||
|
, _confirmEvent :: !AppEvent
|
||||||
} deriving (Eq, Show)
|
} deriving (Eq, Show)
|
||||||
|
|
||||||
makeLenses ''AppModel
|
makeLenses ''AppModel
|
||||||
|
@ -112,7 +119,11 @@ buildUI wenv model = widgetTree
|
||||||
then Nothing
|
then Nothing
|
||||||
else Just ((model ^. addresses) !! (model ^. selAddr))
|
else Just ((model ^. addresses) !! (model ^. selAddr))
|
||||||
widgetTree =
|
widgetTree =
|
||||||
zstack [mainWindow, msgOverlay `nodeVisible` isJust (model ^. msg)]
|
zstack
|
||||||
|
[ mainWindow
|
||||||
|
, confirmOverlay `nodeVisible` isJust (model ^. confirmTitle)
|
||||||
|
, msgOverlay `nodeVisible` isJust (model ^. msg)
|
||||||
|
]
|
||||||
mainWindow =
|
mainWindow =
|
||||||
vstack
|
vstack
|
||||||
[ windowHeader
|
[ windowHeader
|
||||||
|
@ -434,6 +445,15 @@ buildUI wenv model = widgetTree
|
||||||
msgOverlay =
|
msgOverlay =
|
||||||
alert CloseMsg $
|
alert CloseMsg $
|
||||||
hstack [filler, label $ fromMaybe "" (model ^. msg), filler]
|
hstack [filler, label $ fromMaybe "" (model ^. msg), filler]
|
||||||
|
confirmOverlay =
|
||||||
|
confirm_
|
||||||
|
(model ^. confirmEvent)
|
||||||
|
ConfirmCancel
|
||||||
|
[ titleCaption $ fromMaybe "" $ model ^. confirmTitle
|
||||||
|
, acceptCaption $ model ^. confirmAccept
|
||||||
|
, cancelCaption $ model ^. confirmCancel
|
||||||
|
]
|
||||||
|
(hstack [label "Name:", filler, textField_ mainInput [maxLength 25]])
|
||||||
|
|
||||||
generateQRCodes :: Config -> IO ()
|
generateQRCodes :: Config -> IO ()
|
||||||
generateQRCodes config = do
|
generateQRCodes config = do
|
||||||
|
@ -517,9 +537,17 @@ handleEvent wenv node model evt =
|
||||||
AccountClicked -> [Model $ model & accPopup .~ True]
|
AccountClicked -> [Model $ model & accPopup .~ True]
|
||||||
MenuClicked -> [Model $ model & menuPopup .~ True]
|
MenuClicked -> [Model $ model & menuPopup .~ True]
|
||||||
NewClicked -> [Model $ model & newPopup .~ not (model ^. newPopup)]
|
NewClicked -> [Model $ model & newPopup .~ not (model ^. newPopup)]
|
||||||
NewAddress -> [Event $ ShowMsg "You clicked new address"]
|
NewAddress ->
|
||||||
|
[ Model $
|
||||||
|
model & confirmTitle ?~ "New Address" & confirmAccept .~ "Create" &
|
||||||
|
confirmCancel .~
|
||||||
|
"Cancel"
|
||||||
|
]
|
||||||
NewAccount -> [Event $ ShowMsg "You clicked new account"]
|
NewAccount -> [Event $ ShowMsg "You clicked new account"]
|
||||||
NewWallet -> [Event $ ShowMsg "You clicked new wallet"]
|
NewWallet -> [Event $ ShowMsg "You clicked new wallet"]
|
||||||
|
ConfirmCancel -> [Model $ model & confirmTitle .~ Nothing & mainInput .~ ""]
|
||||||
|
SaveAddress ->
|
||||||
|
[Event $ ShowMsg $ "You saved address: " <> model ^. mainInput]
|
||||||
SetPool p ->
|
SetPool p ->
|
||||||
[ Model $ model & selPool .~ p
|
[ Model $ model & selPool .~ p
|
||||||
, Task $
|
, Task $
|
||||||
|
@ -657,6 +685,11 @@ runZenithGUI config = do
|
||||||
False
|
False
|
||||||
False
|
False
|
||||||
False
|
False
|
||||||
|
""
|
||||||
|
Nothing
|
||||||
|
""
|
||||||
|
""
|
||||||
|
SaveAddress
|
||||||
startApp model handleEvent buildUI params
|
startApp model handleEvent buildUI params
|
||||||
Left e -> do
|
Left e -> do
|
||||||
initDb dbFilePath
|
initDb dbFilePath
|
||||||
|
@ -684,6 +717,11 @@ runZenithGUI config = do
|
||||||
False
|
False
|
||||||
False
|
False
|
||||||
False
|
False
|
||||||
|
""
|
||||||
|
Nothing
|
||||||
|
""
|
||||||
|
""
|
||||||
|
SaveAddress
|
||||||
startApp model handleEvent buildUI params
|
startApp model handleEvent buildUI params
|
||||||
where
|
where
|
||||||
params =
|
params =
|
||||||
|
|
|
@ -4,6 +4,7 @@ module Zenith.GUI.Theme
|
||||||
( zenithTheme
|
( zenithTheme
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Data.Default
|
||||||
import Lens.Micro ((&), (+~), (.~), (?~), (^.), at, set)
|
import Lens.Micro ((&), (+~), (.~), (?~), (^.), at, set)
|
||||||
import Monomer
|
import Monomer
|
||||||
import Monomer.Core.Themes.BaseTheme
|
import Monomer.Core.Themes.BaseTheme
|
||||||
|
@ -12,49 +13,57 @@ import Monomer.Graphics (rgbHex, transparent)
|
||||||
import Monomer.Graphics.ColorTable
|
import Monomer.Graphics.ColorTable
|
||||||
import qualified Monomer.Lens as L
|
import qualified Monomer.Lens as L
|
||||||
|
|
||||||
|
baseTextStyle :: TextStyle
|
||||||
|
baseTextStyle = def & L.fontSize ?~ FontSize 10 & L.fontColor ?~ black
|
||||||
|
|
||||||
|
hiliteTextStyle :: TextStyle
|
||||||
|
hiliteTextStyle = def & L.fontSize ?~ FontSize 10 & L.fontColor ?~ white
|
||||||
|
|
||||||
zenithTheme :: Theme
|
zenithTheme :: Theme
|
||||||
zenithTheme =
|
zenithTheme =
|
||||||
baseTheme zgoThemeColors & L.basic . L.labelStyle . L.text ?~
|
baseTheme zgoThemeColors & L.basic . L.labelStyle . L.text ?~ baseTextStyle &
|
||||||
TextStyle
|
|
||||||
Nothing
|
|
||||||
(Just . FontSize $ 10)
|
|
||||||
Nothing
|
|
||||||
Nothing
|
|
||||||
(Just black)
|
|
||||||
Nothing
|
|
||||||
Nothing
|
|
||||||
Nothing
|
|
||||||
Nothing
|
|
||||||
Nothing
|
|
||||||
Nothing &
|
|
||||||
L.hover .
|
L.hover .
|
||||||
L.tooltipStyle . L.text ?~
|
L.tooltipStyle . L.text ?~
|
||||||
TextStyle
|
baseTextStyle &
|
||||||
Nothing
|
|
||||||
(Just . FontSize $ 10)
|
|
||||||
Nothing
|
|
||||||
Nothing
|
|
||||||
(Just black)
|
|
||||||
Nothing
|
|
||||||
Nothing
|
|
||||||
Nothing
|
|
||||||
Nothing
|
|
||||||
Nothing
|
|
||||||
Nothing &
|
|
||||||
L.hover .
|
L.hover .
|
||||||
L.labelStyle . L.text ?~
|
L.labelStyle . L.text ?~
|
||||||
TextStyle
|
baseTextStyle &
|
||||||
Nothing
|
L.basic .
|
||||||
(Just . FontSize $ 10)
|
L.dialogTitleStyle . L.text ?~
|
||||||
Nothing
|
(baseTextStyle & L.fontSize ?~ FontSize 12 & L.font ?~ "Bold") &
|
||||||
Nothing
|
L.hover .
|
||||||
(Just black)
|
L.dialogTitleStyle . L.text ?~
|
||||||
Nothing
|
(baseTextStyle & L.fontSize ?~ FontSize 12 & L.font ?~ "Bold") &
|
||||||
Nothing
|
L.basic .
|
||||||
Nothing
|
L.btnStyle . L.text ?~
|
||||||
Nothing
|
baseTextStyle &
|
||||||
Nothing
|
L.hover .
|
||||||
Nothing
|
L.btnStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.focus .
|
||||||
|
L.btnStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.focusHover .
|
||||||
|
L.btnStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.active .
|
||||||
|
L.btnStyle . L.text ?~
|
||||||
|
baseTextStyle &
|
||||||
|
L.basic .
|
||||||
|
L.btnMainStyle . L.text ?~
|
||||||
|
hiliteTextStyle &
|
||||||
|
L.hover .
|
||||||
|
L.btnMainStyle . L.text ?~
|
||||||
|
hiliteTextStyle &
|
||||||
|
L.focus .
|
||||||
|
L.btnMainStyle . L.text ?~
|
||||||
|
hiliteTextStyle &
|
||||||
|
L.focusHover .
|
||||||
|
L.btnMainStyle . L.text ?~
|
||||||
|
hiliteTextStyle &
|
||||||
|
L.active .
|
||||||
|
L.btnMainStyle . L.text ?~
|
||||||
|
hiliteTextStyle
|
||||||
|
|
||||||
zenithThemeColors :: BaseThemeColors
|
zenithThemeColors :: BaseThemeColors
|
||||||
zenithThemeColors =
|
zenithThemeColors =
|
||||||
|
@ -70,10 +79,10 @@ zenithThemeColors =
|
||||||
, btnText = gray02
|
, btnText = gray02
|
||||||
, btnTextDisabled = gray01
|
, btnTextDisabled = gray01
|
||||||
, btnMainFocusBorder = blue08
|
, btnMainFocusBorder = blue08
|
||||||
, btnMainBgBasic = blue05b
|
, btnMainBgBasic = btnColor
|
||||||
, btnMainBgHover = blue06
|
, btnMainBgHover = btnHiLite
|
||||||
, btnMainBgFocus = blue05c
|
, btnMainBgFocus = btnColor
|
||||||
, btnMainBgActive = blue05
|
, btnMainBgActive = btnHiLite
|
||||||
, btnMainBgDisabled = blue04
|
, btnMainBgDisabled = blue04
|
||||||
, btnMainText = white
|
, btnMainText = white
|
||||||
, btnMainTextDisabled = gray08
|
, btnMainTextDisabled = gray08
|
||||||
|
@ -149,10 +158,10 @@ zgoThemeColors =
|
||||||
, btnText = gray02
|
, btnText = gray02
|
||||||
, btnTextDisabled = gray02
|
, btnTextDisabled = gray02
|
||||||
, btnMainFocusBorder = blue09
|
, btnMainFocusBorder = blue09
|
||||||
, btnMainBgBasic = blue05b
|
, btnMainBgBasic = btnColor
|
||||||
, btnMainBgHover = blue06
|
, btnMainBgHover = btnHiLite
|
||||||
, btnMainBgFocus = blue05c
|
, btnMainBgFocus = btnColor
|
||||||
, btnMainBgActive = blue05
|
, btnMainBgActive = btnHiLite
|
||||||
, btnMainBgDisabled = blue04
|
, btnMainBgDisabled = blue04
|
||||||
, btnMainText = white
|
, btnMainText = white
|
||||||
, btnMainTextDisabled = white
|
, btnMainTextDisabled = white
|
||||||
|
@ -217,6 +226,10 @@ zgoThemeColors =
|
||||||
|
|
||||||
--black = rgbHex "#000000"
|
--black = rgbHex "#000000"
|
||||||
{-white = rgbHex "#FFFFFF"-}
|
{-white = rgbHex "#FFFFFF"-}
|
||||||
|
btnColor = rgbHex "#ff5722" --rgbHex "#1818B2"
|
||||||
|
|
||||||
|
btnHiLite = rgbHex "#207DE8"
|
||||||
|
|
||||||
blue01 = rgbHex "#002159"
|
blue01 = rgbHex "#002159"
|
||||||
|
|
||||||
blue02 = rgbHex "#01337D"
|
blue02 = rgbHex "#01337D"
|
||||||
|
|
|
@ -46,6 +46,7 @@ library
|
||||||
, base64-bytestring
|
, base64-bytestring
|
||||||
, brick
|
, brick
|
||||||
, bytestring
|
, bytestring
|
||||||
|
, data-default
|
||||||
, esqueleto
|
, esqueleto
|
||||||
, resource-pool
|
, resource-pool
|
||||||
, binary
|
, binary
|
||||||
|
|
Loading…
Reference in a new issue