Commit 81bcc365 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX|REFACT] warnings + icons

parent d1b90d3f
...@@ -13,6 +13,7 @@ import Gargantext.Routes (SessionRoute(..)) ...@@ -13,6 +13,7 @@ import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes as GR import Gargantext.Routes as GR
import Gargantext.Sessions (Session, get, put, post, delete) import Gargantext.Sessions (Session, get, put, post, delete)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Components.Forest.Tree.Node (NodeAction(..), glyphiconNodeAction)
type Props = type Props =
( dispatch :: Action -> Aff Unit ( dispatch :: Action -> Aff Unit
...@@ -21,7 +22,7 @@ type Props = ...@@ -21,7 +22,7 @@ type Props =
, session :: Session , session :: Session
) )
data Action = AddNode String GT.NodeType data Action = AddNode String GT.NodeType
| DeleteNode | DeleteNode
| UpdateNode GT.AsyncTaskWithType | UpdateNode GT.AsyncTaskWithType
| RenameNode String | RenameNode String
...@@ -30,6 +31,7 @@ data Action = AddNode String GT.NodeType ...@@ -30,6 +31,7 @@ data Action = AddNode String GT.NodeType
| RefreshTree | RefreshTree
| ShareNode String | ShareNode String
instance showShow :: Show Action where instance showShow :: Show Action where
show DeleteNode = "DeleteNode" show DeleteNode = "DeleteNode"
show RefreshTree = "RefreshTree" show RefreshTree = "RefreshTree"
...@@ -42,19 +44,27 @@ instance showShow :: Show Action where ...@@ -42,19 +44,27 @@ instance showShow :: Show Action where
----------------------------------------------------------------------- -----------------------------------------------------------------------
icon :: Action -> String icon :: Action -> String
icon DeleteNode = "trash" icon (AddNode _ _) = glyphiconNodeAction (Add [])
icon (AddNode _ _) = "plus" icon DeleteNode = glyphiconNodeAction Delete
icon _ = "hand-o-right" icon (UpdateNode _) = glyphiconNodeAction Refresh
icon (RenameNode _) = glyphiconNodeAction Config
icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (UploadFile _ _ _ _) = glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh
icon (ShareNode _) = glyphiconNodeAction Share
-- icon _ = "hand-o-right"
text :: Action -> String text :: Action -> String
text DeleteNode = "Delete !" text DeleteNode = "Delete !"
text (AddNode _ _) = "Add !" text RefreshTree = "Refresh Tree !"
text (UpdateNode _) = "Update !" text (AddNode _ _ )= "Add !"
text (RenameNode _) = "Rename !" text (UpdateNode _ )= "Update !"
text (DoSearch _) = "Launch search !" text (RenameNode _ )= "Rename !"
text (DoSearch _ )= "Launch search !"
text (ShareNode _ )= "Share !"
text (UploadFile _ _ _ _)= "Upload File !" text (UploadFile _ _ _ _)= "Upload File !"
text RefreshTree = "Refresh Tree !"
text (ShareNode _) = "Share !"
----------------------------------------------------------------------- -----------------------------------------------------------------------
-- TODO move code below elsewhere -- TODO move code below elsewhere
......
...@@ -4,7 +4,6 @@ import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>)) ...@@ -4,7 +4,6 @@ import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>))
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Prelude (($)) import Prelude (($))
import Reactix as R
import Gargantext.Components.Forest.Tree.Node.Action import Gargantext.Components.Forest.Tree.Node.Action
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Types (ID) import Gargantext.Types (ID)
......
module Gargantext.Components.Forest.Tree.Node.Action.Update where module Gargantext.Components.Forest.Tree.Node.Action.Update where
import Data.Array (length, head)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>)) import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>))
import Data.Maybe (Maybe(..), fromMaybe) import Effect.Aff (Aff)
-- import Data.Newtype (class Newtype) import Gargantext.Components.Forest.Tree.Node.Action (Action)
import Data.Tuple.Nested ((/\)) import Gargantext.Types (NodeType)
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.Types (NodeType(..), readNodeType)
import Gargantext.Utils.Reactix as R2
import Gargantext.Sessions (Session, post)
import Gargantext.Routes as GR
import Gargantext.Types as GT import Gargantext.Types as GT
import Prelude (Unit, bind, const, discard, map, pure, show, ($), (<>), (>), (<<<)) import Gargantext.Prelude (Unit)
import Reactix as R
import Reactix.DOM.HTML as H
{- {-
updateNode :: Session -> ID -> UpdateNodeParams -> Aff (Array ID) updateNode :: Session -> ID -> UpdateNodeParams -> Aff (Array ID)
......
...@@ -180,7 +180,7 @@ fldr nt open = if open ...@@ -180,7 +180,7 @@ fldr nt open = if open
color FolderPublic = "" color FolderPublic = ""
color FolderShared = " text-warning" color FolderShared = " text-warning"
color _ = " text-danger" color _ = " text-danger"
-} -}
-- START node text -- START node text
......
...@@ -7,7 +7,7 @@ import Effect.Uncurried (mkEffectFn1) ...@@ -7,7 +7,7 @@ import Effect.Uncurried (mkEffectFn1)
import Gargantext.Components.Forest.Tree.Node.Action import Gargantext.Components.Forest.Tree.Node.Action
import Gargantext.Types (ID) import Gargantext.Types (ID)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Prelude (Unit, bind, const, discard, identity, map, pure, show, unit, void, ($), (+), (<>), (==), (<<<)) import Gargantext.Prelude (Unit, bind, const, discard, pure, show, ($), (<<<), (<>))
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
...@@ -83,5 +83,3 @@ submitButton action dispatch = ...@@ -83,5 +83,3 @@ submitButton action dispatch =
] ]
] ]
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