Created
July 5, 2019 11:48
-
-
Save rizary/d1e618d7c201580a678f6b729411eae8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tagsMapDyn <- elClass "p" "tagging" $ mdo | |
| let evMapTags = Map.fromList . (fmap (\t -> (t,t))) . (fmap tagNToText) . V.toList <$> evPkgTags | |
| result <- foldDyn appEndo Map.empty $ fold | |
| [ Endo . const <$> evMapTags | |
| , (\nTag -> Endo $ Map.insert nTag nTag) <$> addTag0 | |
| , (foldMap (Endo . Map.delete) . Map.keys) <$> deleteTag0 | |
| ] | |
| deleteTag0 :: Event t (Map.Map T.Text T.Text) <- listViewWithKey result $ \tId _ -> do | |
| el "li" $ do | |
| el "span" $ text tId | |
| delEv <- rmTagButton_ tId pn | |
| pure $ tagNToText <$> delEv | |
| addTag0 <- elClass "form" "form" $ do | |
| el "p" $ text "Tag : " | |
| tagName <- textInput iCfg | |
| tagButton <- button_ "Add Tag" | |
| let tVal = _textInput_value tagName | |
| evAdd = (tagPromptlyDyn tVal tagButton) | |
| addTagN <- holdDyn "" evAdd | |
| addResult <- fmapMaybe reqSuccess <$> putV2PackageTags ((Right . TagN) <$> addTagN) (constDyn $ Right pn) (() <$ evAdd) | |
| pure $ tagPromptlyDyn tVal addResult | |
| pure () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment