Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
df277c4e
Commit
df277c4e
authored
Jul 23, 2022
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Team] team layout component
parent
08c8d76c
Pipeline
#3053
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
Team.purs
src/Gargantext/Components/Nodes/Team.purs
+27
-4
No files found.
src/Gargantext/Components/Nodes/Team.purs
View file @
df277c4e
...
...
@@ -2,17 +2,20 @@ module Gargantext.Components.Nodes.Team where
import Gargantext.Prelude
import Effect.Class (liftEffect)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.FolderView as FV
import Gargantext.Components.GraphQL.Endpoints (getTeam, deleteTeamMembership)
import Gargantext.Components.GraphQL.Team (TeamMember)
import Gargantext.Components.GraphQL.Endpoints (getTeam)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Sessions (Session)
import Gargantext.Types (ID)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Team"
...
...
@@ -39,6 +42,9 @@ teamLayoutMain = R2.leafComponent teamLayoutMainCpt
teamLayoutMainCpt :: R.Component Props
teamLayoutMainCpt = here.component "teamLayoutMain" cpt where
cpt { nodeId, session, boxes } _ = do
reload <- T.useBox T2.newReload
_ <- T.useLive T.unequal reload
useLoader { errorHandler
, loader: loadTeam
, path: { nodeId, session }
...
...
@@ -46,6 +52,7 @@ teamLayoutMainCpt = here.component "teamLayoutMain" cpt where
, team
, nodeId
, session
, reload
}
}
where
...
...
@@ -55,17 +62,22 @@ type TeamProps =
( boxes :: Boxes
, nodeId :: ID
, session :: Session
, team :: Array TeamMember )
, team :: Array TeamMember
, reload :: T.Box T2.Reload )
teamLayoutRows :: R2.Leaf TeamProps
teamLayoutRows = R2.leafComponent teamLayoutRowsCpt
teamLayoutRowsCpt :: R.Component TeamProps
teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where
cpt { team } _ = do
cpt { team
, nodeId, session, reload
} _ = do
pure $ H.div {} $ map makeTeam team
where
makeTeam { username } = H.p {} [H.text username]
makeTeam { username, shared_folder_id } = H.div {} [H.text username, H.button {className: "btn btn-danger", on: {click: submit shared_folder_id}} [ H.text "remove" ]]
submit sharedFolderId = do
_ <- saveDeleteTeam { session, nodeId, sharedFolderId }
liftEffect $ T2.reload reload
type LoadProps =
(
...
...
@@ -76,3 +88,14 @@ type LoadProps =
loadTeam :: Record LoadProps -> AffRESTError (Array TeamMember)
loadTeam { session, nodeId } = getTeam session nodeId
type DeleteProps =
(
session :: Session,
nodeId :: Int,
sharedFolderId :: Int
)
saveDeleteTeam ∷ Record DeleteProps -> AffRESTError Int
saveDeleteTeam { session, nodeId, sharedFolderId } = deleteTeamMembership session sharedFolderId nodeId
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment