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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
5735f12b
Unverified
Commit
5735f12b
authored
Jul 05, 2019
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce elSpec a convenience function from reactix to thermite
parent
5f84dce1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
Tree.purs
src/Gargantext/Components/Tree.purs
+2
-6
Reactix.purs
src/Gargantext/Utils/Reactix.purs
+10
-1
No files found.
src/Gargantext/Components/Tree.purs
View file @
5735f12b
...
...
@@ -27,7 +27,7 @@ import React.DOM.Props (className, style)
import React.SyntheticEvent as E
import Reactix as R
import Reactix.DOM.HTML as H
import Thermite (
PerformAction, Render, Spec, createClass, defaultPerformAction, simpleSpec, modifyState_
)
import Thermite (
Spec
)
import URI.Extra.QueryPairs as QP
import URI.Query as Q
import Unsafe.Coerce (unsafeCoerce)
...
...
@@ -188,12 +188,8 @@ treeLoadView setReload p = R.createElement el p []
loadedTreeView setReload {tree: loaded, mCurrentRoute}
treeview :: Spec {} Props Void
treeview =
simpleSpec defaultPerformAction render
treeview =
R2.elSpec $ R.hooksComponent "TreeView" cpt
where
render :: Render {} Props Void
render _ props _ _ = [R2.scuff $ R.createElement el props []]
el = R.hooksComponent "TreeView" cpt
cpt {root, mCurrentRoute} _children = do
-- NOTE: this is a hack to reload the tree view on demand
setReload <- R.useState' 0
...
...
src/Gargantext/Utils/Reactix.purs
View file @
5735f12b
...
...
@@ -17,6 +17,7 @@ import Reactix as R
import Reactix.DOM.HTML (ElemFactory)
import Reactix.React (createDOMElement)
import Reactix.SyntheticEvent as RE
import Thermite (Spec, simpleSpec, Render, defaultPerformAction)
import Unsafe.Coerce (unsafeCoerce)
newtype Point = Point { x :: Number, y :: Number }
...
...
@@ -30,6 +31,14 @@ buff = unsafeCoerce
scuff :: R.Element -> ReactElement
scuff = unsafeCoerce
elSpec :: forall component props
. R.IsComponent component props (Array R.Element)
=> component -> Spec {} (Record props) Void
elSpec cpt = simpleSpec defaultPerformAction render
where
render :: Render {} (Record props) Void
render _ props _ children = [scuff $ R.createElement cpt props (buff <$> children)]
mousePosition :: RE.SyntheticEvent DE.MouseEvent -> Point
mousePosition e = Point { x: RE.clientX e, y: RE.clientY e }
...
...
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