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