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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
91ac5d18
Commit
91ac5d18
authored
Apr 18, 2022
by
arturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
>>> continue
parent
7fe038e4
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
323 additions
and
21 deletions
+323
-21
bootstrap-darkster.css
dist/styles/bootstrap-darkster.css
+13
-0
bootstrap-default.css
dist/styles/bootstrap-default.css
+13
-0
bootstrap-greyson.css
dist/styles/bootstrap-greyson.css
+13
-0
bootstrap-herbie.css
dist/styles/bootstrap-herbie.css
+13
-0
bootstrap-monotony.css
dist/styles/bootstrap-monotony.css
+13
-0
DocList.purs
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
+184
-0
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar/Sidebar.purs
+55
-21
_graph.sass
src/sass/_legacy/_graph.sass
+19
-0
No files found.
dist/styles/bootstrap-darkster.css
View file @
91ac5d18
...
@@ -7482,6 +7482,19 @@ input[type=range]:-moz-focusring {
...
@@ -7482,6 +7482,19 @@ input[type=range]:-moz-focusring {
margin-top
:
16px
;
margin-top
:
16px
;
}
}
.graph-doc-list__item__title
,
.graph-doc-list__item__source
,
.graph-doc-list__item__date
{
line-height
:
1.3
;
margin-bottom
:
4px
;
}
.graph-doc-list__item__source
{
font-size
:
15px
;
color
:
#DEE2E6
;
}
.graph-doc-list__item__date
{
font-size
:
14px
;
color
:
#CED4DA
;
}
.graph-toolbar
{
.graph-toolbar
{
display
:
flex
;
display
:
flex
;
padding
:
8px
;
padding
:
8px
;
...
...
dist/styles/bootstrap-default.css
View file @
91ac5d18
...
@@ -7435,6 +7435,19 @@ input[type=range]:-moz-focusring {
...
@@ -7435,6 +7435,19 @@ input[type=range]:-moz-focusring {
margin-top
:
16px
;
margin-top
:
16px
;
}
}
.graph-doc-list__item__title
,
.graph-doc-list__item__source
,
.graph-doc-list__item__date
{
line-height
:
1.3
;
margin-bottom
:
4px
;
}
.graph-doc-list__item__source
{
font-size
:
15px
;
color
:
#495057
;
}
.graph-doc-list__item__date
{
font-size
:
14px
;
color
:
#6C757D
;
}
.graph-toolbar
{
.graph-toolbar
{
display
:
flex
;
display
:
flex
;
padding
:
8px
;
padding
:
8px
;
...
...
dist/styles/bootstrap-greyson.css
View file @
91ac5d18
...
@@ -7191,6 +7191,19 @@ input[type=range]:-moz-focusring {
...
@@ -7191,6 +7191,19 @@ input[type=range]:-moz-focusring {
margin-top
:
16px
;
margin-top
:
16px
;
}
}
.graph-doc-list__item__title
,
.graph-doc-list__item__source
,
.graph-doc-list__item__date
{
line-height
:
1.3
;
margin-bottom
:
4px
;
}
.graph-doc-list__item__source
{
font-size
:
15px
;
color
:
#495057
;
}
.graph-doc-list__item__date
{
font-size
:
14px
;
color
:
#6C757D
;
}
.graph-toolbar
{
.graph-toolbar
{
display
:
flex
;
display
:
flex
;
padding
:
8px
;
padding
:
8px
;
...
...
dist/styles/bootstrap-herbie.css
View file @
91ac5d18
...
@@ -7439,6 +7439,19 @@ input[type=range]:-moz-focusring {
...
@@ -7439,6 +7439,19 @@ input[type=range]:-moz-focusring {
margin-top
:
16px
;
margin-top
:
16px
;
}
}
.graph-doc-list__item__title
,
.graph-doc-list__item__source
,
.graph-doc-list__item__date
{
line-height
:
1.3
;
margin-bottom
:
4px
;
}
.graph-doc-list__item__source
{
font-size
:
15px
;
color
:
#495057
;
}
.graph-doc-list__item__date
{
font-size
:
14px
;
color
:
#6C757D
;
}
.graph-toolbar
{
.graph-toolbar
{
display
:
flex
;
display
:
flex
;
padding
:
8px
;
padding
:
8px
;
...
...
dist/styles/bootstrap-monotony.css
View file @
91ac5d18
...
@@ -7440,6 +7440,19 @@ input[type=range]:-moz-focusring {
...
@@ -7440,6 +7440,19 @@ input[type=range]:-moz-focusring {
margin-top
:
16px
;
margin-top
:
16px
;
}
}
.graph-doc-list__item__title
,
.graph-doc-list__item__source
,
.graph-doc-list__item__date
{
line-height
:
1.3
;
margin-bottom
:
4px
;
}
.graph-doc-list__item__source
{
font-size
:
15px
;
color
:
#495057
;
}
.graph-doc-list__item__date
{
font-size
:
14px
;
color
:
#6C757D
;
}
.graph-toolbar
{
.graph-toolbar
{
display
:
flex
;
display
:
flex
;
padding
:
8px
;
padding
:
8px
;
...
...
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
0 → 100644
View file @
91ac5d18
module Gargantext.Components.GraphExplorer.Sidebar.DocList
( docList
) where
import Gargantext.Prelude
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..))
import Data.Sequence as Seq
import Data.Tuple.Nested ((/\))
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.FacetsTable (DocumentsView(..), PagePath, Rows(..), initialPagePath, loadPage, publicationDate)
import Gargantext.Components.GraphExplorer.Types (GraphSideCorpus(..))
import Gargantext.Components.Search (SearchQuery)
import Gargantext.Config.REST (RESTError(..))
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.UpdateEffect (useUpdateEffect1')
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.Sidebar.DocList"
-- @WIP: SIMULATING <Gargantext.Components.Nodes.Corpus.Graph.Tabs>
type TabsProps =
( frontends :: Frontends
, query :: SearchQuery
, session :: Session
, graphSideCorpus :: GraphSideCorpus
)
docList :: R2.Leaf TabsProps
docList = R2.leaf docListCpt
docListCpt :: R.Component TabsProps
docListCpt = here.component "main" cpt where
-- | Helpers
-- |
errorHandler err = do
here.warn2 "[pageLayout] RESTError" err
case err of
ReadJSONError err' ->
here.warn2 "[pageLayout] ReadJSONError" $ show err'
_ -> pure unit
-- | Component
-- |
cpt { frontends
, query
, session
, graphSideCorpus: GraphSideCorpus
{ corpusId: nodeId
, listId
}
} _ = do
-- | States
-- |
path' /\ path
<- R2.useBox' $ initialPagePath { nodeId, listId, query, session }
state' /\ state <-
R2.useBox' Nothing
rows' /\ rows <-
R2.useBox' Nothing
-- | Hooks
-- |
useLoaderEffect
{ errorHandler
, state
, loader: loadPage
, path: path'
}
-- | Effects
-- |
-- (on query change, reload fetched docs)
useUpdateEffect1' query $
flip T.write_ path $ initialPagePath { nodeId, listId, query, session }
-- (on fetch success, extract existing docs)
useUpdateEffect1' state' case state' of
Nothing -> T.write_ (Just Seq.empty) rows
Just r -> case r of
Docs { docs } -> T.write_ (Just docs) rows
_ -> T.write_ (Just Seq.empty) rows
-- | Render
-- |
pure $
R2.fromMaybe_ rows' \results ->
R.fragment
[
R2.if' (results == Seq.empty) $
B.caveat
{}
[
H.text "No docs found in your corpus for your selected terms"
]
,
R2.if' (not $ eq results Seq.empty) $
H.ul
{ className: intercalate " "
[ "graph-doc-list"
, "list-group"
]
} $
Seq.toUnfoldable $ flip Seq.map results \r ->
item
{ frontends
, path: path'
, session
, documentView: (r :: DocumentsView)
}
]
---------------------------------------------------------
type ItemProps =
( documentView :: DocumentsView
, frontends :: Frontends
, session :: Session
, path :: PagePath
)
item :: R2.Leaf ItemProps
item = R2.leaf itemCpt
itemCpt :: R.Component ItemProps
itemCpt = here.component "item" cpt where
cpt { frontends
, path
, documentView: dv@(DocumentsView { id, title, source })
, session
} _ = do
-- Computed
let
documentUrl id' { listId, nodeId } =
url frontends $ Routes.CorpusDocument (sessionId session) nodeId listId id'
-- Render
pure $
H.div
{ className: intercalate " "
[ "graph-doc-list__item"
, "list-group-item"
]
}
[
B.div'
{ className: "graph-doc-list__item__title" }
title
,
B.div'
{ className: "graph-doc-list__item__source" }
source
,
B.div'
{ className: "graph-doc-list__item__date" } $
publicationDate dv
-- H.a
-- { target: "_blank"
-- , href: documentUrl id path
-- }
]
src/Gargantext/Components/GraphExplorer/Sidebar/Sidebar.purs
View file @
91ac5d18
...
@@ -23,12 +23,12 @@ import Effect.Class (liftEffect)
...
@@ -23,12 +23,12 @@ import Effect.Class (liftEffect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), Variant(..))
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), Variant(..))
import Gargantext.Components.GraphExplorer.Sidebar.DocList (docList)
import Gargantext.Components.GraphExplorer.Sidebar.Legend as Legend
import Gargantext.Components.GraphExplorer.Sidebar.Legend as Legend
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.Lang (Lang(..))
import Gargantext.Components.Lang (Lang(..))
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.Nodes.Corpus.Graph.Tabs (tabs) as CGT
import Gargantext.Components.RandomText (words)
import Gargantext.Components.RandomText (words)
import Gargantext.Components.Search (SearchType(..), SearchQuery(..))
import Gargantext.Components.Search (SearchType(..), SearchQuery(..))
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Config.REST (AffRESTError)
...
@@ -172,7 +172,7 @@ sideTabDataCpt = here.component "sideTabData" cpt
...
@@ -172,7 +172,7 @@ sideTabDataCpt = here.component "sideTabData" cpt
,
,
sideBarTabSeparator
sideBarTabSeparator
,
,
query
docListWrapper
{ frontends: props.frontends
{ frontends: props.frontends
, metaData: props.metaData
, metaData: props.metaData
, nodesMap: SigmaxT.nodesGraphMap props.graph
, nodesMap: SigmaxT.nodesGraphMap props.graph
...
@@ -233,7 +233,7 @@ sideTabCommunityCpt = here.component "sideTabCommunity" cpt
...
@@ -233,7 +233,7 @@ sideTabCommunityCpt = here.component "sideTabCommunity" cpt
,
,
sideBarTabSeparator
sideBarTabSeparator
,
,
query
docListWrapper
{ frontends
{ frontends
, metaData: props.metaData
, metaData: props.metaData
, nodesMap: SigmaxT.nodesGraphMap props.graph
, nodesMap: SigmaxT.nodesGraphMap props.graph
...
@@ -606,7 +606,7 @@ sendPatch termList session (GET.MetaData metaData) node = do
...
@@ -606,7 +606,7 @@ sendPatch termList session (GET.MetaData metaData) node = do
---------------------------------------------------------
---------------------------------------------------------
type
Query
=
type
DocListWrapper
=
( frontends :: Frontends
( frontends :: Frontends
, metaData :: GET.MetaData
, metaData :: GET.MetaData
, nodesMap :: SigmaxT.NodesMap
, nodesMap :: SigmaxT.NodesMap
...
@@ -615,43 +615,77 @@ type Query =
...
@@ -615,43 +615,77 @@ type Query =
, session :: Session
, session :: Session
)
)
query :: R2.Leaf Query
docListWrapper :: R2.Leaf DocListWrapper
query = R2.leaf query
Cpt
docListWrapper = R2.leaf docListWrapper
Cpt
queryCpt :: R.Component Query
docListWrapperCpt :: R.Component DocListWrapper
queryCpt = here.component "query'
" cpt where
docListWrapperCpt = here.component "docListWrapper
" cpt where
cpt { frontends
cpt { frontends
, metaData: GET.MetaData metaData
, metaData: GET.MetaData metaData
, nodesMap
, nodesMap
, searchType
, searchType
, selectedNodeIds
, selectedNodeIds
, session } _ = do
, session
-- Computed
} _ = do
-- States
query /\ queryBox <- R2.useBox' Nothing
-- Helpers
let
let
toSearchQuery ids = SearchQuery
{ expected: searchType
, query: concat $ toQuery <$> Set.toUnfoldable ids
}
toQuery id = case Map.lookup id nodesMap of
toQuery id = case Map.lookup id nodesMap of
Nothing -> []
Nothing -> []
Just n -> words n.label
Just n -> words n.label
side
corpusId = GET.GraphSideCorpus
toGraphSideCorpus
corpusId = GET.GraphSideCorpus
{ corpusId
{ corpusId
, corpusLabel: metaData.title
, corpusLabel: metaData.title
, listId : metaData.list.listId
, listId : metaData.list.listId
}
}
-- Hooks
R.useEffect1' selectedNodeIds $
T.write_ (selectedNodeIds # toSearchQuery >>> Just) queryBox
-- Render
-- Render
pure $
pure $
R2.fromMaybe_ (head metaData.corpusId) \corpusId ->
R.fragment
[
CGT.tabs
case (head metaData.corpusId) /\ query of
{ frontends
, query: SearchQuery
(Just corpusId) /\ (Just query') ->
{ expected: searchType
docList
, query: concat $ toQuery <$> Set.toUnfoldable selectedNodeIds
{ frontends
, query: query'
, session
, graphSideCorpus: toGraphSideCorpus corpusId
}
}
, session
, sides: [side corpusId]
_ /\ _ ->
}
B.caveat
{}
[
H.text "You can link a corpus to your Graph to retrieve relative documents when selecting nodes"
]
]
-- -- @WIP
-- CGT.tabs
-- { frontends
-- , query: SearchQuery
-- { expected: searchType
-- , query: concat $ toQuery <$> Set.toUnfoldable selectedNodeIds
-- }
-- , session
-- , sides: [side corpusId]
-- }
------------------------------------------------------------------------
------------------------------------------------------------------------
...
...
src/sass/_legacy/_graph.sass
View file @
91ac5d18
...
@@ -183,6 +183,25 @@ $layout-height: calc(100vh - #{ $topbar-height} )
...
@@ -183,6 +183,25 @@ $layout-height: calc(100vh - #{ $topbar-height} )
margin-top
:
space-x
(
2
)
margin-top
:
space-x
(
2
)
.graph-doc-list
&
__item
&
__title
,
&
__source
,
&
__date
line-height
:
1
.3
margin-bottom
:
space-x
(
0
.5
)
&
__source
font-size
:
15px
color
:
$gray-700
&
__date
font-size
:
14px
color
:
$gray-600
/////////////////////////////////////////////
/////////////////////////////////////////////
.graph-toolbar
.graph-toolbar
...
...
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