module Matterhorn.Events.ReactionEmojiListWindow
( onEventReactionEmojiListWindow
, reactionEmojiListWindowKeybindings
, reactionEmojiListWindowKeyHandlers
)
where
import Prelude ()
import Matterhorn.Prelude
import Brick.Keybindings
import qualified Graphics.Vty as Vty
import Network.Mattermost.Types ( TeamId )
import Matterhorn.State.ReactionEmojiListWindow
import Matterhorn.State.ListWindow
import Matterhorn.Types
onEventReactionEmojiListWindow :: TeamId -> Vty.Event -> MH ()
onEventReactionEmojiListWindow :: TeamId -> Event -> MH ()
onEventReactionEmojiListWindow TeamId
tId =
forall (f :: * -> *) a. Functor f => f a -> f ()
void forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b.
Lens' ChatState (ListWindowState a b)
-> (KeyConfig KeyEvent -> KeyDispatcher KeyEvent MH)
-> Event
-> MH Bool
onEventListWindow (TeamId -> Lens' ChatState TeamState
csTeam(TeamId
tId)forall b c a. (b -> c) -> (a -> b) -> a -> c
.Lens' TeamState (ListWindowState (Bool, Text) ())
tsReactionEmojiListWindow)
(TeamId -> KeyConfig KeyEvent -> KeyDispatcher KeyEvent MH
reactionEmojiListWindowKeybindings TeamId
tId)
reactionEmojiListWindowKeybindings :: TeamId -> KeyConfig KeyEvent -> KeyDispatcher KeyEvent MH
reactionEmojiListWindowKeybindings :: TeamId -> KeyConfig KeyEvent -> KeyDispatcher KeyEvent MH
reactionEmojiListWindowKeybindings TeamId
tId KeyConfig KeyEvent
kc = forall k (m :: * -> *).
Ord k =>
KeyConfig k -> [KeyEventHandler k m] -> KeyDispatcher k m
unsafeKeyDispatcher KeyConfig KeyEvent
kc (TeamId -> [MHKeyEventHandler]
reactionEmojiListWindowKeyHandlers TeamId
tId)
reactionEmojiListWindowKeyHandlers :: TeamId -> [MHKeyEventHandler]
reactionEmojiListWindowKeyHandlers :: TeamId -> [MHKeyEventHandler]
reactionEmojiListWindowKeyHandlers TeamId
tId =
[ forall k (m :: * -> *). k -> Text -> m () -> KeyEventHandler k m
onEvent KeyEvent
CancelEvent Text
"Close the emoji search window"
(forall a b.
TeamId -> Lens' ChatState (ListWindowState a b) -> MH ()
exitListWindow TeamId
tId (TeamId -> Lens' ChatState TeamState
csTeam(TeamId
tId)forall b c a. (b -> c) -> (a -> b) -> a -> c
.Lens' TeamState (ListWindowState (Bool, Text) ())
tsReactionEmojiListWindow))
, forall k (m :: * -> *). k -> Text -> m () -> KeyEventHandler k m
onEvent KeyEvent
SearchSelectUpEvent Text
"Select the previous emoji" forall a b. (a -> b) -> a -> b
$
TeamId -> MH ()
reactionEmojiListSelectUp TeamId
tId
, forall k (m :: * -> *). k -> Text -> m () -> KeyEventHandler k m
onEvent KeyEvent
SearchSelectDownEvent Text
"Select the next emoji" forall a b. (a -> b) -> a -> b
$
TeamId -> MH ()
reactionEmojiListSelectDown TeamId
tId
, forall k (m :: * -> *). k -> Text -> m () -> KeyEventHandler k m
onEvent KeyEvent
PageDownEvent Text
"Page down in the emoji list" forall a b. (a -> b) -> a -> b
$
TeamId -> MH ()
reactionEmojiListPageDown TeamId
tId
, forall k (m :: * -> *). k -> Text -> m () -> KeyEventHandler k m
onEvent KeyEvent
PageUpEvent Text
"Page up in the emoji list" forall a b. (a -> b) -> a -> b
$
TeamId -> MH ()
reactionEmojiListPageUp TeamId
tId
, forall k (m :: * -> *). k -> Text -> m () -> KeyEventHandler k m
onEvent KeyEvent
ActivateListItemEvent Text
"Post the selected emoji reaction"
(forall a b.
TeamId -> Lens' ChatState (ListWindowState a b) -> MH ()
listWindowActivateCurrent TeamId
tId (TeamId -> Lens' ChatState TeamState
csTeam(TeamId
tId)forall b c a. (b -> c) -> (a -> b) -> a -> c
.Lens' TeamState (ListWindowState (Bool, Text) ())
tsReactionEmojiListWindow))
]