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
122
Issues
122
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
1f522286
Commit
1f522286
authored
Nov 25, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Annuaire] add annuaire user page
parent
6fe73e39
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
6 deletions
+43
-6
App.purs
src/Gargantext/Components/App.purs
+2
-2
Contacts.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
+38
-1
Router.purs
src/Gargantext/Router.purs
+1
-1
Routes.purs
src/Gargantext/Routes.purs
+2
-2
No files found.
src/Gargantext/Components/App.purs
View file @
1f522286
...
...
@@ -17,7 +17,7 @@ import Gargantext.Components.Login (login)
import Gargantext.Config (defaultFrontends, defaultBackends)
import Gargantext.Components.Folder (folder)
import Gargantext.Components.Nodes.Annuaire (annuaireLayout)
import Gargantext.Components.Nodes.Annuaire.User.Contacts (userLayout)
import Gargantext.Components.Nodes.Annuaire.User.Contacts (
annuaireUserLayout,
userLayout)
import Gargantext.Components.Nodes.Corpus (corpusLayout)
import Gargantext.Components.Nodes.Corpus.Document (documentLayout)
import Gargantext.Components.Nodes.Corpus.Dashboard (dashboardLayout)
...
...
@@ -65,7 +65,7 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
Dashboard sid _nodeId -> withSession sid $ \session -> forested $ dashboardLayout {}
Annuaire sid nodeId -> withSession sid $ \session -> forested $ annuaireLayout { frontends, nodeId, session }
UserPage sid nodeId -> withSession sid $ \session -> forested $ userLayout { frontends, nodeId, session }
ContactPage sid
_aId nodeId -> withSession sid $ \session -> forested $ userLayout {
frontends, nodeId, session }
ContactPage sid
aId nodeId -> withSession sid $ \session -> forested $ annuaireUserLayout { annuaireId: aId,
frontends, nodeId, session }
CorpusDocument sid corpusId listId nodeId ->
withSession sid $ \session -> forested $ documentLayout { nodeId, listId, session, corpusId: Just corpusId }
Document sid listId nodeId ->
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
View file @
1f522286
module Gargantext.Components.Nodes.Annuaire.User.Contacts
( module Gargantext.Components.Nodes.Annuaire.User.Contacts.Types
, annuaireUserLayout
, userLayout )
where
import Prelude (bind, pure, ($), (<<<), (<>), (<$>))
import Prelude (bind, pure, ($), (<<<), (<>), (<$>)
, show, discard
)
import Data.Array (head)
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Newtype (unwrap)
import Data.String (joinWith)
import DOM.Simple.Console (log2)
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
...
...
@@ -18,6 +20,7 @@ import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types
( Contact(..), ContactData, ContactTouch(..), ContactWhere(..)
, ContactWho(..), HyperData(..), HyperdataContact(..) )
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs as Tabs
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes
import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session, get)
...
...
@@ -151,3 +154,37 @@ getContact session id = do
-- throwError $ error "Missing default list"
pure {contactNode, defaultListId: 424242}
type AnnuaireLayoutProps =
( annuaireId :: Int
| LayoutProps )
annuaireUserLayout :: Record AnnuaireLayoutProps -> R.Element
annuaireUserLayout props = R.createElement annuaireUserLayoutCpt props []
annuaireUserLayoutCpt :: R.Component AnnuaireLayoutProps
annuaireUserLayoutCpt = R.hooksComponent "G.C.Nodes.Annuaire.User.Contacts.annuaireUserLayout" cpt
where
cpt {annuaireId, frontends, nodeId, session} _ = do
R.useEffect' $ do
log2 "[annuaireUserLayoutCpt] annuaireId" annuaireId
log2 "[annuaireUserLayoutCpt] nodeId" nodeId
useLoader nodeId (getAnnuaireContact session annuaireId) $
\contactData@{contactNode: Contact {name, hyperdata}} ->
H.ul { className: "col-md-12 list-group" }
[ display (fromMaybe "no name" name) (contactInfos hyperdata)
, Tabs.tabs {frontends, nodeId, contactData, session} ]
getAnnuaireContact :: Session -> Int -> Int -> Aff ContactData
getAnnuaireContact session annuaireId id = do
contactNode <- get session $ NodeAPI Annuaire (Just annuaireId) $ "/contact" <> (show id)
-- TODO: we need a default list for the pairings
--defaultListIds <- get $ toUrl endConfigStateful Back (Children NodeList 0 1 Nothing) $ Just id
--case (head defaultListIds :: Maybe (NodePoly HyperdataList)) of
-- Just (NodePoly { id: defaultListId }) ->
-- pure {contactNode, defaultListId}
-- Nothing ->
-- throwError $ error "Missing default list"
pure {contactNode, defaultListId: 424242}
src/Gargantext/Router.purs
View file @
1f522286
src/Gargantext/Routes.purs
View file @
1f522286
...
...
@@ -17,7 +17,7 @@ data AppRoute
| Lists SessionId Int
| Annuaire SessionId Int
| UserPage SessionId Int
| ContactPage SessionId
AnnuaireId ContactId
| ContactPage SessionId
Int Int
type AnnuaireId = Int
type ContactId = Int
...
...
@@ -47,7 +47,7 @@ instance showAppRoute :: Show AppRoute where
show (Lists s i) = "lists" <> show i <> " (" <> show s <> ")"
show (Annuaire s i) = "Annuaire" <> show i <> " (" <> show s <> ")"
show (UserPage s i) = "User" <> show i <> " (" <> show s <> ")"
show (ContactPage s
_a i) = "Contact"
<> show i <> " (" <> show s <> ")"
show (ContactPage s
a i) = "Contact" <> show a <> "::"
<> show i <> " (" <> show s <> ")"
appPath :: AppRoute -> String
appPath Home = ""
...
...
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