Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
6ff0feb6
Commit
6ff0feb6
authored
Mar 27, 2024
by
Fabien Manière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
when the tree is drawn, open the nodes from the breadcrumb trail, related to the current node
parent
6bc1e588
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
17 deletions
+32
-17
Breadcrumb.purs
src/Gargantext/Components/Forest/Breadcrumb.purs
+8
-2
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+8
-15
Reactix.js
src/Gargantext/Utils/Reactix.js
+5
-0
Reactix.purs
src/Gargantext/Utils/Reactix.purs
+11
-0
No files found.
src/Gargantext/Components/Forest/Breadcrumb.purs
View file @
6ff0feb6
...
...
@@ -8,7 +8,7 @@ import Data.Array as A
import Data.Int (fromString)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.String (Pattern(..), split)
import Gargantext.Components.App.Store
(Boxes)
import Gargantext.Components.App.Store
as Store
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.GraphQL.Endpoints (getBreadcrumb)
import Gargantext.Components.GraphQL.Tree (BreadcrumbInfo, TreeNode)
...
...
@@ -30,7 +30,7 @@ import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Breadcrumb"
type PropsBoxes = ( boxes :: Boxes )
type PropsBoxes = ( boxes ::
Store.
Boxes )
type Props =
( nodeId :: Int
...
...
@@ -232,10 +232,16 @@ breadcrumbItemCpt = here.component "breadcrumbItemCpt" cpt where
, format
} _ = do
boxes@{ forestOpen } <- Store.use
url <- R.unsafeHooksEffect GU.href
let sid = sessionId session
let rootId = treeId session
let currentNodeIdFromUrl = mkNodeId session linkId
R.unsafeHooksEffect $ T.modify_ (openNodesInsert (currentNodeIdFromUrl)) forestOpen
pure $
if format == "text"
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
6ff0feb6
...
...
@@ -158,6 +158,7 @@ getNodeTreeFirstLevel session nodeId = get session $ GR.TreeFirstLevel (Just nod
tree :: R2.Leaf TreeProps
tree props = R.createElement treeCpt props []
treeCpt :: R.Component TreeProps
treeCpt = here.component "tree" cpt where
cpt p@{ frontends
...
...
@@ -167,24 +168,16 @@ treeCpt = here.component "tree" cpt where
, tree: NTree (LNode { id, name, nodeType }) children } _ = do
boxes@{ forestOpen } <- Store.use
url <- R.unsafeHooksEffect GU.href
let nodeIdFromUrl = fromMaybe 0 $ fromString $ getLastUrlElement url
let currentNodeIdFromUrl = mkNodeId session nodeIdFromUrl
-- R.unsafeHooksEffect $ Console.log $ "id: " <> show id
-- R.unsafeHooksEffect $ Console.log $ "nodeIdFromUrl: " <> show nodeIdFromUrl
-- R.unsafeHooksEffect $ Console.log $ "forestOpen avant modification: " <> show forestOpen
R.unsafeHooksEffect $ T.modify_ (openNodesInsert (currentNodeIdFromUrl)) forestOpen
-- R.unsafeHooksEffect $ T.modify_ (openNodesInsert (mkNodeId session 2)) forestOpen
-- folderOpen <- useOpenNodesMemberBox currentNodeIdFromUrl forestOpen
-- let currentNodeId = if id == nodeIdFromUrl then currentNodeIdFromUrl else nodeId
isBoxVisible <- T.useBox false
folderOpen <- useOpenNodesMemberBox nodeId forestOpen
folderOpen' <- T.useLive T.unequal folderOpen
R.useEffect' do
selectedLeaf <- R2.querySelector ".mainleaf--selected"
case selectedLeaf of
Nothing -> pure unit
Just el -> R2.scrollIntoView el
pure $
H.div
...
...
src/Gargantext/Utils/Reactix.js
View file @
6ff0feb6
...
...
@@ -53,3 +53,8 @@ export function _keyCode(e) {
// https://www.w3schools.com/jsref/event_key_keycode.asp
return
e
.
which
||
e
.
keyCode
;
}
export
function
_scrollIntoView
(
el
)
{
return
el
.
scrollIntoView
();
}
\ No newline at end of file
src/Gargantext/Utils/Reactix.purs
View file @
6ff0feb6
...
...
@@ -281,6 +281,11 @@ getElementById = (flip delay) h
where
h id = pure $ toMaybe $ document ... "getElementById" $ [id]
querySelector :: String -> Effect (Maybe DOM.Element)
querySelector = (flip delay) h
where
h selector = pure $ toMaybe $ document ... "querySelector" $ [selector]
-- We just assume it works, so make sure it's in the html
getPortalHost :: R.Hooks DOM.Element
getPortalHost = R.unsafeHooksEffect $ delay unit $ \_ -> pure $ document ... "getElementById" $ ["portal"]
...
...
@@ -487,6 +492,12 @@ focus nEl = case toMaybe nEl of
Nothing -> pure unit
Just el -> el ... "focus" $ []
foreign import _scrollIntoView :: EffectFn1 DOM.Element Unit
scrollIntoView :: DOM.Element -> Effect Unit
scrollIntoView el = runEffectFn1 _scrollIntoView el
setIndeterminateCheckbox :: R.Element -> Boolean -> Effect R.Element
setIndeterminateCheckbox el val = pure $ (el .= "indeterminate") val
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment