Commit 6cb50a8c authored by James Laver's avatar James Laver Committed by Alexandre Delanoë

fix up basic AnnotatedRun

parent d98240bc
...@@ -40,22 +40,22 @@ newtype Run = Run { text :: String, list :: Maybe TermList } -- lists :: Array T ...@@ -40,22 +40,22 @@ newtype Run = Run { text :: String, list :: Maybe TermList } -- lists :: Array T
-- TODO: Context Menu -- TODO: Context Menu
-- | A Blank Run is not part an n-gram, but it does have a context menu -- | A Blank Run is not part an n-gram, but it does have a context menu
renderBlank :: Run -> ReactElement renderBlank :: String -> ReactElement
renderBlank = wrap $ span [className "run run-blank"] <<< text renderBlank = (wrap $ span [className "run run-blank"]) <<< text
-- TODO: Context Menu -- TODO: Context Menu
renderHilite :: Run -> ReactElement renderHilite :: String -> TermList -> ReactElement
renderHilite r = span [className "run run-pretty", title tooltip] [text r.text] renderHilite txt list = span [className "run run-pretty", title tooltip] [text txt]
-- (wrap wrapping) $ foldl wrapColour head r.lists -- (wrap wrapping) $ foldl wrapColour head r.lists
where tooltip = "Occurs in the " <> termListName r.list where tooltip = "Occurs in the " <> termListName list
-- lists = names r.lists -- lists = names r.lists
-- head = span [className "run run-pretty", title (tooltip lists)] [text r.text] -- head = span [className "run run-pretty", title (tooltip lists)] [text r.text]
-- wrapping = span [className "run run-pretty"] -- wrapping = span [className "run run-pretty"]
render :: Run -> ReactElement render :: Run -> ReactElement
render r render (Run r)
| r.lists == [] = renderBlank r.text | Just l <- r.list = renderHilite r.text l
| otherwise = renderHilite r | otherwise = renderBlank r.text
data Action = AddTerm Term | RemoveTerm Term data Action = AddTerm Term | RemoveTerm Term
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment