diff --git a/src/Gargantext/Components/Forest/Tree/Node/Action/Search/Types.purs b/src/Gargantext/Components/Forest/Tree/Node/Action/Search/Types.purs index 8b73905d277f99e0efc4b30a31dfbfd3d0eaaa50..6aef48403aaada6644f860344c5f668f3de27eea 100644 --- a/src/Gargantext/Components/Forest/Tree/Node/Action/Search/Types.purs +++ b/src/Gargantext/Components/Forest/Tree/Node/Action/Search/Types.purs @@ -46,8 +46,8 @@ class Doc a where dataFields :: Array DataField dataFields = [ Gargantext - , Web , External Nothing + , Web -- , Files ] @@ -59,8 +59,8 @@ data DataField = Gargantext instance showDataField :: Show DataField where show Gargantext = "Gargantext" - show (External _) = "Others" -- <> show x - show Web = "Web" + show (External _) = "Databases (APIs)" -- <> show x + show Web = "Soon: web" show Files = "Files" instance docDataField :: Doc DataField where diff --git a/src/Gargantext/Components/NgramsTable/Components.purs b/src/Gargantext/Components/NgramsTable/Components.purs index f2b25c4984c57d01681dc3fa0ef5a5bb8e0c07c8..b84a149bac185777f533b2b31a96957c1ff01dec 100644 --- a/src/Gargantext/Components/NgramsTable/Components.purs +++ b/src/Gargantext/Components/NgramsTable/Components.purs @@ -115,7 +115,7 @@ renderNgramsTree p = R.createElement renderNgramsTreeCpt p [] renderNgramsTreeCpt :: R.Component RenderNgramsTree renderNgramsTreeCpt = R.hooksComponentWithModule thisModule "renderNgramsTree" cpt where - cpt { ngramsTable, ngrams, ngramsStyle, ngramsClick, ngramsEdit } _ = + cpt { ngramsTable, ngrams, ngramsStyle, ngramsClick, ngramsEdit} _ = pure $ H.ul {} [ H.span { className: "tree" } [ H.span { className: "righthanded" } [ @@ -133,12 +133,26 @@ renderNgramsTreeCpt = R.hooksComponentWithModule thisModule "renderNgramsTree" c type NgramsDepth = {ngrams :: NgramsTerm, depth :: Int} type NgramsClick = NgramsDepth -> Maybe (Effect Unit) -type TreeProps = +type TagProps = ( ngramsClick :: NgramsClick , ngramsDepth :: NgramsDepth - , ngramsEdit :: NgramsClick , ngramsStyle :: Array DOM.Props + ) + +{- TODO refactor here +-- tag :: TagProps -> Array R.Element -> R.Element +tag tagProps = + case tagProps.ngramsClick tagProps.ngramsDepth of + Just effect -> + a (tagProps.ngramsStyle <> [DOM.onClick $ const effect]) + Nothing -> + span tagProps.ngramsStyle +-} + +type TreeProps = + ( ngramsEdit :: NgramsClick , ngramsTable :: NgramsTable + | TagProps ) tree :: Record TreeProps -> R.Element @@ -153,7 +167,8 @@ treeCpt = R.hooksComponentWithModule thisModule "tree" cpt ([ H.i { className, style } [] ] <> [ R2.buff $ tag [ text $ " " <> ngramsTermText ngramsDepth.ngrams ] ] <> maybe [] edit (ngramsEdit ngramsDepth) - <> [ forest cs ]) + <> [ forest cs ] + ) where tag = case ngramsClick ngramsDepth of @@ -214,18 +229,23 @@ renderNgramsItemCpt = R.hooksComponentWithModule thisModule "renderNgramsItem" c , selected , checkbox T.MapTerm , checkbox T.StopTerm - , H.div {} [ - if ngramsParent == Nothing - then renderNgramsTree { ngramsTable, ngrams, ngramsStyle, ngramsClick, ngramsEdit } - else - H.a { on: { click: const $ dispatch $ ToggleChild true ngrams } } [ - H.i { className: "fa fa-plus" } [] - , (R2.buff $ span ngramsStyle [text $ " " <> ngramsTermText ngrams]) - ] - ] + , H.div {} ( if ngramsParent == Nothing + then [renderNgramsTree { ngramsTable, ngrams, ngramsStyle, ngramsClick, ngramsEdit }] + else [H.a { on: { click: const $ dispatch $ ToggleChild true ngrams } } + [ H.i { className: "glyphicon glyphicon-plus" } []] + , R2.buff $ tag [ text $ " " <> ngramsTermText ngramsDepth.ngrams ] + ] + ) , H.text $ show (ngramsElement ^. _NgramsElement <<< _occurrences) ] where + ngramsDepth= {ngrams, depth: 0 } + tag = + case ngramsClick ngramsDepth of + Just effect -> + a (ngramsStyle <> [DOM.onClick $ const effect]) + Nothing -> + span ngramsStyle onClick _ = do R2.callTrigger toggleSidePanel unit termList = ngramsElement ^. _NgramsElement <<< _list diff --git a/src/Gargantext/Components/Nodes/Corpus.purs b/src/Gargantext/Components/Nodes/Corpus.purs index e5569ff9cbd1811ec35f881971097c72f478067c..c492722f66f924e74a31da9ef81e780e36dc02a6 100644 --- a/src/Gargantext/Components/Nodes/Corpus.purs +++ b/src/Gargantext/Components/Nodes/Corpus.purs @@ -313,7 +313,7 @@ renameableTextCpt = R.hooksComponentWithModule thisModule "renameableTextCpt" cp cpt {isEditing: (true /\ setIsEditing), onRename, state: (text /\ setText)} _ = do pure $ H.div { className: "input-group" } [ inputWithEnter { - autoFocus: false + autoFocus: false , autoSave: false , className: "form-control text" , defaultValue: text