Skip to content

Commit

Permalink
Restyled by fourmolu (#1517)
Browse files Browse the repository at this point in the history
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
restyled-io[bot] and restyled-commits authored Sep 11, 2023
1 parent f0ea55b commit 428b9a4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
58 changes: 29 additions & 29 deletions src/Swarm/TUI/Launch/Controller.hs
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ handleLaunchOptionsEvent siPair = \case
e <- use $ uiState . uiLaunchConfig . editingParams
uiState . uiLaunchConfig . editingParams
.= ( e
{ initialCode =
maybe
(Left $ T.pack "No solution.")
(Right . Just . CodeToRun ScenarioSuggested)
solution
}
{ initialCode =
maybe
(Left $ T.pack "No solution.")
(Right . Just . CodeToRun ScenarioSuggested)
solution
}
)
_ -> return ()
Key V.KEsc -> closeModal
Expand All @@ -165,28 +165,28 @@ handleLaunchOptionsEvent siPair = \case
Brick.zoom (controls . seedValueEditor) (handleEditorEvent ev)
cacheValidatedSeedInput
_ -> return ()
where
activateControl = do
fr <- use $ uiState . uiLaunchConfig . controls . scenarioConfigFocusRing
case focusGetCurrent fr of
Just (ScenarioConfigControl (ScenarioConfigPanelControl item)) ->
activateFocusedControl item
_ -> return ()
where
activateControl = do
fr <- use $ uiState . uiLaunchConfig . controls . scenarioConfigFocusRing
case focusGetCurrent fr of
Just (ScenarioConfigControl (ScenarioConfigPanelControl item)) ->
activateFocusedControl item
_ -> return ()

activateFocusedControl item = case item of
SeedSelector -> return ()
AutoPlaySelector ->
uiState . uiLaunchConfig . controls . autoPlayCheck %= not
ScriptSelector -> Brick.zoom (uiState . uiLaunchConfig . controls . fileBrowser) $ do
maybeSingleFile <- use maybeSelectedFile
configuredFB <- initFileBrowserWidget maybeSingleFile
fbWidget .= configuredFB
fbIsDisplayed .= True
StartGameButton -> do
params <- use $ uiState . uiLaunchConfig . editingParams
let eitherLaunchParams = toValidatedParams params
forM_ eitherLaunchParams $ \launchParams -> do
closeModal
startGameWithSeed siPair launchParams
activateFocusedControl item = case item of
SeedSelector -> return ()
AutoPlaySelector ->
uiState . uiLaunchConfig . controls . autoPlayCheck %= not
ScriptSelector -> Brick.zoom (uiState . uiLaunchConfig . controls . fileBrowser) $ do
maybeSingleFile <- use maybeSelectedFile
configuredFB <- initFileBrowserWidget maybeSingleFile
fbWidget .= configuredFB
fbIsDisplayed .= True
StartGameButton -> do
params <- use $ uiState . uiLaunchConfig . editingParams
let eitherLaunchParams = toValidatedParams params
forM_ eitherLaunchParams $ \launchParams -> do
closeModal
startGameWithSeed siPair launchParams

closeModal = uiState . uiLaunchConfig . controls . isDisplayedFor .= Nothing
closeModal = uiState . uiLaunchConfig . controls . isDisplayedFor .= Nothing
2 changes: 1 addition & 1 deletion src/Swarm/TUI/Launch/Prep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ parseWidgetParams :: LaunchControls -> IO EditingLaunchParams
parseWidgetParams (LaunchControls _autoPlay (FileBrowserControl _fb maybeSelectedScript _) seedEditor _ _) = do
eitherParsedCode <-
runThrow . withThrow (prettyText @SystemFailure) $
traverse parseCodeFile maybeSelectedScript
traverse parseCodeFile maybeSelectedScript
return $ LaunchParams eitherMaybeSeed eitherParsedCode
where
eitherMaybeSeed = parseSeedInput seedEditor
Expand Down

0 comments on commit 428b9a4

Please sign in to comment.