diff --git a/lib-tui/GHCup/Brick/Common.hs b/lib-tui/GHCup/Brick/Common.hs index fe04f3b3..4ef82c67 100644 --- a/lib-tui/GHCup/Brick/Common.hs +++ b/lib-tui/GHCup/Brick/Common.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} @@ -27,6 +26,7 @@ module GHCup.Brick.Common ( installedSign, setSign, notInstalledSign, + checkBoxSelectedSign, showKey, showMod, keyToWidget, @@ -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 ) @@ -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 diff --git a/lib-tui/GHCup/Brick/Widgets/Menu.hs b/lib-tui/GHCup/Brick/Widgets/Menu.hs index 289d2c89..9c5289af 100644 --- a/lib-tui/GHCup/Brick/Widgets/Menu.hs +++ b/lib-tui/GHCup/Brick/Widgets/Menu.hs @@ -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