Commit cc142357 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[DESIGN/ERGO/METHODO] improving test workflow for user: color code for Status of node functions

parent e224f744
...@@ -26,6 +26,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Link (linkNode) ...@@ -26,6 +26,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Link (linkNode)
import Gargantext.Components.Forest.Tree.Node.Action.Merge (mergeNode) import Gargantext.Components.Forest.Tree.Node.Action.Merge (mergeNode)
import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS) import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS)
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox) import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox)
import Gargantext.Components.Forest.Tree.Node.Status (Status(..), hasStatus)
import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT) import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (Name, ID) import Gargantext.Types (Name, ID)
...@@ -42,15 +43,6 @@ type CommonProps = ...@@ -42,15 +43,6 @@ type CommonProps =
-- | START Popup View -- | START Popup View
iconAStyle :: { color :: String
, paddingTop :: String
, paddingBottom :: String
}
iconAStyle = { color : "black"
, paddingTop : "6px"
, paddingBottom : "6px"
}
nodePopupView :: Record NodePopupProps -> R.Element nodePopupView :: Record NodePopupProps -> R.Element
nodePopupView p = R.createElement nodePopupCpt p [] nodePopupView p = R.createElement nodePopupCpt p []
...@@ -150,11 +142,13 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt ...@@ -150,11 +142,13 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
, H.div { className: "flex-center"} , H.div { className: "flex-center"}
[ buttonClick { action: doc [ buttonClick { action: doc
, state: nodePopupState , state: nodePopupState
, nodeType
} }
] ]
, H.div {className: "flex-center"} , H.div {className: "flex-center"}
$ map (\t -> buttonClick { action: t $ map (\t -> buttonClick { action: t
, state : nodePopupState , state : nodePopupState
, nodeType
} }
) buttons ) buttons
] ]
...@@ -189,6 +183,7 @@ type ActionState = ...@@ -189,6 +183,7 @@ type ActionState =
type ButtonClickProps = type ButtonClickProps =
( action :: NodeAction ( action :: NodeAction
, state :: R.State (Record ActionState) , state :: R.State (Record ActionState)
, nodeType :: GT.NodeType
) )
buttonClick :: Record ButtonClickProps -> R.Element buttonClick :: Record ButtonClickProps -> R.Element
...@@ -197,9 +192,9 @@ buttonClick p = R.createElement buttonClickCpt p [] ...@@ -197,9 +192,9 @@ buttonClick p = R.createElement buttonClickCpt p []
buttonClickCpt :: R.Component ButtonClickProps buttonClickCpt :: R.Component ButtonClickProps
buttonClickCpt = R.hooksComponent "G.C.F.T.N.B.buttonClick" cpt buttonClickCpt = R.hooksComponent "G.C.F.T.N.B.buttonClick" cpt
where where
cpt {action: todo, state: (node@{action} /\ setNodePopup)} _ = do cpt {action: todo, state: (node@{action} /\ setNodePopup), nodeType} _ = do
pure $ H.div {className: "col-md-1"} pure $ H.div {className: "col-md-1"}
[ H.a { style: iconAStyle [ H.a { style: (iconAStyle nodeType todo)
, className: glyphiconActive (glyphiconNodeAction todo) , className: glyphiconActive (glyphiconNodeAction todo)
(action == (Just todo) ) (action == (Just todo) )
, id: show todo , id: show todo
...@@ -219,6 +214,20 @@ buttonClickCpt = R.hooksComponent "G.C.F.T.N.B.buttonClick" cpt ...@@ -219,6 +214,20 @@ buttonClickCpt = R.hooksComponent "G.C.F.T.N.B.buttonClick" cpt
doToDo = setNodePopup doToDo = setNodePopup
$ const (node { action = action' }) $ const (node { action = action' })
iconAStyle :: GT.NodeType -> NodeAction -> { color :: String
, paddingTop :: String
, paddingBottom :: String
}
iconAStyle n a = { color : hasColor (hasStatus n a)
, paddingTop : "6px"
, paddingBottom : "6px"
}
where
hasColor :: Status -> String
hasColor Prod = "black"
hasColor Test = "orange"
hasColor WIP = "red"
-- END Popup View -- END Popup View
type NodeProps = type NodeProps =
......
...@@ -14,10 +14,6 @@ import Gargantext.Types ...@@ -14,10 +14,6 @@ import Gargantext.Types
if user has access to node then he can do all his related actions if user has access to node then he can do all his related actions
-} -}
------------------------------------------------------------------------ ------------------------------------------------------------------------
------------------------------------------------------------------------
-- Beta Status
data Status a = TODO a | WIP a | OnTest a | Beta a
data NodeAction = Documentation NodeType data NodeAction = Documentation NodeType
| SearchBox | SearchBox
| Download | Upload | Refresh | Config | Download | Upload | Refresh | Config
...@@ -28,7 +24,6 @@ data NodeAction = Documentation NodeType ...@@ -28,7 +24,6 @@ data NodeAction = Documentation NodeType
| Move { subTreeParams :: SubTreeParams } | Move { subTreeParams :: SubTreeParams }
| Link { subTreeParams :: SubTreeParams } | Link { subTreeParams :: SubTreeParams }
| Clone | Clone
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- TODO move elsewhere -- TODO move elsewhere
data SubTreeParams = SubTreeParams { showtypes :: Array NodeType data SubTreeParams = SubTreeParams { showtypes :: Array NodeType
......
module Gargantext.Components.Forest.Tree.Node.Status where
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Eq (genericEq)
import Gargantext.Prelude (class Eq, class Show, show, (&&), (<>), (==))
import Data.Array (foldl)
import Gargantext.Types
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..))
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
-- Beta Status
data Status = Prod | Test | WIP
hasStatus :: NodeType -> NodeAction -> Status
hasStatus _ SearchBox = WIP
hasStatus _ (Documentation _) = Test
hasStatus _ _ = Prod
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment