Skip to content

Commit

Permalink
Merge pull request #1127 from input-output-hk/lc/fix-tui-contestation…
Browse files Browse the repository at this point in the history
…-deadline

fix tui contestation deadline
  • Loading branch information
locallycompact authored Oct 18, 2023
2 parents d700a98 + fe83812 commit e6f2504
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hydra-tui/src/Hydra/TUI/Drawing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ drawRemainingContestationPeriod :: UTCTime -> UTCTime -> Widget Name
drawRemainingContestationPeriod deadline now =
let remaining = diffUTCTime deadline now
in if remaining > 0
then padLeftRight 1 $ txt "Remaining time to contest: " <+> str (renderTime remaining)
then padLeftRight 1 $ vBox [txt "Remaining time to contest: ", str (renderTime remaining)]
else txt "Contestation period passed, ready to fan out soon."

drawTotalCommitted :: UTxO -> Widget n
Expand Down
6 changes: 6 additions & 0 deletions hydra-tui/src/Hydra/TUI/Handlers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,18 @@ handleEvent ::
EventM Name RootState ()
handleEvent cardanoClient client e = do
handleGlobalEvents e
handleAppEventVia handleTick () e
zoom connectedStateL $ do
handleAppEventVia handleHydraEventsConnectedState () e
zoom connectionL $ handleBrickEventsConnection cardanoClient client e
zoom (logStateL . logMessagesL) $
handleAppEventVia handleHydraEventsInfo () e

handleTick :: HydraEvent Tx -> EventM Name RootState ()
handleTick = \case
Tick now -> nowL .= now
_ -> pure ()

handleAppEventVia :: (e -> EventM n s a) -> a -> BrickEvent w e -> EventM n s a
handleAppEventVia f x = \case
AppEvent e -> f e
Expand Down
2 changes: 1 addition & 1 deletion hydra-tui/test/Hydra/TUISpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ withTUITest region action = do
as <- newIORef initialAssumedState
-- NOTE(SN): The null device should allow using this in CI, while we do
-- capture the output via `outputByteBuffer` anyway.
nullFd <- openFd "/dev/null" WriteOnly Nothing defaultFileFlags
nullFd <- openFd "/dev/null" WriteOnly defaultFileFlags
realOut <- outputForConfig $ defaultConfig{outputFd = Just nullFd, termName = Just "xterm"}
closeFd nullFd
let output = testOut realOut as frameBuffer
Expand Down

0 comments on commit e6f2504

Please sign in to comment.