Skip to content

Commit e6f2504

Browse files
Merge pull request #1127 from input-output-hk/lc/fix-tui-contestation-deadline
fix tui contestation deadline
2 parents d700a98 + fe83812 commit e6f2504

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

hydra-tui/src/Hydra/TUI/Drawing.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ drawRemainingContestationPeriod :: UTCTime -> UTCTime -> Widget Name
133133
drawRemainingContestationPeriod deadline now =
134134
let remaining = diffUTCTime deadline now
135135
in if remaining > 0
136-
then padLeftRight 1 $ txt "Remaining time to contest: " <+> str (renderTime remaining)
136+
then padLeftRight 1 $ vBox [txt "Remaining time to contest: ", str (renderTime remaining)]
137137
else txt "Contestation period passed, ready to fan out soon."
138138

139139
drawTotalCommitted :: UTxO -> Widget n

hydra-tui/src/Hydra/TUI/Handlers.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,18 @@ handleEvent ::
4545
EventM Name RootState ()
4646
handleEvent cardanoClient client e = do
4747
handleGlobalEvents e
48+
handleAppEventVia handleTick () e
4849
zoom connectedStateL $ do
4950
handleAppEventVia handleHydraEventsConnectedState () e
5051
zoom connectionL $ handleBrickEventsConnection cardanoClient client e
5152
zoom (logStateL . logMessagesL) $
5253
handleAppEventVia handleHydraEventsInfo () e
5354

55+
handleTick :: HydraEvent Tx -> EventM Name RootState ()
56+
handleTick = \case
57+
Tick now -> nowL .= now
58+
_ -> pure ()
59+
5460
handleAppEventVia :: (e -> EventM n s a) -> a -> BrickEvent w e -> EventM n s a
5561
handleAppEventVia f x = \case
5662
AppEvent e -> f e

hydra-tui/test/Hydra/TUISpec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ withTUITest region action = do
271271
as <- newIORef initialAssumedState
272272
-- NOTE(SN): The null device should allow using this in CI, while we do
273273
-- capture the output via `outputByteBuffer` anyway.
274-
nullFd <- openFd "/dev/null" WriteOnly Nothing defaultFileFlags
274+
nullFd <- openFd "/dev/null" WriteOnly defaultFileFlags
275275
realOut <- outputForConfig $ defaultConfig{outputFd = Just nullFd, termName = Just "xterm"}
276276
closeFd nullFd
277277
let output = testOut realOut as frameBuffer

0 commit comments

Comments
 (0)