Commit 7f062bd6 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIXME] Proposed default Name should be prettyNodeType instead

parent 36ba9be3
...@@ -69,7 +69,7 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p [] ...@@ -69,7 +69,7 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
nodeName@(name' /\ setNodeName) <- R.useState' "Name" nodeName@(name' /\ setNodeName) <- R.useState' "Name"
nodeType'@(nt /\ setNodeType) <- R.useState' $ fromMaybe Folder $ head nodeTypes nodeType'@(nt /\ setNodeType) <- R.useState' $ fromMaybe Folder $ head nodeTypes
let let
SettingsBox {edit} = settingsBox nt SettingsBox {edit} = settingsBox nt
(maybeChoose /\ nt') = if length nodeTypes > 1 (maybeChoose /\ nt') = if length nodeTypes > 1
then ([ formChoiceSafe nodeTypes Error setNodeType ] /\ nt) then ([ formChoiceSafe nodeTypes Error setNodeType ] /\ nt)
...@@ -77,7 +77,7 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p [] ...@@ -77,7 +77,7 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
<> show defaultNt <> show defaultNt
<> " with name:" <> " with name:"
] ]
] /\ defaultNt ] /\ defaultNt
) )
where where
defaultNt = (fromMaybe Error $ head nodeTypes) defaultNt = (fromMaybe Error $ head nodeTypes)
...@@ -87,8 +87,8 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p [] ...@@ -87,8 +87,8 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
, onValueChanged: \val -> setNodeName $ const val , onValueChanged: \val -> setNodeName $ const val
, autoFocus: true , autoFocus: true
, className: "form-control" , className: "form-control"
, defaultValue: name' , defaultValue: name' -- (prettyNodeType nt')
, placeholder: name' , placeholder: name' -- (prettyNodeType nt')
, type: "text" , type: "text"
} }
else H.div {} [] else H.div {} []
......
...@@ -28,9 +28,9 @@ import Gargantext.Components.Forest.Tree.Node.Action.Merge (mergeNode) ...@@ -28,9 +28,9 @@ 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.Status (Status(..), hasStatus)
import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT, prettyNodeType) 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, prettyNodeType)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils (glyphicon, glyphiconActive) import Gargantext.Utils (glyphicon, glyphiconActive)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
......
...@@ -262,11 +262,6 @@ checkboxes xs (val /\ set) = ...@@ -262,11 +262,6 @@ checkboxes xs (val /\ set) =
) xs ) xs
prettyNodeType :: GT.NodeType -> String
prettyNodeType nt = S.replace (S.Pattern "Node") (S.Replacement " ")
$ S.replace (S.Pattern "Folder") (S.Replacement " ")
$ show nt
-- START node link -- START node link
type NodeLinkProps = ( type NodeLinkProps = (
...@@ -310,7 +305,7 @@ nodeLinkCpt = R.hooksComponentWithModule thisModule "nodeLink" cpt ...@@ -310,7 +305,7 @@ nodeLinkCpt = R.hooksComponentWithModule thisModule "nodeLink" cpt
] ]
, ReactTooltip.reactTooltip { id: tooltipId } , ReactTooltip.reactTooltip { id: tooltipId }
[ R2.row [ H.h4 {className: GT.fldr nodeType true} [ R2.row [ H.h4 {className: GT.fldr nodeType true}
[ H.text $ prettyNodeType nodeType ] [ H.text $ GT.prettyNodeType nodeType ]
] ]
, R2.row [ H.span {} [ H.text $ name ]] , R2.row [ H.span {} [ H.text $ name ]]
] ]
......
...@@ -8,7 +8,6 @@ import Effect.Class (class MonadEffect, liftEffect) ...@@ -8,7 +8,6 @@ import Effect.Class (class MonadEffect, liftEffect)
import Effect.Exception (catchException, throwException) import Effect.Exception (catchException, throwException)
import Effect.Unsafe (unsafePerformEffect) import Effect.Unsafe (unsafePerformEffect)
-- | JL: Astonishingly, not in the prelude -- | JL: Astonishingly, not in the prelude
-- AD: recent Preludes in Haskell much prefer identity -- AD: recent Preludes in Haskell much prefer identity
-- then id can be used as a variable name (in records for instance) -- then id can be used as a variable name (in records for instance)
...@@ -35,3 +34,5 @@ logExceptions message f x = ...@@ -35,3 +34,5 @@ logExceptions message f x =
logs e logs e
throwException e) do throwException e) do
pure $ f x pure $ f x
...@@ -4,6 +4,7 @@ import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson ...@@ -4,6 +4,7 @@ import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson
import Data.Argonaut.Decode.Error (JsonDecodeError(..)) import Data.Argonaut.Decode.Error (JsonDecodeError(..))
import Data.Array as A import Data.Array as A
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.String as S
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq) import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Ord (genericCompare) import Data.Generic.Rep.Ord (genericCompare)
...@@ -743,3 +744,15 @@ progressPercent (AsyncProgress {log}) = perc ...@@ -743,3 +744,15 @@ progressPercent (AsyncProgress {log}) = perc
where where
nom = toNumber $ failed + succeeded nom = toNumber $ failed + succeeded
denom = toNumber $ failed + succeeded + remaining denom = toNumber $ failed + succeeded + remaining
---------------------------------------------------------------------------
-- | GarganText Internal Sugar
prettyNodeType :: NodeType -> String
prettyNodeType nt = S.replace (S.Pattern "Node") (S.Replacement " ")
$ S.replace (S.Pattern "Folder") (S.Replacement " ")
$ show nt
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