render the master password form
This commit is contained in:
parent
2b427789d2
commit
ffce0d6a1c
|
@ -4,7 +4,7 @@ cabal-version: 2.2
|
|||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: d742af1f90e36896cfb5979f267f1ef87b81fb7e603c8c72ccc0c8e7a382a408
|
||||
-- hash: 1fb75b25a67b68f60aa6fa054876daeef931fac289d7f62c2b455533ab282fba
|
||||
|
||||
name: passman
|
||||
version: 0.3.1.1
|
||||
|
@ -27,6 +27,7 @@ library
|
|||
exposed-modules:
|
||||
Password
|
||||
Password.App
|
||||
Password.App.Draw
|
||||
Password.App.Types
|
||||
other-modules:
|
||||
Paths_passman
|
||||
|
|
|
@ -28,29 +28,25 @@ import Brick
|
|||
( App (..)
|
||||
, BrickEvent
|
||||
, EventM
|
||||
, Widget
|
||||
, attrMap
|
||||
, emptyWidget
|
||||
, halt
|
||||
, neverShowCursor
|
||||
, showFirstCursor
|
||||
, style
|
||||
)
|
||||
|
||||
import Password.App.Draw
|
||||
import Password.App.Types
|
||||
|
||||
-- | The main application
|
||||
passmanApp :: App AppState () ResName
|
||||
passmanApp = App
|
||||
{ appDraw = drawFunc
|
||||
, appChooseCursor = neverShowCursor
|
||||
, appChooseCursor = showFirstCursor
|
||||
, appHandleEvent = eventHandler
|
||||
, appStartEvent = return ()
|
||||
, appAttrMap = const $ attrMap (style 0) []
|
||||
}
|
||||
|
||||
drawFunc :: AppState -> [Widget ResName]
|
||||
drawFunc = const [emptyWidget]
|
||||
|
||||
eventHandler :: BrickEvent ResName () -> EventM ResName AppState ()
|
||||
eventHandler = const halt
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
{-|
|
||||
|
||||
Module: Password.App.Draw
|
||||
Description: widget drawing functions
|
||||
Copyright: (C) Jonathan Lamothe
|
||||
License: LGPLv3 (or later)
|
||||
Maintainer: jonathan@jlamothe.net
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program. If not, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
-}
|
||||
|
||||
module Password.App.Draw (drawFunc) where
|
||||
|
||||
import Brick (Widget, txt, vBox)
|
||||
import Brick.Forms (renderForm)
|
||||
import Lens.Micro ((^.))
|
||||
|
||||
import Password.App.Types
|
||||
|
||||
-- | Renders the application view
|
||||
drawFunc :: AppState -> [Widget ResName]
|
||||
drawFunc s = case s^.appMode of
|
||||
InitMode is -> drawPassForm is
|
||||
|
||||
drawPassForm :: InitState -> [Widget ResName]
|
||||
drawPassForm is =
|
||||
[ vBox
|
||||
[ renderForm $ is^.setPassForm
|
||||
, txt $ is^.spfError
|
||||
]
|
||||
]
|
||||
|
||||
--jl
|
Loading…
Reference in New Issue
Block a user