Skip to content

Instantly share code, notes, and snippets.

@rizary
Created July 5, 2019 06:06
Show Gist options
  • Save rizary/4ce71ce84fbc34038e74fd35ad363bb5 to your computer and use it in GitHub Desktop.
Save rizary/4ce71ce84fbc34038e74fd35ad363bb5 to your computer and use it in GitHub Desktop.
tagsMapDyn <- elClass "p" "tagging" $ mdo
let evMapTags = Map.fromList . (fmap (\t -> (t,t))) . (fmap tagNToText) . V.toList <$> evPkgTags
result <- foldDyn Map.union Map.empty $ fold
[ evMapTags
, addTag0
, deleteTag0
]
deleteTag0 :: Event t (Map.Map T.Text T.Text) <- listViewWithKey result $ \tId tag' -> do
-- tagDyn <- holdUniqDyn tag'
el "li" $ do
el "span" $ text tId
rmTagButton_ tId pn
pure $ updated tag'
addTag0 <- elClass "form" "form" $ do
el "p" $ text "Tag : "
tagName <- textInput iCfg
tagButton <- button_ "Add Tag"
let evAdd = (tagPromptlyDyn (_textInput_value tagName) tagButton)
addTagN <- holdDyn "" evAdd
_ <- putV2PackageTags ((Right . TagN) <$> addTagN) (constDyn $ Right pn) (() <$ evAdd)
pure $ (\t -> Map.singleton t t) <$> evAdd
pure ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment