Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/1152'
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Dec 5, 2024
2 parents 6477a30 + a18a9cd commit 93dd3b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
28 changes: 12 additions & 16 deletions lib-tui/GHCup/Brick/Common.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
Expand Down Expand Up @@ -27,6 +26,7 @@ module GHCup.Brick.Common (
installedSign,
setSign,
notInstalledSign,
checkBoxSelectedSign,
showKey,
showMod,
keyToWidget,
Expand All @@ -52,6 +52,7 @@ module GHCup.Brick.Common (
) ) where

import GHCup.List ( ListResult )
import GHCup.Prelude ( isWindows )
import GHCup.Types ( Tool, KeyCombination (KeyCombination) )
import Data.List (intercalate)
import Prelude hiding ( appendFile )
Expand Down Expand Up @@ -160,25 +161,20 @@ data Mode = Navigation
deriving (Eq, Show, Ord)

installedSign :: String
#if IS_WINDOWS
installedSign = "I "
#else
installedSign = ""
#endif
| isWindows = "I "
| otherwise = ""

setSign :: String
#if IS_WINDOWS
setSign = "IS"
#else
setSign = "✔✔"
#endif
| isWindows = "IS"
| otherwise = "✔✔"

notInstalledSign :: String
#if IS_WINDOWS
notInstalledSign = "X "
#else
notInstalledSign = ""
#endif
| isWindows = "X "
| otherwise = ""

checkBoxSelectedSign :: String
| isWindows = "Y "
| otherwise = ""


showKey :: Vty.Key -> String
Expand Down
2 changes: 1 addition & 1 deletion lib-tui/GHCup/Brick/Widgets/Menu.hs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ createCheckBoxInput = FieldInput False Right "" checkBoxRender checkBoxHandler
border w = Brick.txt "[" <+> (Brick.padRight (Brick.Pad 1) $ Brick.padLeft (Brick.Pad 2) w) <+> Brick.txt "]"
drawBool b =
if b
then border . Brick.withAttr Attributes.installedAttr $ Brick.str Common.installedSign
then border . Brick.withAttr Attributes.installedAttr $ Brick.str Common.checkBoxSelectedSign
else border . Brick.withAttr Attributes.notInstalledAttr $ Brick.str Common.notInstalledSign
checkBoxRender focus _ help _ check f = (, Nothing) $
let core = f $ drawBool check
Expand Down

0 comments on commit 93dd3b9

Please sign in to comment.