Skip to content
Permalink
Browse files

Playground: Changing some input form handlers so they fire more respo…

…nsively.

My mistake - I had the wrong event type, so we only got changes when the
user tabbed out of the form field, not as soon as something was typed.
  • Loading branch information...
krisajenkins committed Mar 11, 2019
1 parent aaf0df5 commit 527c62e1ab372640f1135fec7ffb9558628816cc
Showing with 6 additions and 6 deletions.
  1. +4 −4 plutus-playground-client/src/Action.purs
  2. +2 −2 plutus-playground-client/src/Wallet.purs
@@ -16,7 +16,7 @@ import Halogen.Component (ParentHTML)
import Halogen.ECharts (EChartsEffects)
import Halogen.HTML (ClassName(ClassName), br_, button, code_, div, div_, form, h2_, h3_, input, label, p_, small_, text)
import Halogen.HTML.Elements.Keyed as Keyed
import Halogen.HTML.Events (input_, onClick, onValueChange)
import Halogen.HTML.Events (input_, onClick, onValueInput)
import Halogen.HTML.Events as HE
import Halogen.HTML.Properties (InputType(InputText, InputNumber), class_, classes, disabled, for, placeholder, required, type_, value)
import Halogen.Query as HQ
@@ -92,7 +92,7 @@ actionPane index action =
[ type_ InputNumber
, value $ show blocks
, placeholder "Int"
, onValueChange $ map (HQ.action <<< ModifyActions <<< SetWaitTime index) <<< Int.fromString
, onValueInput $ map (HQ.action <<< ModifyActions <<< SetWaitTime index) <<< Int.fromString
]
]
]
@@ -131,7 +131,7 @@ actionArgumentField context _ arg@(SimpleInt n) =
, value $ maybe "" show n
, required true
, placeholder "Int"
, onValueChange $ (Just <<< HQ.action <<< SetIntField <<< Int.fromString)
, onValueInput $ (Just <<< HQ.action <<< SetIntField <<< Int.fromString)
]
, validationFeedback (addPath context <$> validate arg)
]
@@ -143,7 +143,7 @@ actionArgumentField context _ arg@(SimpleString s) =
, value $ fromMaybe "" s
, required true
, placeholder "String"
, onValueChange $ HE.input SetStringField
, onValueInput $ HE.input SetStringField
]
, validationFeedback (addPath context <$> validate arg)
]
@@ -12,7 +12,7 @@ import Data.Tuple (Tuple(..))
import Halogen (HTML)
import Halogen.HTML (ClassName(ClassName), button, div, div_, h2_, h3_, h4_, input, p_, span, text)
import Halogen.HTML.Elements.Keyed as Keyed
import Halogen.HTML.Events (input_, onClick, onValueChange)
import Halogen.HTML.Events (input_, onClick, onValueInput)
import Halogen.HTML.Properties (InputType(..), class_, classes, placeholder, type_, value)
import Halogen.Query as HQ
import Icons (Icon(..), icon)
@@ -61,7 +61,7 @@ walletPane signatures index simulatorWallet =
[ type_ InputNumber
, value $ show $ view (_simulatorWalletBalance <<< _ada) simulatorWallet
, placeholder "Int"
, onValueChange $ map (HQ.action <<< SetBalance (view _simulatorWalletWallet simulatorWallet) <<< \v -> Ada {getAda: v}) <<< Int.fromString
, onValueInput $ map (HQ.action <<< SetBalance (view _simulatorWalletWallet simulatorWallet) <<< \v -> Ada {getAda: v}) <<< Int.fromString
]
]
]

0 comments on commit 527c62e

Please sign in to comment.
You can’t perform that action at this time.