Skip to content

Commit

Permalink
Merge pull request #1025 from input-output-hk/fix-tui-dialogs
Browse files Browse the repository at this point in the history
Fix dialog lens in hydra-tui
  • Loading branch information
ch1bo authored Aug 17, 2023
2 parents 62a1afc + 62e2241 commit 54db226
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ changes.
- Created `hydra-plutus-extras` package to re-use some utilities better between
packages.

- Fixed a bug in the `hydra-tui` dialogs where recipient and UTxO to spend where
not correctly selected.

## [0.11.0] - 2023-06-30

This release contains breaking changes of the persistence and on-chain scripts
Expand Down
2 changes: 1 addition & 1 deletion hydra-tui/hydra-tui.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: hydra-tui
version: 0.11.0
version: 0.12.0
synopsis: TUI for managing a Hydra node
description: TUI for managing a Hydra node
author: IOG
Expand Down
9 changes: 3 additions & 6 deletions hydra-tui/src/Hydra/TUI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,7 @@ handleNewTxEvent Client{sendInput, sk} CardanoClient{networkId} s = case s ^? he
where
title = "Select a recipient"
form =
let field =
radioField
(lens id const)
[(u, show u, decodeUtf8 $ encodePretty u) | u <- nub addresses]
let field = radioField id [(u, show u, decodeUtf8 $ encodePretty u) | u <- nub addresses]
addresses = getRecipientAddress <$> Map.elems utxo
getRecipientAddress TxOut{txOutAddress = addr} = addr
in newForm [field] (Prelude.head addresses)
Expand All @@ -512,7 +509,7 @@ handleNewTxEvent Client{sendInput, sk} CardanoClient{networkId} s = case s ^? he

form =
-- NOTE(SN): use 'Integer' because we don't have a 'Read Lovelace'
let field = editShowableFieldWithValidate (lens id (\_ newValue -> newValue)) "amount" (\n -> n > 0 && n <= limit)
let field = editShowableFieldWithValidate id "amount" (\n -> n > 0 && n <= limit)
in newForm [field] limit

submit s' amount = do
Expand Down Expand Up @@ -841,7 +838,7 @@ utxoRadioField ::
[s -> FormFieldState s e n]
utxoRadioField u =
[ radioField
(lens id const)
id
[ (i, show i, UTxO.render i)
| i <- Map.toList u
]
Expand Down

0 comments on commit 54db226

Please sign in to comment.