aboutsummaryrefslogtreecommitdiff
path: root/client/src/Component
diff options
context:
space:
mode:
authorJoris2019-08-07 21:27:59 +0200
committerJoris2019-08-07 21:27:59 +0200
commitfc8be14dd0089eb12b78af7aaaecd8ed57896677 (patch)
tree22bcd64c7ef3f21aa067ca81824f0e0a2ce6b631 /client/src/Component
parentbc81084933f8ec1bfe6c2834defd12243117fdd9 (diff)
Update category according to payment in add overlay
Diffstat (limited to 'client/src/Component')
-rw-r--r--client/src/Component/Select.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/client/src/Component/Select.hs b/client/src/Component/Select.hs
index 9f671d3..43a8a6e 100644
--- a/client/src/Component/Select.hs
+++ b/client/src/Component/Select.hs
@@ -16,6 +16,7 @@ import qualified Common.Msg as Msg
data (Reflex t) => SelectIn t a b c = SelectIn
{ _selectIn_label :: Text
, _selectIn_initialValue :: a
+ , _selectIn_value :: Event t a
, _selectIn_values :: Dynamic t (Map a Text)
, _selectIn_reset :: Event t b
, _selectIn_isValid :: a -> Bool
@@ -48,11 +49,16 @@ select selectIn = do
let initialValue = _selectIn_initialValue selectIn
+ let setValue = R.leftmost
+ [ const initialValue <$> (_selectIn_reset selectIn)
+ , _selectIn_value selectIn
+ ]
+
value <- R._dropdown_value <$>
R.dropdown
initialValue
(_selectIn_values selectIn)
- (R.def { R._dropdownConfig_setValue = fmap (const initialValue) (_selectIn_reset selectIn) })
+ (R.def { R._dropdownConfig_setValue = setValue })
errorMessage <- R.holdDyn "" $ R.attachWith
(\v _ -> if (_selectIn_isValid selectIn) v then "" else "ERROR!")