{-# LANGUAGE CPP #-}{-# LANGUAGE DataKinds #-}{-# LANGUAGE FlexibleContexts #-}{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE RankNTypes #-}{-# OPTIONS_GHC -Wno-unused-record-wildcards #-}{-# OPTIONS_GHC -Wno-unused-matches #-}{-# LANGUAGE FlexibleInstances #-}{-# LANGUAGE MultiParamTypeClasses #-}{-A very simple information-only widget with no handler.-}module GHCup.Brick.Widgets.KeyInfo whereimport GHCup.Types ( KeyBindings(..) )import qualified GHCup.Brick.Common as Commonimport Brick ( Padding(Max), Widget(..), (<+>), (<=>))import qualified Brickimport Brick.Widgets.Center ( center )import Prelude hiding ( appendFile )draw :: KeyBindings -> Widget Common.Namedraw KeyBindings {..} = let mkTextBox = Brick.hLimitPercent 70 . Brick.vBox . fmap (Brick.padRight Brick.Max) in Common.frontwardLayer "Key Actions" $ Brick.vBox [ center $ mkTextBox [ Brick.hBox [ Brick.txt "Press " , Common.keyToWidget bUp, Brick.txt " and ", Common.keyToWidget bDown , Brick.txtWrap " to select an element in the currently focused list (tools or versions)" ], Brick.hBox [ Brick.txt "Press " , Common.keyToWidget bLeft , Brick.txt " and " , Common.keyToWidget bRight , Brick.txt " or " , Common.keyToWidget bTab , Brick.txtWrap " to switch between tool and version list" ] , Brick.hBox [ Brick.txt "Press " , Common.keyToWidget bInstall , Brick.txtWrap " to install the selected tool. Notice, you may need to set it as default afterwards" ] , Brick.hBox [ Brick.txt "Press " , Common.keyToWidget bSet , Brick.txtWrap " to set a tool as the one for use" ] , Brick.hBox [ Brick.txt "Press " , Common.keyToWidget bUninstall , Brick.txtWrap " to uninstall a tool" ] , Brick.hBox [ Brick.txt "Press " , Common.keyToWidget bChangelog , Brick.txtWrap " to open the tool's changelog. It will open a web browser" ] , Brick.hBox [ Brick.txt "Press " , Common.keyToWidget bShowAllVersions , Brick.txtWrap " to show older version of each tool" ] ] ] <=> Brick.hBox [Brick.txt "Press " <+> Common.keyToWidget bQuit <+> Brick.txt " to return to Navigation" <+> Brick.padRight Brick.Max (Brick.txt " ") <+> Brick.txt "Press Enter to go to the Tutorial"]