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
8096c7db
Commit
8096c7db
authored
4 years ago
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACT|DESIGN] refactoring Node Box submit button (next)
parent
58f378f4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
66 deletions
+36
-66
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+6
-6
Add.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
+4
-20
Rename.purs
...Gargantext/Components/Forest/Tree/Node/Action/Rename.purs
+1
-1
Share.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
+1
-1
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+2
-36
Tools.purs
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
+22
-2
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
8096c7db
...
...
@@ -26,14 +26,14 @@ data Action = AddNode String GT.NodeType
instance showShow :: Show Action where
show DeleteNode = "DeleteNode"
show DeleteNode = "DeleteNode"
show RefreshTree = "RefreshTree"
show (ShareNode _) = "ShareNode"
show (UpdateNode _) = "UpdateNode"
show (RenameNode _) = "RenameNode"
show (SearchQuery _) = "SearchQuery"
show (AddNode _ _) = "AddNode"
show (UpdateNode _) = "UpdateNode"
show (RenameNode _) = "RenameNode"
show (SearchQuery _) = "SearchQuery"
show (UploadFile _ _ _ _)= "UploadFile"
show RefreshTree = "RefreshTree"
show (ShareNode _) = "ShareNode"
-----------------------------------------------------
-- TODO Delete with asyncTaskWithType
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
View file @
8096c7db
...
...
@@ -9,6 +9,7 @@ import Effect.Aff (Aff, launchAff)
import Effect.Uncurried (mkEffectFn1)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node (SettingsBox(..), settingsBox)
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton)
import Gargantext.Types (NodeType(..), readNodeType)
import Gargantext.Utils.Reactix as R2
import Gargantext.Sessions (Session, post)
...
...
@@ -62,11 +63,11 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
where
el = R.hooksComponent "AddNodeView" cpt
cpt {id, name} _ = do
nodeName <- R.useState' "Name"
nodeType' <- R.useState' $ fromMaybe NodeUser $ head nodeTypes
nodeName
@(name' /\ _)
<- R.useState' "Name"
nodeType'
@(nt /\ _)
<- R.useState' $ fromMaybe NodeUser $ head nodeTypes
pure $ H.div {}
[ panelBody readNodeType nodeName nodeType'
, panelFooter nodeName nodeType'
,
submitButton (AddNode name' nt) dispatch --
panelFooter nodeName nodeType'
]
where
panelBody :: (String -> NodeType)
...
...
@@ -116,23 +117,6 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
]
panelFooter :: R.State String -> R.State NodeType -> R.Element
panelFooter (name' /\ _) (nt /\ _) =
H.div { className: "panel-footer"}
[ H.div {} []
, H.div {className: "center"}
[ H.button {className: "btn btn-primary"
, type : "button"
, style : { width: "50%" }
, onClick: mkEffectFn1 $ \_ -> do
-- TODO
--setPopupOpen $ const Nothing
launchAff $ dispatch $ AddNode name' nt
} [H.text "Add"]
]
]
-- END Create Node
showConfig :: NodeType -> R.Element
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree/Node/Action/Rename.purs
View file @
8096c7db
...
...
@@ -10,7 +10,7 @@ import Gargantext.Types as GT
import Gargantext.Types (ID)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, put)
import Gargantext.Components.Forest.Tree.Node.Tools
.TextInputBox
as Tools
import Gargantext.Components.Forest.Tree.Node.Tools as Tools
------------------------------------------------------------------------
rename :: Session -> ID -> RenameValue -> Aff (Array ID)
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
8096c7db
...
...
@@ -10,7 +10,7 @@ import Gargantext.Types as GT
import Gargantext.Types (ID)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Components.Forest.Tree.Node.Tools
.TextInputBox
as Tools
import Gargantext.Components.Forest.Tree.Node.Tools as Tools
------------------------------------------------------------------------
share :: Session -> ID -> ShareValue -> Aff (Array ID)
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
8096c7db
...
...
@@ -31,6 +31,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Rename (textInputBox, renam
import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
import Gargantext.Components.Forest.Tree.Node.Action.Upload (DroppedFile(..), uploadFileView, fileTypeView, uploadTermListView)
import Gargantext.Components.Forest.Tree.Node.ProgressBar (asyncProgressBar, BarType(..))
import Gargantext.Components.Forest.Tree.Node.Tools
import Gargantext.Components.GraphExplorer.API as GraphAPI
import Gargantext.Components.Lang (allLangs, Lang(EN))
import Gargantext.Components.NgramsTable.API as NTAPI
...
...
@@ -651,43 +652,8 @@ actionDelete _ dispatch = do
, "If yes, click again below."
]
)
, submitButton DeleteNode dispatch
-- buttonDelete dispatch
, submitButton DeleteNode dispatch
]
where
buttonDelete :: (Action -> Aff Unit) -> R.Element
buttonDelete d =
H.div {className: "panel-footer"}
[ H.div {} []
, H.div { className: "center"}
[ H.button { className : "btn btn-primary glyphicon glyphicon-trash"
, type: "button"
, style : { width: "50%" }
, id: "delete"
, title: "Delete"
, on: {click: \_ -> launchAff $ d $ DeleteNode}
}
[ H.text "Delete!"]
]
]
type ButtonTitle = String
type ButtonIcon = String
submitButton :: Action -> (Action -> Aff Unit) -> R.Element
submitButton action dispatch =
H.div {className: "panel-footer"}
[ H.div {} []
, H.div { className: "center"}
[ H.button { className : "btn btn-primary fa fa-" <> icon action
, type: "button"
, style : { width: "50%" }
, id: S.toLower $ show action
, title: show action
, on: {click: \_ -> launchAff $ dispatch action}
}
[ H.text $ " " <> text action]
]
]
-- | Action : Upload
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree/Node/Tools
/TextInputBox
.purs
→
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
View file @
8096c7db
module Gargantext.Components.Forest.Tree.Node.Tools
.TextInputBox
where
module Gargantext.Components.Forest.Tree.Node.Tools where
import Data.String as S
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff, launchAff)
import Effect.Uncurried (mkEffectFn1)
import Gargantext.Components.Forest.Tree.Node.Action
import Gargantext.Types (ID)
import Gargantext.Utils.Reactix as R2
import
Prelude (Unit, bind, const, discard, pure, ($), (<<<), (<>
))
import
Gargantext.Prelude (Unit, bind, const, discard, identity, map, pure, show, unit, void, ($), (+), (<>), (==), (<<<
))
import Reactix as R
import Reactix.DOM.HTML as H
...
...
@@ -65,3 +66,22 @@ textInputBox p@{ boxName, isOpen: (false /\ _) } = R.createElement el p []
-- | END Rename Box
submitButton :: Action -> (Action -> Aff Unit) -> R.Element
submitButton action dispatch =
H.div {className: "panel-footer"}
[ H.div {} []
, H.div { className: "center"}
[ H.button { className : "btn btn-primary fa fa-" <> icon action
, type: "button"
, style : { width: "50%" }
, id: S.toLower $ show action
, title: show action
, on: {click: \_ -> launchAff $ dispatch action}
}
[ H.text $ " " <> text action]
]
]
This diff is collapsed.
Click to expand it.
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