Commit dd733412 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[toestand] fixes for compilation errors

parent 24e8392f
...@@ -7,7 +7,7 @@ let ...@@ -7,7 +7,7 @@ let
owner = "justinwoo"; owner = "justinwoo";
repo = "easy-dhall-nix"; repo = "easy-dhall-nix";
rev = "90957969850a44481c6e150350c56e8b53b29e1e"; rev = "90957969850a44481c6e150350c56e8b53b29e1e";
sha256 = "12v4ql1nm1famz8r80k1xkkdgj7285vy2vn16iili0qwvz3i98ah"; sha256 = "1hsmp3cb0k554kh0jlfzpdzx2b8ndyh2gdykmw9hw41haaw16mmi";
} }
) { ) {
inherit pkgs; inherit pkgs;
......
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
}; };
"affjax" = { "affjax" = {
name = "affjax"; name = "affjax";
version = "v10.1.0"; version = "v11.0.0";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/slamdata/purescript-affjax.git"; url = "https://github.com/slamdata/purescript-affjax.git";
rev = "v10.1.0"; rev = "v11.0.0";
sha256 = "129g7x9icaqj158snzl0ilbd0dipl4bmk49is8dh8jvh0z97k700"; sha256 = "0dfwayw6h49hm5ikq6sic0yi44w8hmqx4nx5xfavqk4ary1z3ifq";
}; };
}; };
"ansi" = { "ansi" = {
...@@ -57,11 +57,11 @@ ...@@ -57,11 +57,11 @@
}; };
"argonaut-core" = { "argonaut-core" = {
name = "argonaut-core"; name = "argonaut-core";
version = "v5.0.2"; version = "v5.1.0";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/purescript-contrib/purescript-argonaut-core.git"; url = "https://github.com/purescript-contrib/purescript-argonaut-core.git";
rev = "v5.0.2"; rev = "v5.1.0";
sha256 = "1rfd1brvzp9akx6hypxql2qv9bhlcqks1xwqfqqf31dqvcl7vvhc"; sha256 = "0x52vz5pdiamwq9cznm5mkhfcgk6raapqwdj7cmiblkflra32lhr";
}; };
}; };
"argonaut-traversals" = { "argonaut-traversals" = {
...@@ -163,15 +163,6 @@ ...@@ -163,15 +163,6 @@
sha256 = "1nm45khn2dvlyv059nzpz1w7d3nfsvq45hnb2qllrbzyv7rlxmi8"; sha256 = "1nm45khn2dvlyv059nzpz1w7d3nfsvq45hnb2qllrbzyv7rlxmi8";
}; };
}; };
"coroutines" = {
name = "coroutines";
version = "v5.0.1";
src = pkgs.fetchgit {
url = "https://github.com/purescript-contrib/purescript-coroutines.git";
rev = "v5.0.1";
sha256 = "1is83blf44sflhwsaixpd1irlm33fsd1p919gbcn79mmmwi4bxdl";
};
};
"css" = { "css" = {
name = "css"; name = "css";
version = "v4.0.0"; version = "v4.0.0";
...@@ -192,11 +183,11 @@ ...@@ -192,11 +183,11 @@
}; };
"debug" = { "debug" = {
name = "debug"; name = "debug";
version = "v4.0.0"; version = "v4.0.1";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/garyb/purescript-debug.git"; url = "https://github.com/garyb/purescript-debug.git";
rev = "v4.0.0"; rev = "v4.0.1";
sha256 = "0gwjj80akys0h111i74n429fmny992gx0r4rk1n98gqlqm5cmi21"; sha256 = "03xmchfzx7anks6b3yrrhf5b0bx7n390c814nhhxdl98936wydg4";
}; };
}; };
"distributive" = { "distributive" = {
...@@ -221,7 +212,7 @@ ...@@ -221,7 +212,7 @@
name = "dom-simple"; name = "dom-simple";
version = "v0.2.7"; version = "v0.2.7";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/irresponsible/purescript-dom-simple"; url = "https://github.com/poorscript/purescript-dom-simple";
rev = "v0.2.7"; rev = "v0.2.7";
sha256 = "02f1vsjk5frva3p3xpbrnj2zg4rg01l07dnvc3i6axvc5k30i282"; sha256 = "02f1vsjk5frva3p3xpbrnj2zg4rg01l07dnvc3i6axvc5k30i282";
}; };
...@@ -275,7 +266,7 @@ ...@@ -275,7 +266,7 @@
name = "ffi-simple"; name = "ffi-simple";
version = "v0.2.10"; version = "v0.2.10";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/irresponsible/purescript-ffi-simple"; url = "https://github.com/poorscript/purescript-ffi-simple";
rev = "v0.2.10"; rev = "v0.2.10";
sha256 = "14slcccmy96ml7r8rzhhqnw486qj1b385i9095fdymms78g5gnj5"; sha256 = "14slcccmy96ml7r8rzhhqnw486qj1b385i9095fdymms78g5gnj5";
}; };
...@@ -334,6 +325,15 @@ ...@@ -334,6 +325,15 @@
sha256 = "1kl937qxnbn9m1bn0ijpnfiizgpcvcrnzqcc1scwq2kxvxh8kqap"; sha256 = "1kl937qxnbn9m1bn0ijpnfiizgpcvcrnzqcc1scwq2kxvxh8kqap";
}; };
}; };
"formula" = {
name = "formula";
version = "v0.2.1";
src = pkgs.fetchgit {
url = "https://github.com/poorscript/purescript-formula";
rev = "v0.2.1";
sha256 = "0511r2n51sz59ksalzvrcbwwhbpj42h2dj2zknns7dnhkdkmf4a6";
};
};
"free" = { "free" = {
name = "free"; name = "free";
version = "v5.2.0"; version = "v5.2.0";
...@@ -343,15 +343,6 @@ ...@@ -343,15 +343,6 @@
sha256 = "1bwj0ay7q9lm4ir29jy549m05jvaqik1s615biv23y51ngx3fn49"; sha256 = "1bwj0ay7q9lm4ir29jy549m05jvaqik1s615biv23y51ngx3fn49";
}; };
}; };
"freet" = {
name = "freet";
version = "v5.0.0";
src = pkgs.fetchgit {
url = "https://github.com/purescript-contrib/purescript-freet.git";
rev = "v5.0.0";
sha256 = "0j8y47x672z8h809hxl1n502yj0y3yv8zsln8bk17rcz06x8frv9";
};
};
"functions" = { "functions" = {
name = "functions"; name = "functions";
version = "v4.0.0"; version = "v4.0.0";
...@@ -651,11 +642,11 @@ ...@@ -651,11 +642,11 @@
}; };
"parsing" = { "parsing" = {
name = "parsing"; name = "parsing";
version = "v5.0.3"; version = "v5.1.0";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/purescript-contrib/purescript-parsing.git"; url = "https://github.com/purescript-contrib/purescript-parsing.git";
rev = "v5.0.3"; rev = "v5.1.0";
sha256 = "0m5xvb5kis28laj3navyyakyq408vw115c2dvngf1vljzh1hk5kj"; sha256 = "199wjj02hh7wzkvh036vqv3369jrw1dpcb11n0nnqlqvvihfcy87";
}; };
}; };
"partial" = { "partial" = {
...@@ -757,22 +748,13 @@ ...@@ -757,22 +748,13 @@
sha256 = "1agpsxwz1i8pavcrpgnir5sk9vwrwk406psykjxmyahxby1dhwqi"; sha256 = "1agpsxwz1i8pavcrpgnir5sk9vwrwk406psykjxmyahxby1dhwqi";
}; };
}; };
"react-dom" = {
name = "react-dom";
version = "v6.1.0";
src = pkgs.fetchgit {
url = "https://github.com/purescript-contrib/purescript-react-dom.git";
rev = "v6.1.0";
sha256 = "19kzsahx3kvgbi9bhnnz50fjmqvvgslsg6rk028bj4v28m8gra40";
};
};
"reactix" = { "reactix" = {
name = "reactix"; name = "reactix";
version = "v0.4.6"; version = "v0.4.11";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://github.com/irresponsible/purescript-reactix"; url = "https://github.com/poorscript/purescript-reactix";
rev = "v0.4.6"; rev = "v0.4.11";
sha256 = "0q3cq3d9385jq9dlpjhfqdc4b4nvxxlmjncs3fr4xk8vv24j3kns"; sha256 = "1prxqww81lk32cp4mr318yanvf51kf9hz7x4n6rxdbcprj27710d";
}; };
}; };
"read" = { "read" = {
...@@ -928,15 +910,6 @@ ...@@ -928,15 +910,6 @@
sha256 = "0n0sxr44d1lwlrgv8b48ml6vg0r5abfvyywn50jb0i1agnm53i4n"; sha256 = "0n0sxr44d1lwlrgv8b48ml6vg0r5abfvyywn50jb0i1agnm53i4n";
}; };
}; };
"thermite" = {
name = "thermite";
version = "hide-2020-03-04";
src = pkgs.fetchgit {
url = "https://github.com/poorscript/purescript-thermite.git";
rev = "hide-2020-03-04";
sha256 = "1s0fj6f7kqafiw027yw65f5193kph51x6dxw0wv3g6j77yxmk92i";
};
};
"these" = { "these" = {
name = "these"; name = "these";
version = "v4.0.0"; version = "v4.0.0";
...@@ -946,6 +919,15 @@ ...@@ -946,6 +919,15 @@
sha256 = "0ywwpbcz1d0pdi3f9h9kla52vq1if8zwdz7jq7lqz5s8zj8kyg5r"; sha256 = "0ywwpbcz1d0pdi3f9h9kla52vq1if8zwdz7jq7lqz5s8zj8kyg5r";
}; };
}; };
"toestand" = {
name = "toestand";
version = "v0.5.0";
src = pkgs.fetchgit {
url = "https://github.com/poorscript/purescript-toestand";
rev = "v0.5.0";
sha256 = "1y4pji0gw5dzmxxnrzmzfncq6m6qx7yqac2f758fvv6mi6fmf928";
};
};
"transformers" = { "transformers" = {
name = "transformers"; name = "transformers";
version = "v4.2.0"; version = "v4.2.0";
...@@ -1000,6 +982,15 @@ ...@@ -1000,6 +982,15 @@
sha256 = "1kp1b35y8wzin9m5lfyp239nclq703xz2b4373x3075xfp6qdcwf"; sha256 = "1kp1b35y8wzin9m5lfyp239nclq703xz2b4373x3075xfp6qdcwf";
}; };
}; };
"typisch" = {
name = "typisch";
version = "v0.2.1";
src = pkgs.fetchgit {
url = "https://github.com/poorscript/purescript-typisch";
rev = "v0.2.1";
sha256 = "1jccgfayh20qsmqgbh54knl4dwbwk3144mkzzv2pi07jprp8mzbf";
};
};
"uint" = { "uint" = {
name = "uint"; name = "uint";
version = "v5.1.1"; version = "v5.1.1";
......
...@@ -6,7 +6,7 @@ import Data.Array as A ...@@ -6,7 +6,7 @@ import Data.Array as A
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Monoid (guard) import Data.Monoid (guard)
import Data.Set as Set import Data.Set as Set
import Data.Traversable (traverse_) import Data.Traversable (traverse_, traverse)
import Data.Tuple (Tuple(..), fst, snd) import Data.Tuple (Tuple(..), fst, snd)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
...@@ -51,8 +51,8 @@ here = R2.here "Gargantext.Components.Forest.Tree" ...@@ -51,8 +51,8 @@ here = R2.here "Gargantext.Components.Forest.Tree"
-- Shared by every component here + performAction + nodeSpan -- Shared by every component here + performAction + nodeSpan
type Universal = type Universal =
( tasks :: GAT.Reductor ( reloadRoot :: T.Cursor T2.Reload
, reloadRoot :: T.Cursor T2.Reload ) , tasks :: GAT.Reductor )
-- Shared by every component here + nodeSpan -- Shared by every component here + nodeSpan
type Global = type Global =
...@@ -78,7 +78,7 @@ treeLoaderCpt = here.component "treeLoader" cpt where ...@@ -78,7 +78,7 @@ treeLoaderCpt = here.component "treeLoader" cpt where
app <- T.useLive T.unequal p.reloadRoot app <- T.useLive T.unequal p.reloadRoot
reload <- T.useLive T.unequal p.reload reload <- T.useLive T.unequal p.reload
let fetch _ = getNodeTree session root let fetch _ = getNodeTree session root
useLoader { app, forest, root } fetch (loaded session) where useLoader { app, root } fetch (loaded session) where
loaded session tree' = tree props [] where loaded session tree' = tree props [] where
props = Record.merge common extra where props = Record.merge common extra where
common = RecordE.pick p :: Record Common common = RecordE.pick p :: Record Common
...@@ -168,12 +168,14 @@ type PerformActionProps = ...@@ -168,12 +168,14 @@ type PerformActionProps =
-- | This thing is basically a hangover from when garg was a thermite -- | This thing is basically a hangover from when garg was a thermite
-- | application. we should slowly get rid of it. -- | application. we should slowly get rid of it.
performAction :: Action -> Record PerformActionProps -> Aff Unit performAction :: Action -> Record PerformActionProps -> Aff Unit
performAction (DeleteNode nt) p@{ forestOpen: (_ /\ setOpenNodes), tree: (NTree (LNode {id, parent_id}) _) } = do performAction (DeleteNode nt) p@{ forestOpen
, session
, tree: (NTree (LNode {id, parent_id}) _) } = do
case nt of case nt of
GT.NodePublic GT.FolderPublic -> void $ deleteNode session nt id GT.NodePublic GT.FolderPublic -> void $ deleteNode session nt id
GT.NodePublic _ -> void $ unpublishNode session parent_id id GT.NodePublic _ -> void $ unpublishNode session parent_id id
_ -> void $ deleteNode session nt id _ -> void $ deleteNode session nt id
liftEffect $ setOpenNodes (Set.delete (mkNodeId session id)) _ <- liftEffect $ T.modify (Set.delete (mkNodeId session id)) forestOpen
performAction RefreshTree p performAction RefreshTree p
performAction (DoSearch task) p@{ tree: (NTree (LNode {id}) _) } = liftEffect $ do performAction (DoSearch task) p@{ tree: (NTree (LNode {id}) _) } = liftEffect $ do
(snd p.tasks) $ GAT.Insert id task (snd p.tasks) $ GAT.Insert id task
...@@ -188,16 +190,17 @@ performAction (RenameNode name) p@{ tree: (NTree (LNode {id}) _) } = do ...@@ -188,16 +190,17 @@ performAction (RenameNode name) p@{ tree: (NTree (LNode {id}) _) } = do
performAction RefreshTree p performAction RefreshTree p
performAction (ShareTeam username) p@{ tree: (NTree (LNode {id}) _)} = performAction (ShareTeam username) p@{ tree: (NTree (LNode {id}) _)} =
void $ Share.shareReq p.session id $ Share.ShareTeamParams {username} void $ Share.shareReq p.session id $ Share.ShareTeamParams {username}
performAction (SharePublic { params }) p@{ forestOpen: (_ /\ setOpenNodes)} = traverse_ f params where performAction (SharePublic { params }) p@{ forestOpen } = traverse_ f params where
f (SubTreeOut { in: inId, out }) = do f (SubTreeOut { in: inId, out }) = do
void $ Share.shareReq p.session inId $ Share.SharePublicParams { node_id: out } void $ Share.shareReq p.session inId $ Share.SharePublicParams { node_id: out }
liftEffect $ setOpenNodes (Set.insert (mkNodeId p.session out)) _ <- liftEffect $ T.modify (Set.insert (mkNodeId p.session out)) forestOpen
performAction RefreshTree p performAction RefreshTree p
performAction (AddContact params) p@{ tree: (NTree (LNode {id}) _) } = performAction (AddContact params) p@{ tree: (NTree (LNode {id}) _) } =
void $ Contact.contactReq p.session id params void $ Contact.contactReq p.session id params
performAction (AddNode name nodeType) p@{ forestOpen: (_ /\ setOpenNodes), tree: (NTree (LNode { id }) _) } = do performAction (AddNode name nodeType) p@{ forestOpen
, tree: (NTree (LNode { id }) _) } = do
task <- addNode p.session id $ AddNodeValue {name, nodeType} task <- addNode p.session id $ AddNodeValue {name, nodeType}
liftEffect $ setOpenNodes (Set.insert (mkNodeId p.session id)) _ <- liftEffect $ T.modify (Set.insert (mkNodeId p.session id)) forestOpen
performAction RefreshTree p performAction RefreshTree p
performAction (UploadFile nodeType fileType mName blob) p@{ tree: (NTree (LNode { id }) _) } = do performAction (UploadFile nodeType fileType mName blob) p@{ tree: (NTree (LNode { id }) _) } = do
task <- uploadFile p.session nodeType id fileType {mName, blob} task <- uploadFile p.session nodeType id fileType {mName, blob}
...@@ -210,16 +213,17 @@ performAction (UploadArbitraryFile mName blob) p@{ tree: (NTree (LNode { id }) _ ...@@ -210,16 +213,17 @@ performAction (UploadArbitraryFile mName blob) p@{ tree: (NTree (LNode { id }) _
(snd p.tasks) $ GAT.Insert id task (snd p.tasks) $ GAT.Insert id task
log2 "[performAction] UploadArbitraryFile, uploaded, task:" task log2 "[performAction] UploadArbitraryFile, uploaded, task:" task
performAction DownloadNode _ = liftEffect $ log "[performAction] DownloadNode" performAction DownloadNode _ = liftEffect $ log "[performAction] DownloadNode"
performAction (MoveNode {params}) p@{ forestOpen: (_ /\ setOpenNodes) } = traverse_ f params where performAction (MoveNode {params}) p@{ forestOpen
f SubTreeOut { in: in', out } = do , session } = traverse_ f params where
f (SubTreeOut { in: in', out }) = do
void $ moveNodeReq p.session in' out void $ moveNodeReq p.session in' out
liftEffect $ setOpenNodes (Set.insert (mkNodeId session out)) _ <- liftEffect $ T.modify (Set.insert (mkNodeId session out)) forestOpen
performAction RefreshTree p performAction RefreshTree p
performAction (MergeNode { params }) p = traverse f params where performAction (MergeNode { params }) p = traverse_ f params where
f (SubTreeOut { in: in', out }) = do f (SubTreeOut { in: in', out }) = do
void $ mergeNodeReq p.session in' out void $ mergeNodeReq p.session in' out
performAction RefreshTree p performAction RefreshTree p
performAction (LinkNode { nodeType, params }) p = traverse f params where performAction (LinkNode { nodeType, params }) p = traverse_ f params where
f (SubTreeOut { in: in', out }) = do f (SubTreeOut { in: in', out }) = do
void $ linkNodeReq p.session nodeType in' out void $ linkNodeReq p.session nodeType in' out
performAction RefreshTree p performAction RefreshTree p
......
...@@ -44,16 +44,16 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node" ...@@ -44,16 +44,16 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node"
-- Main Node -- Main Node
type NodeMainSpanProps = type NodeMainSpanProps =
( reloadRoot :: T.Cursor T2.Reload ( folderOpen :: T.Cursor Boolean
, tasks :: GAT.Reductor
, route :: Routes.AppRoute
, folderOpen :: T.Cursor Boolean
, frontends :: Frontends , frontends :: Frontends
, id :: ID , id :: ID
, isLeaf :: IsLeaf , isLeaf :: IsLeaf
, name :: Name , name :: Name
, nodeType :: GT.NodeType , nodeType :: GT.NodeType
, reloadRoot :: T.Cursor T2.Reload
, route :: Routes.AppRoute
, setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit)) , setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit))
, tasks :: GAT.Reductor
| CommonProps | CommonProps
) )
...@@ -97,9 +97,9 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt ...@@ -97,9 +97,9 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
let isSelected = Just route == Routes.nodeTypeAppRoute nodeType (sessionId session) id let isSelected = Just route == Routes.nodeTypeAppRoute nodeType (sessionId session) id
pure $ H.span (dropProps droppedFile isDragOver) pure $ H.span (dropProps droppedFile isDragOver)
$ switchHanded $ GT.reverseHanded
[ folderIcon nodeType folderOpen [ folderIcon { folderOpen, nodeType } []
, chevronIcon isLeaf handed nodeType folderOpen , chevronIcon { folderOpen, handed, isLeaf, nodeType } []
, nodeLink { frontends, handed, folderOpen, id, isSelected , nodeLink { frontends, handed, folderOpen, id, isSelected
, name: name' props, nodeType, session } [] , name: name' props, nodeType, session } []
...@@ -129,9 +129,9 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt ...@@ -129,9 +129,9 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
, nodeActions { id , nodeActions { id
, nodeType , nodeType
, refresh: const $ dispatch RefreshTree
, session , session
, triggerRefresh: const $ dispatch RefreshTree } []
}
] handed ] handed
where where
onTaskFinish id t _ = do onTaskFinish id t _ = do
...@@ -153,21 +153,6 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt ...@@ -153,21 +153,6 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
, session , session
} }
chevronIcon true handed' nodeType (open /\ setOpen) = H.div {} []
chevronIcon false handed' nodeType (open /\ setOpen) =
H.a { className: "chevron-icon"
, on: { click: \_ -> setOpen $ not }
}
[ H.i { className: if open
then "fa fa-chevron-down"
else if handed' == GT.RightHanded
then "fa fa-chevron-right"
else "fa fa-chevron-left"
} [] ]
folderIcon nodeType (open /\ setOpen) =
H.a { className: "folder-icon", on: { click: \_ -> setOpen $ not } }
[ H.i {className: GT.fldr nodeType open} [] ]
popOverIcon = popOverIcon =
H.a { className: "settings fa fa-cog" H.a { className: "settings fa fa-cog"
, title : "Each node of the Tree can perform some actions.\n" , title : "Each node of the Tree can perform some actions.\n"
...@@ -204,6 +189,49 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt ...@@ -204,6 +189,49 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
setIsDragOver $ const true setIsDragOver $ const true
onDragLeave (_ /\ setIsDragOver) _ = setIsDragOver $ const false onDragLeave (_ /\ setIsDragOver) _ = setIsDragOver $ const false
type FolderIconProps = (
folderOpen :: T.Cursor Boolean
, nodeType :: GT.NodeType
)
folderIcon :: R2.Component FolderIconProps
folderIcon = R.createElement folderIconCpt
folderIconCpt :: R.Component FolderIconProps
folderIconCpt = here.component "folderIcon" cpt
where
cpt { folderOpen, nodeType } _ = do
open <- T.read folderOpen
pure $ H.a { className: "folder-icon", on: { click: \_ -> T.modify not folderOpen } }
[ H.i { className: GT.fldr nodeType open } [] ]
type ChevronIconProps = (
folderOpen :: T.Cursor Boolean
, handed :: GT.Handed
, isLeaf :: Boolean
, nodeType :: GT.NodeType
)
chevronIcon :: R2.Component ChevronIconProps
chevronIcon = R.createElement chevronIconCpt
chevronIconCpt :: R.Component ChevronIconProps
chevronIconCpt = here.component "chevronIcon" cpt
where
cpt { folderOpen, handed, isLeaf: true, nodeType } _ = do
pure $ H.div {} []
cpt { folderOpen, handed, isLeaf: false, nodeType } _ = do
open <- T.read folderOpen
pure $ H.a { className: "chevron-icon"
, on: { click: \_ -> T.modify not folderOpen }
}
[ H.i { className: if open
then "fa fa-chevron-down"
else if handed == GT.RightHanded
then "fa fa-chevron-right"
else "fa fa-chevron-left"
} [] ]
{- {-
fldr nt open = if open fldr nt open = if open
then "fa fa-globe" -- <> color nt then "fa fa-globe" -- <> color nt
...@@ -221,14 +249,14 @@ fldr nt open = if open ...@@ -221,14 +249,14 @@ fldr nt open = if open
type NodeActionsCommon = type NodeActionsCommon =
( id :: ID ( id :: ID
, session :: Session
, refresh :: Unit -> Aff Unit , refresh :: Unit -> Aff Unit
, session :: Session
) )
type NodeActionsProps = ( nodeType :: GT.NodeType | NodeActionsCommon ) type NodeActionsProps = ( nodeType :: GT.NodeType | NodeActionsCommon )
nodeActions :: Record NodeActionsProps -> R.Element nodeActions :: R2.Component NodeActionsProps
nodeActions p = R.createElement nodeActionsCpt p [] nodeActions = R.createElement nodeActionsCpt
nodeActionsCpt :: R.Component NodeActionsProps nodeActionsCpt :: R.Component NodeActionsProps
nodeActionsCpt = here.component "nodeActions" cpt where nodeActionsCpt = here.component "nodeActions" cpt where
......
-- TODO copy of Gargantext.Components.Nodes.Corpus.Tabs.Specs -- TODO copy of Gargantext.Components.Nodes.Corpus.Tabs.Specs
module Gargantext.Components.Nodes.Annuaire.User.Tabs where module Gargantext.Components.Nodes.Annuaire.Tabs where
import Prelude hiding (div) import Prelude hiding (div)
import Effect.Aff (Aff) import Effect.Aff (Aff)
...@@ -51,22 +51,17 @@ modeTabType' Books = CTabAuthors ...@@ -51,22 +51,17 @@ modeTabType' Books = CTabAuthors
modeTabType' Communication = CTabAuthors modeTabType' Communication = CTabAuthors
type TabsProps = type TabsProps =
( tasks :: R.Ref (Maybe GAT.Reductor) ( cacheState :: R.State LTypes.CacheState
, cacheState :: R.State LTypes.CacheState
, contactData :: ContactData , contactData :: ContactData
, frontends :: Frontends , frontends :: Frontends
, nodeId :: Int , nodeId :: Int
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, reloadForest :: T.Cursor (T2.InitReload T.Cursor) , reloadForest :: T.Cursor (T2.InitReload T.Cursor)
, reloadRoot :: T.Cursor T2.Reload , reloadRoot :: T.Cursor T2.Reload
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, tasks :: R.Ref (Maybe GAT.Reductor)
) )
type NgramsViewTabsProps =
( mode :: Mode
, defaultListId :: Int
| TabsProps )
tabs :: R2.Leaf TabsProps tabs :: R2.Leaf TabsProps
tabs props = R.createElement tabsCpt props [] tabs props = R.createElement tabsCpt props []
...@@ -83,31 +78,40 @@ tabsCpt = here.component "tabs" cpt where ...@@ -83,31 +78,40 @@ tabsCpt = here.component "tabs" cpt where
, "Communication" /\ ngramsView (viewProps Communication) , "Communication" /\ ngramsView (viewProps Communication)
, "Trash" /\ docs trg -- TODO pass-in trash mode , "Trash" /\ docs trg -- TODO pass-in trash mode
] where ] where
viewProps mode = Record.merge dtCommon { mode } viewProps mode = Record.merge props { defaultListId: props.contactData.defaultListId
, mode }
totalRecords = 4736 -- TODO lol totalRecords = 4736 -- TODO lol
docs sidePanelTriggers = DT.docViewLayout (Record.merge dtCommon dtExtra) docs sidePanelTriggers = DT.docViewLayout (Record.merge { sidePanelTriggers } $ Record.merge dtCommon dtExtra)
dtCommon = RX.pick props :: Record DTCommon dtCommon = RX.pick props :: Record DTCommon
dtExtra = dtExtra =
{ chart: mempty, mCorpusId: Nothing, showSearch: true { chart: mempty
, listId: props.contactData.defaultListId , listId: props.contactData.defaultListId
, tabType: TabPairing TabDocs, totalRecords , mCorpusId: Nothing
, showSearch: true
, tabType: TabPairing TabDocs
, totalRecords
} }
type DTCommon = type DTCommon =
( cacheState :: R.State LTypes.CacheState ( cacheState :: R.State LTypes.CacheState
, contactData :: ContactData -- , contactData :: ContactData
, frontends :: Frontends , frontends :: Frontends
, nodeId :: Int , nodeId :: Int
, session :: Session , session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers -- , sidePanelTriggers :: Record LTypes.SidePanelTriggers
) )
type NgramsViewTabsProps =
( defaultListId :: Int
, mode :: Mode
| TabsProps )
ngramsView :: R2.Leaf NgramsViewTabsProps ngramsView :: R2.Leaf NgramsViewTabsProps
ngramsView props = R.createElement ngramsViewCpt props [] ngramsView props = R.createElement ngramsViewCpt props []
ngramsViewCpt :: R.Component NgramsViewTabsProps ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt = here.component "ngramsView" cpt where ngramsViewCpt = here.component "ngramsView" cpt where
cpt props@{ defaultListId, nodeId, session, mode } _ = do cpt props@{ defaultListId, mode, nodeId, session } _ = do
path <- R.useState' $ path <- R.useState' $
NTC.initialPageParams session nodeId NTC.initialPageParams session nodeId
[ defaultListId ] (TabDocument TabDocs) [ defaultListId ] (TabDocument TabDocs)
...@@ -123,12 +127,12 @@ ngramsViewCpt = here.component "ngramsView" cpt where ...@@ -123,12 +127,12 @@ ngramsViewCpt = here.component "ngramsView" cpt where
afterSync _ = pure unit afterSync _ = pure unit
type NTCommon = type NTCommon =
( tasks :: R.Ref (Maybe GAT.Reductor) ( cacheState :: R.State LTypes.CacheState
, cacheState :: R.State LTypes.CacheState , defaultListId :: Int
, nodeId :: Int , nodeId :: Int
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, reloadForest :: T.Cursor (T2.InitReload T.Cursor) , reloadForest :: T.Cursor (T2.InitReload T.Cursor)
, reloadRoot :: T.Cursor T2.Reload , reloadRoot :: T.Cursor T2.Reload
, defaultListId :: Int , session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, tasks :: R.Ref (Maybe GAT.Reductor)
) )
...@@ -14,11 +14,12 @@ import Effect.Aff (Aff, launchAff_) ...@@ -14,11 +14,12 @@ import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.AsyncTasks as GAT import Gargantext.AsyncTasks as GAT
import Gargantext.Components.InputWithEnter (inputWithEnter) import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.User.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser) import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser)
import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Types as LT import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
...@@ -28,9 +29,10 @@ import Gargantext.Sessions (Session, get, put, sessionId) ...@@ -28,9 +29,10 @@ import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (NodeType(..)) import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Toestand as T2
thisModule :: String here :: R2.Here
thisModule = "Gargantext.Components.Nodes.Annuaire.User" here = R2.here "Gargantext.Components.Nodes.Annuaire.User"
type DisplayProps = ( type DisplayProps = (
title :: String title :: String
...@@ -40,7 +42,7 @@ display :: R2.Component DisplayProps ...@@ -40,7 +42,7 @@ display :: R2.Component DisplayProps
display = R.createElement displayCpt display = R.createElement displayCpt
displayCpt :: R.Component DisplayProps displayCpt :: R.Component DisplayProps
displayCpt = R.hooksComponentWithModule thisModule "display" cpt displayCpt = here.component "display" cpt
where where
cpt { title } children = do cpt { title } children = do
pure $ H.div { className: "container-fluid" } pure $ H.div { className: "container-fluid" }
...@@ -96,7 +98,7 @@ contactInfoItem :: Record ContactInfoItemProps -> R.Element ...@@ -96,7 +98,7 @@ contactInfoItem :: Record ContactInfoItemProps -> R.Element
contactInfoItem props = R.createElement contactInfoItemCpt props [] contactInfoItem props = R.createElement contactInfoItemCpt props []
contactInfoItemCpt :: R.Component ContactInfoItemProps contactInfoItemCpt :: R.Component ContactInfoItemProps
contactInfoItemCpt = R.hooksComponentWithModule thisModule "contactInfoItem" cpt contactInfoItemCpt = here.component "contactInfoItem" cpt
where where
cpt {hyperdata, label, lens, onUpdateHyperdata, placeholder} _ = do cpt {hyperdata, label, lens, onUpdateHyperdata, placeholder} _ = do
isEditing <- R.useState' false isEditing <- R.useState' false
...@@ -150,12 +152,12 @@ listElement :: Array R.Element -> R.Element ...@@ -150,12 +152,12 @@ listElement :: Array R.Element -> R.Element
listElement = H.li { className: "list-group-item justify-content-between" } listElement = H.li { className: "list-group-item justify-content-between" }
type LayoutProps = type LayoutProps =
( reloadRoot :: GUR.ReloadS ( frontends :: Frontends
, tasks :: R.Ref (Maybe GAT.Reductor)
, frontends :: Frontends
, nodeId :: Int , nodeId :: Int
, reloadForest :: T.Cursor (T2.InitReload T.Cursor)
, reloadRoot :: T.Cursor T2.Reload
, session :: Session , session :: Session
, reloadForest :: GUR.ReloadWithInitializeRef , tasks :: R.Ref (Maybe GAT.Reductor)
) )
type KeyLayoutProps = ( type KeyLayoutProps = (
...@@ -167,7 +169,7 @@ userLayout :: Record LayoutProps -> R.Element ...@@ -167,7 +169,7 @@ userLayout :: Record LayoutProps -> R.Element
userLayout props = R.createElement userLayoutCpt props [] userLayout props = R.createElement userLayoutCpt props []
userLayoutCpt :: R.Component LayoutProps userLayoutCpt :: R.Component LayoutProps
userLayoutCpt = R.hooksComponentWithModule thisModule "userLayout" cpt userLayoutCpt = here.component "userLayout" cpt
where where
cpt { reloadRoot, tasks, frontends, nodeId, session, reloadForest } _ = do cpt { reloadRoot, tasks, frontends, nodeId, session, reloadForest } _ = do
let sid = sessionId session let sid = sessionId session
...@@ -186,9 +188,9 @@ userLayoutWithKey :: Record KeyLayoutProps -> R.Element ...@@ -186,9 +188,9 @@ userLayoutWithKey :: Record KeyLayoutProps -> R.Element
userLayoutWithKey props = R.createElement userLayoutWithKeyCpt props [] userLayoutWithKey props = R.createElement userLayoutWithKeyCpt props []
userLayoutWithKeyCpt :: R.Component KeyLayoutProps userLayoutWithKeyCpt :: R.Component KeyLayoutProps
userLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "userLayoutWithKey" cpt userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt
where where
cpt { reloadRoot, tasks, frontends, nodeId, session, reloadForest } _ = do cpt { frontends, nodeId, reloadForest, reloadRoot, session, tasks } _ = do
reload <- GUR.new reload <- GUR.new
cacheState <- R.useState' LT.CacheOn cacheState <- R.useState' LT.CacheOn
...@@ -201,15 +203,15 @@ userLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "userLayoutWithKey" ...@@ -201,15 +203,15 @@ userLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "userLayoutWithKey"
display { title: fromMaybe "no name" name } display { title: fromMaybe "no name" name }
(contactInfos hyperdata (onUpdateHyperdata reload)) (contactInfos hyperdata (onUpdateHyperdata reload))
, Tabs.tabs { , Tabs.tabs {
reloadRoot cacheState
, tasks
, cacheState
, contactData , contactData
, frontends , frontends
, nodeId , nodeId
, reloadForest
, reloadRoot
, session , session
, sidePanelTriggers , sidePanelTriggers
, reloadForest , tasks
} }
] ]
where where
......
...@@ -96,7 +96,7 @@ corpus :: Record Props -> SessionId -> NodeId -> R.Element ...@@ -96,7 +96,7 @@ corpus :: Record Props -> SessionId -> NodeId -> R.Element
corpus props@{ tasks, cursors, views } sessionId nodeId = corpus props@{ tasks, cursors, views } sessionId nodeId =
authed props sessionId $ authed props sessionId $
forested props forested props
[ corpusLayout { nodeId, session: views.session } [ corpusLayout { nodeId, session: views.session } ]
corpusDocument :: Record Props -> SessionId -> CorpusId -> ListId -> NodeId -> R.Element corpusDocument :: Record Props -> SessionId -> CorpusId -> ListId -> NodeId -> R.Element
corpusDocument props@{ tasks, cursors, views } sessionId corpusId' listId nodeId = corpusDocument props@{ tasks, cursors, views } sessionId corpusId' listId nodeId =
...@@ -127,8 +127,15 @@ lists props@{ tasks ...@@ -127,8 +127,15 @@ lists props@{ tasks
, views: { backend, route, handed, sessions } } sessionId nodeId = , views: { backend, route, handed, sessions } } sessionId nodeId =
authed props sessionId $ authed props sessionId $
Lists.listsWithForest Lists.listsWithForest
{ forestProps: { tasks, backend, route, handed, sessions, { forestProps: { backend
, reloadForest, reloadRoot, showLogin, frontends } , frontends
, handed
, reloadForest
, reloadRoot
, route
, sessions
, showLogin
, tasks }
, listsProps: { tasks, reloadRoot, reloadForest, nodeId, session } , listsProps: { tasks, reloadRoot, reloadForest, nodeId, session }
} [] } []
where frontends = defaultFrontends where frontends = defaultFrontends
......
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