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
ba53ab68
Commit
ba53ab68
authored
Jan 27, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[refactoring] some components refactoring, fixes to input with enter
parent
e5a139f5
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
30 additions
and
38 deletions
+30
-38
Add.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
+0
-1
Link.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
+2
-2
Merge.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
+5
-5
Move.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
+3
-2
SearchField.purs
...omponents/Forest/Tree/Node/Action/Search/SearchField.purs
+3
-4
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+3
-3
Tools.purs
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
+6
-7
InputWithEnter.purs
src/Gargantext/Components/InputWithEnter.purs
+4
-8
Contacts.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
+0
-1
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+0
-1
Dashboard.purs
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
+4
-4
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
View file @
ba53ab68
...
...
@@ -86,7 +86,6 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
onEnter: \_ -> launchAff_ $ dispatch (AddNode name' nt')
, onValueChanged: \val -> setNodeName $ const val
, autoFocus: true
, autoSave: false
, className: "form-control"
, defaultValue: name'
, placeholder: name'
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
View file @
ba53ab68
...
...
@@ -55,8 +55,8 @@ linkNodeType (Just GT.Annuaire) = GT.Corpus
linkNodeType _ = GT.Error
linkNode :: R
ecord SubTreeParamsIn -> R.Element
linkNode
p = R.createElement linkNodeCpt p []
linkNode :: R
2.Component SubTreeParamsIn
linkNode
= R.createElement linkNodeCpt
linkNodeCpt :: R.Component SubTreeParamsIn
linkNodeCpt = R.hooksComponentWithModule thisModule "linkNode" cpt
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
View file @
ba53ab68
...
...
@@ -22,12 +22,12 @@ mergeNodeReq :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
mergeNodeReq session fromId toId =
put_ session $ NodeAPI GT.Node (Just fromId) ("merge/" <> show toId)
mergeNode :: Record SubTreeParamsIn -> R.Element
mergeNode p = R.createElement mergeNodeCpt p []
where
mergeNodeCpt :: R.Component SubTreeParamsIn
mergeNodeCpt = R.hooksComponentWithModule thisModule "mergeNode" cpt
mergeNode :: R2.Component SubTreeParamsIn
mergeNode = R.createElement mergeNodeCpt
mergeNodeCpt :: R.Component SubTreeParamsIn
mergeNodeCpt = R.hooksComponentWithModule thisModule "mergeNode" cpt
where
cpt p@{dispatch, subTreeParams, id, nodeType, session, handed} _ = do
action@(valAction /\ setAction) :: R.State Action <- R.useState' (MergeNode {params:Nothing})
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
View file @
ba53ab68
...
...
@@ -14,6 +14,7 @@ import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTre
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, put_)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.Forest.Tree.Node.Action.Move"
...
...
@@ -22,8 +23,8 @@ moveNodeReq :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
moveNodeReq session fromId toId =
put_ session $ NodeAPI GT.Node (Just fromId) ("move/" <> show toId)
moveNode :: R
ecord SubTreeParamsIn -> R.Element
moveNode
p = R.createElement moveNodeCpt p []
moveNode :: R
2.Component SubTreeParamsIn
moveNode
= R.createElement moveNodeCpt
moveNodeCpt :: R.Component SubTreeParamsIn
moveNodeCpt = R.hooksComponentWithModule thisModule "moveNode" cpt
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchField.purs
View file @
ba53ab68
...
...
@@ -349,7 +349,6 @@ searchInputCpt = R.hooksComponentWithModule thisModule "searchInput" cpt
inputWithEnter { onEnter: onEnter valueRef setSearch
, onValueChanged: onValueChanged valueRef
, autoFocus: false
, autoSave: true
, className: "form-control"
, defaultValue: R.readRef valueRef
, placeholder: "Your query here"
...
...
@@ -380,10 +379,10 @@ type SubmitButtonProps =
submitButton :: Record SubmitButtonProps -> R.Element
submitButton p = R.createElement submitButtonComponent p []
where
submitButtonComponent :: R.Component SubmitButtonProps
submitButtonComponent = R.hooksComponentWithModule thisModule "submitButton" cpt
submitButtonComponent :: R.Component SubmitButtonProps
submitButtonComponent = R.hooksComponentWithModule thisModule "submitButton" cpt
where
cpt {onSearch, search: (mySearch /\ _), session} _ =
pure $
H.button { className: "btn btn-primary"
...
...
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
ba53ab68
...
...
@@ -274,13 +274,13 @@ panelActionCpt = R.hooksComponentWithModule thisModule "panelAction" cpt
-----------
-- Functions using SubTree
cpt {action: Merge {subTreeParams}, dispatch, id, nodeType, session, handed} _ = do
pure $ mergeNode {dispatch, id, nodeType, session, subTreeParams, handed}
pure $ mergeNode {dispatch, id, nodeType, session, subTreeParams, handed}
[]
cpt {action: Move {subTreeParams}, dispatch, id, nodeType, session, handed} _ = do
pure $ moveNode {dispatch, id, nodeType, session, subTreeParams, handed}
pure $ moveNode {dispatch, id, nodeType, session, subTreeParams, handed}
[]
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session, handed} _ = do
pure $ linkNode {dispatch, id, nodeType, session, subTreeParams, handed}
pure $ linkNode {dispatch, id, nodeType, session, subTreeParams, handed}
[]
-----------
cpt {action : Share, dispatch, id, name } _ = do
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
View file @
ba53ab68
...
...
@@ -65,12 +65,12 @@ type TextInputBoxProps =
)
textInputBox :: R2.Component TextInputBoxProps
textInputBox props@{ boxName } = R.createElement el props
where
el :: R.Component TextInputBoxProps
el = R.hooksComponentWithModule thisModule (boxName <> "Box") cpt
textInputBox = R.createElement textInputBoxCpt
cpt p@{ boxAction, dispatch, id, isOpen: (true /\ setIsOpen), text } _ = do
textInputBoxCpt :: R.Component TextInputBoxProps
textInputBoxCpt = R.hooksComponentWithModule thisModule "textInputBox" cpt
where
cpt p@{ boxAction, boxName, dispatch, id, isOpen: (true /\ setIsOpen), text } _ = do
renameNodeNameRef <- R.useRef text
pure $ H.div { className: "from-group row" }
...
...
@@ -85,7 +85,6 @@ textInputBox props@{ boxName } = R.createElement el props
onEnter: submit renameNodeNameRef
, onValueChanged: R.setRef renameNodeNameRef
, autoFocus: true
, autoSave: false
, className: "form-control"
, defaultValue: text
, placeholder: (boxName <> " Node")
...
...
@@ -105,8 +104,8 @@ textInputBox props@{ boxName } = R.createElement el props
, title: "Cancel"
} []
submit renameNodeNameRef _ = do
setIsOpen $ const false
launchAff_ $ dispatch ( boxAction $ R.readRef renameNodeNameRef )
setIsOpen $ const false
cpt { isOpen: (false /\ _) } _ = pure $ H.div {} []
-- | END Rename Box
...
...
src/Gargantext/Components/InputWithEnter.purs
View file @
ba53ab68
...
...
@@ -16,7 +16,6 @@ type Props a = (
, onValueChanged :: String -> Effect Unit
, autoFocus :: Boolean
, autoSave :: Boolean
, className :: String
, defaultValue :: String
, placeholder :: String
...
...
@@ -25,12 +24,13 @@ type Props a = (
inputWithEnter :: forall a. Record (Props a) -> R.Element
inputWithEnter props = R.createElement inputWithEnterCpt props []
inputWithEnterCpt :: forall a. R.Component (Props a)
inputWithEnterCpt = R.hooksComponentWithModule thisModule "inputWithEnter" cpt
where
cpt props@{ onEnter, onValueChanged
, autoFocus,
autoSave,
className, defaultValue, placeholder } _ = do
pure $ H.input { on: { blur: \_ ->
if autoSave then onEnter unit else pure
unit
, autoFocus, className, defaultValue, placeholder } _ = do
pure $ H.input { on: { blur: \_ ->
onEnter
unit
, input: onInput
, keyPress: onKeyPress }
, autoFocus
...
...
@@ -40,11 +40,7 @@ inputWithEnterCpt = R.hooksComponentWithModule thisModule "inputWithEnter" cpt
, type: props.type }
where
onInput e = do
if autoSave then
onValueChanged $ R.unsafeEventValue e
else
pure unit
onInput e = onValueChanged $ R.unsafeEventValue e
onKeyPress e = do
char <- R2.keyCode e
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
View file @
ba53ab68
...
...
@@ -128,7 +128,6 @@ contactInfoItemCpt = R.hooksComponentWithModule thisModule "contactInfoItem" cpt
H.div { className: "input-group col-sm-6" } [
inputWithEnter {
autoFocus: true
, autoSave: false
, className: "form-control"
, defaultValue: R.readRef valueRef
, onEnter: onClick
...
...
src/Gargantext/Components/Nodes/Corpus.purs
View file @
ba53ab68
...
...
@@ -307,7 +307,6 @@ renameableTextCpt = R.hooksComponentWithModule thisModule "renameableTextCpt" cp
pure $ H.div { className: "input-group" }
[ inputWithEnter {
autoFocus: false
, autoSave: false
, className: "form-control text"
, defaultValue: text
, onEnter: submit
...
...
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
View file @
ba53ab68
...
...
@@ -132,11 +132,11 @@ type CodeEditorProps =
)
dashboardCodeEditor :: R2.Component CodeEditorProps
dashboardCodeEditor = R.createElement el
where
el :: R.Component CodeEditorProps
el = R.hooksComponentWithModule thisModule "dashboardCodeEditor" cpt
dashboardCodeEditor = R.createElement dashboardCodeEditorCpt
dashboardCodeEditorCpt :: R.Component CodeEditorProps
dashboardCodeEditorCpt = R.hooksComponentWithModule thisModule "dashboardCodeEditor" cpt
where
cpt props@{ fields, nodeId, onChange, session } _ = do
let fieldsWithIndex = List.mapWithIndex (\idx -> \t -> Tuple idx t) fields
fieldsS <- R.useState' fieldsWithIndex
...
...
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