[ngrams] child in group is clickable now

parent 34e6dd6a
...@@ -902,7 +902,7 @@ ngramsTreeEditRealCpt = here.component "ngramsTreeEditReal" cpt where ...@@ -902,7 +902,7 @@ ngramsTreeEditRealCpt = here.component "ngramsTreeEditReal" cpt where
-- | Computed -- | Computed
-- | -- |
let let
ngramsDepth = { depth: 0, ngrams: ngramsParent' } ngramsDepth = { depth: 0, ngrams: ngramsParent', parent: Nothing }
ngramsChildrenPatched :: Set NgramsTerm ngramsChildrenPatched :: Set NgramsTerm
ngramsChildrenPatched = applyPatchSet (patchSetFromMap ngramsChildrenDiff) $ Set.fromFoldable ngramsChildren ngramsChildrenPatched = applyPatchSet (patchSetFromMap ngramsChildrenDiff) $ Set.fromFoldable ngramsChildren
......
...@@ -225,7 +225,7 @@ treeLoadedCpt = here.component "treeLoaded" cpt where ...@@ -225,7 +225,7 @@ treeLoadedCpt = here.component "treeLoaded" cpt where
if depth > 10 then if depth > 10 then
const $ H.text "ERROR DEPTH > 10" const $ H.text "ERROR DEPTH > 10"
else else
H.ul {} <<< map (\ngrams -> tree ((Record.delete (Proxy :: Proxy "ngramsChildren") params) { ngramsDepth = {depth, ngrams} })) <<< L.toUnfoldable H.ul {} <<< map (\ngrams -> tree ((Record.delete (Proxy :: Proxy "ngramsChildren") params) { ngramsDepth = {depth, ngrams, parent: Just ngramsDepth.ngrams} })) <<< L.toUnfoldable
type RenderNgramsItem = type RenderNgramsItem =
( boxes :: Boxes ( boxes :: Boxes
...@@ -318,7 +318,7 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt ...@@ -318,7 +318,7 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
) )
] ]
where where
ngramsDepth = { ngrams, depth: 0 } ngramsDepth = { ngrams, depth: 0, parent: Nothing }
tag = tag =
case ngramsClick ngramsDepth of case ngramsClick ngramsDepth of
Just effect -> Just effect ->
...@@ -346,14 +346,14 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt ...@@ -346,14 +346,14 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
getNgramsChildren' n = A.fromFoldable $ ngramsChildren n getNgramsChildren' n = A.fromFoldable $ ngramsChildren n
ngramsChildren :: NgramsTerm -> List NgramsTerm ngramsChildren :: NgramsTerm -> List NgramsTerm
ngramsChildren n = tbl ^.. ix n <<< _NgramsRepoElement <<< _children <<< folded ngramsChildren n = tbl ^.. ix n <<< _NgramsRepoElement <<< _children <<< folded
ngramsClick :: { depth :: Int, ngrams :: NgramsTerm } -> Maybe (Effect Unit) ngramsClick :: NgramsClick
ngramsClick p = Just $ do ngramsClick p@{ depth: 0 } = Just $ do
-- here.log2 "[ngramsClick] p" p
if p.depth == 0 then
(dispatch <<< CoreAction <<< cycleTermListItem <<< view _ngrams) p (dispatch <<< CoreAction <<< cycleTermListItem <<< view _ngrams) p
-- traverse_ (dispatch <<< CoreAction <<< cycleTermListItem) (A.cons p.ngrams $ getNgramsChildren' p.ngrams) -- traverse_ (dispatch <<< CoreAction <<< cycleTermListItem) (A.cons p.ngrams $ getNgramsChildren' p.ngrams)
else ngramsClick p@{ parent: Nothing } = Just $ do
pure unit here.log2 "[renderNgramsItem] unexpected empty parent for ngrams depth" p
ngramsClick p@{ parent: Just p' } = Just $ do
(dispatch <<< CoreAction <<< cycleTermListItem) p'
-- ^ This is the old behavior it is nicer to use since one can -- ^ This is the old behavior it is nicer to use since one can
-- rapidly change the ngram list without waiting for confirmation. -- rapidly change the ngram list without waiting for confirmation.
-- However this might expose bugs. One of them can be reproduced -- However this might expose bugs. One of them can be reproduced
......
...@@ -545,7 +545,9 @@ type CoreDispatch = CoreAction -> Effect Unit ...@@ -545,7 +545,9 @@ type CoreDispatch = CoreAction -> Effect Unit
type Dispatch = Action -> Effect Unit type Dispatch = Action -> Effect Unit
type NgramsDepth = { ngrams :: NgramsTerm, depth :: Int } type NgramsDepth = { ngrams :: NgramsTerm
, depth :: Int
, parent :: Maybe NgramsTerm }
type NgramsClick = NgramsDepth -> Maybe (Effect Unit) type NgramsClick = NgramsDepth -> Maybe (Effect Unit)
type NgramsActionRef = R.Ref (Maybe (Unit -> Effect Unit)) type NgramsActionRef = R.Ref (Maybe (Unit -> Effect Unit))
......
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