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
d9a55b09
Commit
d9a55b09
authored
Nov 26, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngrams] added sidebar to ngrams tables
parent
00cab447
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
374 additions
and
147 deletions
+374
-147
Styles.css
dist/styles/Styles.css
+9
-3
Styles.sass
dist/styles/Styles.sass
+6
-2
App.purs
src/Gargantext/Components/App.purs
+21
-10
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+11
-11
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+55
-40
Components.purs
src/Gargantext/Components/NgramsTable/Components.purs
+31
-19
Contacts.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
+5
-5
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+36
-27
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+124
-16
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+28
-10
Types.purs
src/Gargantext/Components/Nodes/Lists/Types.purs
+47
-0
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+1
-4
No files found.
dist/styles/Styles.css
View file @
d9a55b09
...
@@ -25,9 +25,6 @@
...
@@ -25,9 +25,6 @@
.table
tr
td
.active
{
.table
tr
td
.active
{
font-weight
:
bold
;
font-weight
:
bold
;
}
}
.table
tr
td
.trash
{
text-decoration
:
line-through
;
}
.table
tr
td
.column-tag
{
.table
tr
td
.column-tag
{
align-items
:
center
;
align-items
:
center
;
}
}
...
@@ -35,6 +32,15 @@
...
@@ -35,6 +32,15 @@
cursor
:
pointer
;
cursor
:
pointer
;
padding
:
10px
;
padding
:
10px
;
}
}
.table
tr
td
.ngrams-selector
{
display
:
flex
;
}
.table
tr
td
.ngrams-selector
.ngrams-chooser
{
padding
:
3px
;
}
.table
tr
td
.trash
{
text-decoration
:
line-through
;
}
.context-menu
{
.context-menu
{
position
:
fixed
;
position
:
fixed
;
...
...
dist/styles/Styles.sass
View file @
d9a55b09
...
@@ -23,13 +23,17 @@
...
@@ -23,13 +23,17 @@
td
td
.active
.active
font-weight
:
bold
font-weight
:
bold
.trash
text-decoration
:
line-through
.column-tag
.column-tag
align-items
:
center
align-items
:
center
.doc-chooser
.doc-chooser
cursor
:
pointer
cursor
:
pointer
padding
:
10px
padding
:
10px
.ngrams-selector
display
:
flex
.ngrams-chooser
padding
:
3px
.trash
text-decoration
:
line-through
.context-menu
.context-menu
position
:
fixed
position
:
fixed
src/Gargantext/Components/App.purs
View file @
d9a55b09
...
@@ -20,7 +20,7 @@ import Gargantext.Components.Nodes.Corpus.Document (documentMainLayout)
...
@@ -20,7 +20,7 @@ import Gargantext.Components.Nodes.Corpus.Document (documentMainLayout)
import Gargantext.Components.Nodes.File (fileLayout)
import Gargantext.Components.Nodes.File (fileLayout)
import Gargantext.Components.Nodes.Frame (frameLayout)
import Gargantext.Components.Nodes.Frame (frameLayout)
import Gargantext.Components.Nodes.Home (homeLayout)
import Gargantext.Components.Nodes.Home (homeLayout)
import Gargantext.Components.Nodes.Lists
(listsLayout)
import Gargantext.Components.Nodes.Lists
as Lists
import Gargantext.Components.Nodes.Texts as Texts
import Gargantext.Components.Nodes.Texts as Texts
import Gargantext.Components.SimpleLayout (simpleLayout)
import Gargantext.Components.SimpleLayout (simpleLayout)
import Gargantext.Config (defaultFrontends, defaultBackends, publicBackend)
import Gargantext.Config (defaultFrontends, defaultBackends, publicBackend)
...
@@ -134,16 +134,27 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
...
@@ -134,16 +134,27 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
homeLayout { backend, lang: LL_EN, publicBackend, sessions, visible: showLogin }
homeLayout { backend, lang: LL_EN, publicBackend, sessions, visible: showLogin }
]
]
Lists sid nodeId -> withSession sid $
Lists sid nodeId -> withSession sid $
\session -> forested [
\session -> Lists.listsWithForest {
listsLayout {
forestProps: {
appReload
appReload
, asyncTasksRef
, asyncTasksRef
, nodeId
, backend
, session
, frontends
, sessionUpdate
, handed
, treeReloadRef
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin
, treeReloadRef
}
, listsProps: {
appReload
, asyncTasksRef
, nodeId
, session
, sessionUpdate
, treeReloadRef
}
}
]
} [
]
Login -> login { backend, backends, sessions, visible: showLogin }
Login -> login { backend, backends, sessions, visible: showLogin }
PGraphExplorer sid graphId ->
PGraphExplorer sid graphId ->
withSession sid $
withSession sid $
...
...
src/Gargantext/Components/DocsTable.purs
View file @
d9a55b09
...
@@ -72,18 +72,18 @@ type LayoutProps = (
...
@@ -72,18 +72,18 @@ type LayoutProps = (
)
)
type PageLayoutProps = (
type PageLayoutProps = (
cacheState :: R.State NT.CacheState
cacheState
:: R.State NT.CacheState
, frontends :: Frontends
, frontends
:: Frontends
, key :: String -- NOTE Necessary to clear the component when cache state changes
, key
:: String -- NOTE Necessary to clear the component when cache state changes
, listId :: Int
, listId
:: Int
, mCorpusId :: Maybe Int
, mCorpusId
:: Maybe Int
, nodeId :: Int
, nodeId
:: Int
, params :: T.Params
, params
:: T.Params
, query :: Query
, query
:: Query
, session :: Session
, session
:: Session
, sidePanelTriggers :: Record SidePanelTriggers
, sidePanelTriggers :: Record SidePanelTriggers
, tabType :: TabType
, tabType
:: TabType
, totalRecords :: Int
, totalRecords
:: Int
)
)
_documentIdsDeleted = prop (SProxy :: SProxy "documentIdsDeleted")
_documentIdsDeleted = prop (SProxy :: SProxy "documentIdsDeleted")
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
d9a55b09
module Gargantext.Components.NgramsTable
module Gargantext.Components.NgramsTable
( MainNgramsTableProps
( MainNgramsTableProps
, CommonProps
, mainNgramsTable
, mainNgramsTable
) where
) where
...
@@ -279,16 +280,22 @@ tableContainerCpt { dispatch
...
@@ -279,16 +280,22 @@ tableContainerCpt { dispatch
]
]
-- NEXT
-- NEXT
type CommonProps = (
afterSync :: Unit -> Aff Unit
, appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, sidePanelTriggers :: Record NT.SidePanelTriggers
, tabNgramType :: CTabNgramType
, treeReloadRef :: R.Ref (Maybe ReloadS)
, withAutoUpdate :: Boolean
)
type Props = (
type Props = (
appReload :: ReloadS
path :: R.State PageParams
, afterSync :: Unit -> Aff Unit
, state :: R.State State
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, versioned :: VersionedNgramsTable
, path :: R.State PageParams
| CommonProps
, state :: R.State State
, tabNgramType :: CTabNgramType
, treeReloadRef :: R.Ref (Maybe ReloadS)
, versioned :: VersionedNgramsTable
, withAutoUpdate :: Boolean
)
)
loadedNgramsTable :: Record Props -> R.Element
loadedNgramsTable :: Record Props -> R.Element
...
@@ -301,6 +308,7 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
...
@@ -301,6 +308,7 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
, appReload
, appReload
, asyncTasksRef
, asyncTasksRef
, path: path@(path'@{ listIds, nodeId, params, searchQuery, scoreType, termListFilter, termSizeFilter } /\ setPath)
, path: path@(path'@{ listIds, nodeId, params, searchQuery, scoreType, termListFilter, termSizeFilter } /\ setPath)
, sidePanelTriggers
, state: (state@{ ngramsChildren
, state: (state@{ ngramsChildren
, ngramsLocalPatch
, ngramsLocalPatch
, ngramsParent
, ngramsParent
...
@@ -443,7 +451,8 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
...
@@ -443,7 +451,8 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
, ngramsLocalPatch
, ngramsLocalPatch
, ngramsParent
, ngramsParent
, ngramsSelection
, ngramsSelection
, ngramsTable }
, ngramsTable
, sidePanelTriggers } []
, delete: false
, delete: false
}
}
orderWith =
orderWith =
...
@@ -509,19 +518,14 @@ selectNgramsOnFirstPage rows = Set.fromFoldable $ (view $ _NgramsElement <<< _ng
...
@@ -509,19 +518,14 @@ selectNgramsOnFirstPage rows = Set.fromFoldable $ (view $ _NgramsElement <<< _ng
type MainNgramsTableProps = (
type MainNgramsTableProps = (
afterSync :: Unit -> Aff Unit
cacheState :: R.State NT.CacheState
, appReload :: ReloadS
, defaultListId :: Int
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, nodeId :: Int
, cacheState :: R.State NT.CacheState
, defaultListId :: Int
, nodeId :: Int
-- ^ This node can be a corpus or contact.
-- ^ This node can be a corpus or contact.
, pathS :: R.State PageParams
, pathS :: R.State PageParams
, session :: Session
, session :: Session
, tabNgramType :: CTabNgramType
, tabType :: TabType
, tabType :: TabType
| CommonProps
, treeReloadRef :: R.Ref (Maybe ReloadS)
, withAutoUpdate :: Boolean
)
)
mainNgramsTable :: Record MainNgramsTableProps -> R.Element
mainNgramsTable :: Record MainNgramsTableProps -> R.Element
...
@@ -538,6 +542,7 @@ mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
...
@@ -538,6 +542,7 @@ mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
, nodeId
, nodeId
, pathS
, pathS
, session
, session
, sidePanelTriggers
, tabNgramType
, tabNgramType
, tabType
, tabType
, treeReloadRef
, treeReloadRef
...
@@ -551,6 +556,7 @@ mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
...
@@ -551,6 +556,7 @@ mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
, appReload
, appReload
, asyncTasksRef
, asyncTasksRef
, path: fst pathS
, path: fst pathS
, sidePanelTriggers
, tabNgramType
, tabNgramType
, treeReloadRef
, treeReloadRef
, versioned
, versioned
...
@@ -568,6 +574,7 @@ mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
...
@@ -568,6 +574,7 @@ mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
, appReload
, appReload
, asyncTasksRef
, asyncTasksRef
, pathS
, pathS
, sidePanelTriggers
, tabNgramType
, tabNgramType
, treeReloadRef
, treeReloadRef
, versioned
, versioned
...
@@ -619,14 +626,9 @@ mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
...
@@ -619,14 +626,9 @@ mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
handleResponse v = v
handleResponse v = v
type MainNgramsTablePaintProps = (
type MainNgramsTablePaintProps = (
afterSync :: Unit -> Aff Unit
path :: PageParams
, appReload :: ReloadS
, versioned :: VersionedNgramsTable
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
| CommonProps
, path :: PageParams
, tabNgramType :: CTabNgramType
, treeReloadRef :: R.Ref (Maybe ReloadS)
, versioned :: VersionedNgramsTable
, withAutoUpdate :: Boolean
)
)
mainNgramsTablePaint :: Record MainNgramsTablePaintProps -> R.Element
mainNgramsTablePaint :: Record MainNgramsTablePaintProps -> R.Element
...
@@ -635,7 +637,15 @@ mainNgramsTablePaint p = R.createElement mainNgramsTablePaintCpt p []
...
@@ -635,7 +637,15 @@ mainNgramsTablePaint p = R.createElement mainNgramsTablePaintCpt p []
mainNgramsTablePaintCpt :: R.Component MainNgramsTablePaintProps
mainNgramsTablePaintCpt :: R.Component MainNgramsTablePaintProps
mainNgramsTablePaintCpt = R.hooksComponentWithModule thisModule "mainNgramsTablePaint" cpt
mainNgramsTablePaintCpt = R.hooksComponentWithModule thisModule "mainNgramsTablePaint" cpt
where
where
cpt props@{ afterSync, appReload, asyncTasksRef, path, tabNgramType, treeReloadRef, versioned, withAutoUpdate } _ = do
cpt props@{ afterSync
, appReload
, asyncTasksRef
, path
, sidePanelTriggers
, tabNgramType
, treeReloadRef
, versioned
, withAutoUpdate } _ = do
pathS <- R.useState' path
pathS <- R.useState' path
state <- R.useState' $ initialState versioned
state <- R.useState' $ initialState versioned
...
@@ -644,6 +654,7 @@ mainNgramsTablePaintCpt = R.hooksComponentWithModule thisModule "mainNgramsTable
...
@@ -644,6 +654,7 @@ mainNgramsTablePaintCpt = R.hooksComponentWithModule thisModule "mainNgramsTable
, appReload
, appReload
, asyncTasksRef
, asyncTasksRef
, path: pathS
, path: pathS
, sidePanelTriggers
, state
, state
, tabNgramType
, tabNgramType
, treeReloadRef
, treeReloadRef
...
@@ -652,14 +663,9 @@ mainNgramsTablePaintCpt = R.hooksComponentWithModule thisModule "mainNgramsTable
...
@@ -652,14 +663,9 @@ mainNgramsTablePaintCpt = R.hooksComponentWithModule thisModule "mainNgramsTable
}
}
type MainNgramsTablePaintNoCacheProps = (
type MainNgramsTablePaintNoCacheProps = (
afterSync :: Unit -> Aff Unit
pathS :: R.State PageParams
, appReload :: ReloadS
, versioned :: VersionedNgramsTable
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
| CommonProps
, pathS :: R.State PageParams
, tabNgramType :: CTabNgramType
, treeReloadRef :: R.Ref (Maybe ReloadS)
, versioned :: VersionedNgramsTable
, withAutoUpdate :: Boolean
)
)
mainNgramsTablePaintNoCache :: Record MainNgramsTablePaintNoCacheProps -> R.Element
mainNgramsTablePaintNoCache :: Record MainNgramsTablePaintNoCacheProps -> R.Element
...
@@ -668,7 +674,15 @@ mainNgramsTablePaintNoCache p = R.createElement mainNgramsTablePaintNoCacheCpt p
...
@@ -668,7 +674,15 @@ mainNgramsTablePaintNoCache p = R.createElement mainNgramsTablePaintNoCacheCpt p
mainNgramsTablePaintNoCacheCpt :: R.Component MainNgramsTablePaintNoCacheProps
mainNgramsTablePaintNoCacheCpt :: R.Component MainNgramsTablePaintNoCacheProps
mainNgramsTablePaintNoCacheCpt = R.hooksComponentWithModule thisModule "mainNgramsTablePaintNoCache" cpt
mainNgramsTablePaintNoCacheCpt = R.hooksComponentWithModule thisModule "mainNgramsTablePaintNoCache" cpt
where
where
cpt props@{ afterSync, appReload, asyncTasksRef, pathS, tabNgramType, treeReloadRef, versioned, withAutoUpdate } _ = do
cpt props@{ afterSync
, appReload
, asyncTasksRef
, pathS
, sidePanelTriggers
, tabNgramType
, treeReloadRef
, versioned
, withAutoUpdate } _ = do
state <- R.useState' $ initialState versioned
state <- R.useState' $ initialState versioned
pure $ loadedNgramsTable {
pure $ loadedNgramsTable {
...
@@ -676,6 +690,7 @@ mainNgramsTablePaintNoCacheCpt = R.hooksComponentWithModule thisModule "mainNgra
...
@@ -676,6 +690,7 @@ mainNgramsTablePaintNoCacheCpt = R.hooksComponentWithModule thisModule "mainNgra
, appReload
, appReload
, asyncTasksRef
, asyncTasksRef
, path: pathS
, path: pathS
, sidePanelTriggers
, state
, state
, tabNgramType
, tabNgramType
, treeReloadRef
, treeReloadRef
...
...
src/Gargantext/Components/NgramsTable/Components.purs
View file @
d9a55b09
...
@@ -23,6 +23,7 @@ import Gargantext.Components.NgramsTable.Core ( Action(..), Dispatch, NgramsElem
...
@@ -23,6 +23,7 @@ import Gargantext.Components.NgramsTable.Core ( Action(..), Dispatch, NgramsElem
, _list, _ngrams, _occurrences, ngramsTermText, replace
, _list, _ngrams, _occurrences, ngramsTermText, replace
, singletonNgramsTablePatch, setTermListA
, singletonNgramsTablePatch, setTermListA
)
)
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table as Tbl
import Gargantext.Components.Table as Tbl
import Gargantext.Types as T
import Gargantext.Types as T
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
@@ -171,18 +172,19 @@ treeCpt = R.hooksComponentWithModule thisModule "tree" cpt
...
@@ -171,18 +172,19 @@ treeCpt = R.hooksComponentWithModule thisModule "tree" cpt
H.ul {} <<< map (\ngrams -> tree (params { ngramsDepth = {depth, ngrams} })) <<< L.toUnfoldable
H.ul {} <<< map (\ngrams -> tree (params { ngramsDepth = {depth, ngrams} })) <<< L.toUnfoldable
type RenderNgramsItem =
type RenderNgramsItem = (
( dispatch :: Action -> Effect Unit
dispatch :: Action -> Effect Unit
, ngrams :: NgramsTerm
, ngrams :: NgramsTerm
, ngramsElement :: NgramsElement
, ngramsElement :: NgramsElement
, ngramsLocalPatch :: NgramsTablePatch
, ngramsLocalPatch :: NgramsTablePatch
, ngramsParent :: Maybe NgramsTerm
, ngramsParent :: Maybe NgramsTerm
, ngramsSelection :: Set NgramsTerm
, ngramsSelection :: Set NgramsTerm
, ngramsTable :: NgramsTable
, ngramsTable :: NgramsTable
, sidePanelTriggers :: Record NT.SidePanelTriggers
)
)
renderNgramsItem :: R
ecord RenderNgramsItem -> R.Element
renderNgramsItem :: R
2.Component RenderNgramsItem
renderNgramsItem
p = R.createElement renderNgramsItemCpt p []
renderNgramsItem
= R.createElement renderNgramsItemCpt
renderNgramsItemCpt :: R.Component RenderNgramsItem
renderNgramsItemCpt :: R.Component RenderNgramsItem
renderNgramsItemCpt = R.hooksComponentWithModule thisModule "renderNgramsItem" cpt
renderNgramsItemCpt = R.hooksComponentWithModule thisModule "renderNgramsItem" cpt
...
@@ -193,21 +195,31 @@ renderNgramsItemCpt = R.hooksComponentWithModule thisModule "renderNgramsItem" c
...
@@ -193,21 +195,31 @@ renderNgramsItemCpt = R.hooksComponentWithModule thisModule "renderNgramsItem" c
, ngramsLocalPatch
, ngramsLocalPatch
, ngramsParent
, ngramsParent
, ngramsSelection
, ngramsSelection
, ngramsTable } _ =
, ngramsTable
, sidePanelTriggers: { toggleSidePanel }
} _ = do
pure $ Tbl.makeRow [
pure $ Tbl.makeRow [
selected
H.div { className: "ngrams-selector" } [
H.span { className: "ngrams-chooser fa fa-eye"
, on: { click: onClick } } []
, selected
]
, checkbox T.MapTerm
, checkbox T.MapTerm
, checkbox T.StopTerm
, checkbox T.StopTerm
, if ngramsParent == Nothing
, H.div {} [
then renderNgramsTree { ngramsTable, ngrams, ngramsStyle, ngramsClick, ngramsEdit }
if ngramsParent == Nothing
else
then renderNgramsTree { ngramsTable, ngrams, ngramsStyle, ngramsClick, ngramsEdit }
H.a { on: { click: const $ dispatch $ ToggleChild true ngrams } } [
else
H.i { className: "glyphicon glyphicon-plus" } []
H.a { on: { click: const $ dispatch $ ToggleChild true ngrams } } [
, (R2.buff $ span ngramsStyle [text $ " " <> ngramsTermText ngrams])
H.i { className: "glyphicon glyphicon-plus" } []
]
, (R2.buff $ span ngramsStyle [text $ " " <> ngramsTermText ngrams])
]
]
, H.text $ show (ngramsElement ^. _NgramsElement <<< _occurrences)
, H.text $ show (ngramsElement ^. _NgramsElement <<< _occurrences)
]
]
where
where
onClick _ = do
R2.callTrigger toggleSidePanel unit
termList = ngramsElement ^. _NgramsElement <<< _list
termList = ngramsElement ^. _NgramsElement <<< _list
ngramsStyle = [termStyle termList ngramsOpacity]
ngramsStyle = [termStyle termList ngramsOpacity]
ngramsEdit = Just <<< dispatch <<< SetParentResetChildren <<< Just <<< view _ngrams
ngramsEdit = Just <<< dispatch <<< SetParentResetChildren <<< Just <<< view _ngrams
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
View file @
d9a55b09
...
@@ -19,7 +19,7 @@ import Gargantext.AsyncTasks as GAT
...
@@ -19,7 +19,7 @@ import Gargantext.AsyncTasks as GAT
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.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.Lists.Types as
N
T
import Gargantext.Components.Nodes.Lists.Types as
L
T
import Gargantext.Components.Nodes.Texts.Types as TT
import Gargantext.Components.Nodes.Texts.Types as TT
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
...
@@ -197,9 +197,9 @@ userLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "userLayoutWithKey"
...
@@ -197,9 +197,9 @@ userLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "userLayoutWithKey"
cpt { appReload, asyncTasksRef, frontends, nodeId, session, treeReloadRef } _ = do
cpt { appReload, asyncTasksRef, frontends, nodeId, session, treeReloadRef } _ = do
reload <- R.useState' 0
reload <- R.useState' 0
cacheState <- R.useState'
N
T.CacheOn
cacheState <- R.useState'
L
T.CacheOn
sidePanelTriggers <-
T
T.emptySidePanelTriggers
sidePanelTriggers <-
L
T.emptySidePanelTriggers
useLoader {nodeId, reload: fst reload, session} getContactWithReload $
useLoader {nodeId, reload: fst reload, session} getContactWithReload $
\contactData@{contactNode: Contact {name, hyperdata}} ->
\contactData@{contactNode: Contact {name, hyperdata}} ->
...
@@ -257,9 +257,9 @@ annuaireUserLayoutCpt :: R.Component AnnuaireLayoutProps
...
@@ -257,9 +257,9 @@ annuaireUserLayoutCpt :: R.Component AnnuaireLayoutProps
annuaireUserLayoutCpt = R.hooksComponentWithModule thisModule "annuaireUserLayout" cpt
annuaireUserLayoutCpt = R.hooksComponentWithModule thisModule "annuaireUserLayout" cpt
where
where
cpt { annuaireId, appReload, asyncTasksRef, frontends, nodeId, session, treeReloadRef } _ = do
cpt { annuaireId, appReload, asyncTasksRef, frontends, nodeId, session, treeReloadRef } _ = do
cacheState <- R.useState'
N
T.CacheOn
cacheState <- R.useState'
L
T.CacheOn
sidePanelTriggers <-
T
T.emptySidePanelTriggers
sidePanelTriggers <-
L
T.emptySidePanelTriggers
useLoader nodeId (getAnnuaireContact session annuaireId) $
useLoader nodeId (getAnnuaireContact session annuaireId) $
\contactData@{contactNode: Contact {name, hyperdata}} ->
\contactData@{contactNode: Contact {name, hyperdata}} ->
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
d9a55b09
...
@@ -16,8 +16,8 @@ import Gargantext.Components.NgramsTable as NT
...
@@ -16,8 +16,8 @@ import Gargantext.Components.NgramsTable as NT
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (ContactData)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (ContactData)
import Gargantext.Components.Nodes.Lists.Types as
N
Types
import Gargantext.Components.Nodes.Lists.Types as
L
Types
import Gargantext.Components.Nodes.Texts.Types
(SidePanelTriggers)
import Gargantext.Components.Nodes.Texts.Types
as TTypes
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType(..), NodeID, PTabNgramType(..), ReloadS, TabType(..), TabSubType(..))
import Gargantext.Types (CTabNgramType(..), NodeID, PTabNgramType(..), ReloadS, TabType(..), TabSubType(..))
...
@@ -47,15 +47,15 @@ modeTabType' Books = CTabAuthors
...
@@ -47,15 +47,15 @@ modeTabType' Books = CTabAuthors
modeTabType' Communication = CTabAuthors
modeTabType' Communication = CTabAuthors
type TabsProps = (
type TabsProps = (
appReload :: ReloadS
appReload
:: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef
:: R.Ref (Maybe GAT.Reductor)
, cacheState
:: R.State N
Types.CacheState
, cacheState
:: R.State L
Types.CacheState
, contactData :: ContactData
, contactData
:: ContactData
, frontends :: Frontends
, frontends
:: Frontends
, nodeId :: Int
, nodeId
:: Int
, session :: Session
, session
:: Session
, sidePanelTriggers :: Record SidePanelTriggers
, sidePanelTriggers :: Record
LTypes.
SidePanelTriggers
, treeReloadRef :: R.Ref (Maybe ReloadS)
, treeReloadRef
:: R.Ref (Maybe ReloadS)
)
)
tabs :: Record TabsProps -> R.Element
tabs :: Record TabsProps -> R.Element
...
@@ -74,15 +74,15 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
...
@@ -74,15 +74,15 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
, sidePanelTriggers
, sidePanelTriggers
, treeReloadRef } _ = do
, treeReloadRef } _ = do
active <- R.useState' 0
active <- R.useState' 0
pure $
textsSidePanelTriggers <- TTypes.emptySidePanelTriggers
Tab.tabs { selected: fst active, tabs: tabs'
}
pure $ Tab.tabs { selected: fst active, tabs: tabs' textsSidePanelTriggers
}
where
where
tabs' =
tabs'
trg
=
[ "Documents" /\ docs
[ "Documents" /\ docs
trg
, "Patents" /\ ngramsView patentsView
, "Patents" /\ ngramsView patentsView
, "Books" /\ ngramsView booksView
, "Books" /\ ngramsView booksView
, "Communication" /\ ngramsView commView
, "Communication" /\ ngramsView commView
, "Trash" /\ docs -- TODO pass-in trash mode
, "Trash" /\ docs
trg
-- TODO pass-in trash mode
]
]
where
where
patentsView = { appReload
patentsView = { appReload
...
@@ -113,7 +113,7 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
...
@@ -113,7 +113,7 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
, treeReloadRef }
, treeReloadRef }
chart = mempty
chart = mempty
totalRecords = 4736 -- TODO
totalRecords = 4736 -- TODO
docs = DT.docViewLayout
docs
sidePanelTriggers
= DT.docViewLayout
{ cacheState
{ cacheState
, chart
, chart
, frontends
, frontends
...
@@ -129,15 +129,15 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
...
@@ -129,15 +129,15 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
type NgramsViewTabsProps = (
type NgramsViewTabsProps = (
appReload :: ReloadS
appReload
:: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef
:: R.Ref (Maybe GAT.Reductor)
, cacheState
:: R.State N
Types.CacheState
, cacheState
:: R.State L
Types.CacheState
, defaultListId :: Int
, defaultListId
:: Int
, mode :: Mode
, mode
:: Mode
, nodeId :: Int
, nodeId
:: Int
, session :: Session
, session
:: Session
, sidePanelTriggers :: Record SidePanelTriggers
, sidePanelTriggers :: Record
LTypes.
SidePanelTriggers
, treeReloadRef :: R.Ref (Maybe ReloadS)
, treeReloadRef
:: R.Ref (Maybe ReloadS)
)
)
ngramsView :: Record NgramsViewTabsProps -> R.Element
ngramsView :: Record NgramsViewTabsProps -> R.Element
...
@@ -146,7 +146,15 @@ ngramsView props = R.createElement ngramsViewCpt props []
...
@@ -146,7 +146,15 @@ ngramsView props = R.createElement ngramsViewCpt props []
ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
where
where
cpt { appReload, asyncTasksRef, cacheState, defaultListId, mode, nodeId, session, treeReloadRef } _ = do
cpt { appReload
, asyncTasksRef
, cacheState
, defaultListId
, mode
, nodeId
, session
, sidePanelTriggers
, treeReloadRef } _ = do
pathS <- R.useState' $ NTC.initialPageParams session nodeId [defaultListId] (TabDocument TabDocs)
pathS <- R.useState' $ NTC.initialPageParams session nodeId [defaultListId] (TabDocument TabDocs)
pure $ NT.mainNgramsTable {
pure $ NT.mainNgramsTable {
...
@@ -159,6 +167,7 @@ ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
...
@@ -159,6 +167,7 @@ ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
, pathS
, pathS
, tabType
, tabType
, session
, session
, sidePanelTriggers
, tabNgramType
, tabNgramType
, treeReloadRef
, treeReloadRef
, withAutoUpdate: false
, withAutoUpdate: false
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
d9a55b09
module Gargantext.Components.Nodes.Lists where
module Gargantext.Components.Nodes.Lists where
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (fst)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Record as Record
------------------------------------------------------------------------
------------------------------------------------------------------------
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Forest as Forest
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus.Types (getCorpusInfo, CorpusInfo(..), Hyperdata(..))
import Gargantext.Components.Nodes.Corpus.Types (getCorpusInfo, CorpusInfo(..), Hyperdata(..))
import Gargantext.Components.Nodes.Lists.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Types
as NT
import Gargantext.Components.Nodes.Lists.Types
import Gargantext.Components.Table as Table
import Gargantext.Components.Table as Table
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Prelude
...
@@ -24,8 +27,51 @@ import Gargantext.Utils.Reactix as R2
...
@@ -24,8 +27,51 @@ import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Lists"
thisModule = "Gargantext.Components.Nodes.Lists"
------------------------------------------------------------------------
------------------------------------------------------------------------
type ListsWithForest = (
forestProps :: Record Forest.ForestLayoutProps
, listsProps :: Record CommonProps
)
type Props = (
listsWithForest :: R2.Component ListsWithForest
listsWithForest = R.createElement listsWithForestCpt
listsWithForestCpt :: R.Component ListsWithForest
listsWithForestCpt = R.hooksComponentWithModule thisModule "listsWithForest" cpt
where
cpt { forestProps
, listsProps: listsProps@{ session } } _ = do
controls <- initialControls
pure $ Forest.forestLayoutWithTopBar forestProps [
topBar { controls } []
, listsLayout (Record.merge listsProps { controls }) []
, H.div { className: "side-panel" } [
sidePanel { controls, session } []
]
]
--------------------------------------------------------
type TopBarProps = (
controls :: Record ListsLayoutControls
)
topBar :: R2.Component TopBarProps
topBar = R.createElement topBarCpt
topBarCpt :: R.Component TopBarProps
topBarCpt = R.hooksComponentWithModule thisModule "topBar" cpt
where
cpt { controls } _ = do
-- empty for now because the button is moved to the side panel
pure $ H.div {} []
-- H.ul { className: "nav navbar-nav" } [
-- H.li {} [
-- sidePanelToggleButton { state: controls.showSidePanel } []
-- ]
-- ] -- head (goes to top bar)
--------------------------------------------------------
type CommonProps = (
appReload :: GT.ReloadS
appReload :: GT.ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, nodeId :: Int
, nodeId :: Int
...
@@ -34,22 +80,18 @@ type Props = (
...
@@ -34,22 +80,18 @@ type Props = (
, treeReloadRef :: R.Ref (Maybe GT.ReloadS)
, treeReloadRef :: R.Ref (Maybe GT.ReloadS)
)
)
type Props = (
controls :: Record ListsLayoutControls
| CommonProps
)
type WithTreeProps = (
type WithTreeProps = (
handed :: GT.Handed
handed :: GT.Handed
| Props
| Props
)
)
listsLayoutWithTree :: R2.Component WithTreeProps
listsLayout :: R2.Component Props
listsLayoutWithTree props = R.createElement listsLayoutWithTreeCpt props
listsLayout = R.createElement listsLayoutCpt
listsLayoutWithTreeCpt :: R.Component WithTreeProps
listsLayoutWithTreeCpt = R.hooksComponentWithModule thisModule "listsLayoutWithTree" cpt
where
cpt { appReload, asyncTasksRef, handed, nodeId, session, sessionUpdate, treeReloadRef } _ = do
pure $ listsLayout { appReload, asyncTasksRef, nodeId, session, sessionUpdate, treeReloadRef }
listsLayout :: Record Props -> R.Element
listsLayout props = R.createElement listsLayoutCpt props []
listsLayoutCpt :: R.Component Props
listsLayoutCpt :: R.Component Props
listsLayoutCpt = R.hooksComponentWithModule thisModule "listsLayout" cpt
listsLayoutCpt = R.hooksComponentWithModule thisModule "listsLayout" cpt
...
@@ -70,10 +112,16 @@ listsLayoutWithKey props = R.createElement listsLayoutWithKeyCpt props []
...
@@ -70,10 +112,16 @@ listsLayoutWithKey props = R.createElement listsLayoutWithKeyCpt props []
listsLayoutWithKeyCpt :: R.Component KeyProps
listsLayoutWithKeyCpt :: R.Component KeyProps
listsLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "listsLayoutWithKey" cpt
listsLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "listsLayoutWithKey" cpt
where
where
cpt { appReload, asyncTasksRef, nodeId, session, sessionUpdate, treeReloadRef } _ = do
cpt { appReload
, asyncTasksRef
, controls
, nodeId
, session
, sessionUpdate
, treeReloadRef } _ = do
let path = { nodeId, session }
let path = { nodeId, session }
cacheState <- R.useState' $ getCacheState
NT.
CacheOn session nodeId
cacheState <- R.useState' $ getCacheState CacheOn session nodeId
useLoader path loadCorpusWithChild $
useLoader path loadCorpusWithChild $
\corpusData@{ corpusId, corpusNode: NodePoly poly, defaultListId } ->
\corpusData@{ corpusId, corpusNode: NodePoly poly, defaultListId } ->
...
@@ -98,6 +146,7 @@ listsLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "listsLayoutWithKe
...
@@ -98,6 +146,7 @@ listsLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "listsLayoutWithKe
, corpusId
, corpusId
, key: "listsLayoutWithKey-tabs-" <> (show $ fst cacheState)
, key: "listsLayoutWithKey-tabs-" <> (show $ fst cacheState)
, session
, session
, sidePanelTriggers: controls.triggers
, treeReloadRef
, treeReloadRef
}
}
]
]
...
@@ -106,3 +155,62 @@ listsLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "listsLayoutWithKe
...
@@ -106,3 +155,62 @@ listsLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "listsLayoutWithKe
launchAff_ $ clearCache unit
launchAff_ $ clearCache unit
sessionUpdate $ setCacheState session nodeId cacheState
sessionUpdate $ setCacheState session nodeId cacheState
------------------------------------------------------------------------
------------------------------------------------------------------------
type SidePanelProps = (
controls :: Record ListsLayoutControls
, session :: Session
)
sidePanel :: R2.Component SidePanelProps
sidePanel = R.createElement sidePanelCpt
sidePanelCpt :: R.Component SidePanelProps
sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
where
cpt { controls: { triggers: { toggleSidePanel
, triggerSidePanel
} }
, session } _ = do
showSidePanel <- R.useState' InitialClosed
R.useEffect' $ do
let toggleSidePanel' _ = snd showSidePanel toggleSidePanelState
triggerSidePanel' _ = snd showSidePanel $ const Opened
R2.setTrigger toggleSidePanel toggleSidePanel'
R2.setTrigger triggerSidePanel triggerSidePanel'
(mCorpusId /\ setMCorpusId) <- R.useState' Nothing
(mListId /\ setMListId) <- R.useState' Nothing
(mNodeId /\ setMNodeId) <- R.useState' Nothing
let mainStyle = case fst showSidePanel of
Opened -> { display: "block" }
_ -> { display: "none" }
let closeSidePanel _ = do
snd showSidePanel $ const Closed
pure $ H.div { style: mainStyle } [
H.div { className: "header" } [
H.span { className: "btn btn-danger"
, on: { click: closeSidePanel } } [
H.span { className: "fa fa-times" } []
]
]
, sidePanelDocView { session } []
]
type SidePanelDocView = (
session :: Session
)
sidePanelDocView :: R2.Component SidePanelDocView
sidePanelDocView = R.createElement sidePanelDocViewCpt
sidePanelDocViewCpt :: R.Component SidePanelDocView
sidePanelDocViewCpt = R.hooksComponentWithModule thisModule "sidePanelDocView" cpt
where
cpt { session } _ = do
-- pure $ H.h4 {} [ H.text txt ]
pure $ H.div {} [ H.text "Hello ngrams" ]
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
d9a55b09
...
@@ -20,7 +20,7 @@ import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
...
@@ -20,7 +20,7 @@ import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart (getChartFunction)
import Gargantext.Components.Nodes.Corpus.Chart (getChartFunction)
import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
import Gargantext.Components.Nodes.Lists.Types
as NTypes
import Gargantext.Components.Nodes.Lists.Types
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Tab as Tab
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (ChartType(..), CTabNgramType(..), Mode(..), ReloadS, TabSubType(..), TabType(..), chartTypeFromString, modeTabType)
import Gargantext.Types (ChartType(..), CTabNgramType(..), Mode(..), ReloadS, TabSubType(..), TabType(..), chartTypeFromString, modeTabType)
...
@@ -30,13 +30,14 @@ thisModule :: String
...
@@ -30,13 +30,14 @@ thisModule :: String
thisModule = "Gargantext.Components.Nodes.Lists.Tabs"
thisModule = "Gargantext.Components.Nodes.Lists.Tabs"
type Props = (
type Props = (
appReload :: ReloadS
appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, cacheState :: R.State NTypes.CacheState
, cacheState :: R.State CacheState
, corpusData :: CorpusData
, corpusData :: CorpusData
, corpusId :: Int
, corpusId :: Int
, session :: Session
, session :: Session
, treeReloadRef :: R.Ref (Maybe ReloadS)
, sidePanelTriggers :: Record SidePanelTriggers
, treeReloadRef :: R.Ref (Maybe ReloadS)
)
)
type PropsWithKey = (
type PropsWithKey = (
...
@@ -50,7 +51,14 @@ tabs props = R.createElement tabsCpt props []
...
@@ -50,7 +51,14 @@ tabs props = R.createElement tabsCpt props []
tabsCpt :: R.Component PropsWithKey
tabsCpt :: R.Component PropsWithKey
tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
where
where
cpt { appReload, asyncTasksRef, cacheState, corpusData, corpusId, session, treeReloadRef } _ = do
cpt { appReload
, asyncTasksRef
, cacheState
, corpusData
, corpusId
, session
, sidePanelTriggers
, treeReloadRef } _ = do
(selected /\ setSelected) <- R.useState' 0
(selected /\ setSelected) <- R.useState' 0
pure $ Tab.tabs { selected, tabs: tabs' }
pure $ Tab.tabs { selected, tabs: tabs' }
...
@@ -59,7 +67,15 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
...
@@ -59,7 +67,15 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
, "Institutes" /\ view Institutes
, "Institutes" /\ view Institutes
, "Sources" /\ view Sources
, "Sources" /\ view Sources
, "Terms" /\ view Terms ]
, "Terms" /\ view Terms ]
view mode = ngramsView { appReload, asyncTasksRef, cacheState, corpusData, corpusId, mode, session, treeReloadRef }
view mode = ngramsView { appReload
, asyncTasksRef
, cacheState
, corpusData
, corpusId
, mode
, session
, sidePanelTriggers
, treeReloadRef }
type NgramsViewProps = ( mode :: Mode | Props )
type NgramsViewProps = ( mode :: Mode | Props )
...
@@ -76,6 +92,7 @@ ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
...
@@ -76,6 +92,7 @@ ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
, corpusId
, corpusId
, mode
, mode
, session
, session
, sidePanelTriggers
, treeReloadRef
, treeReloadRef
} _ = do
} _ = do
...
@@ -106,6 +123,7 @@ ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
...
@@ -106,6 +123,7 @@ ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
, nodeId: corpusId
, nodeId: corpusId
, pathS
, pathS
, session
, session
, sidePanelTriggers
, tabNgramType
, tabNgramType
, tabType
, tabType
, treeReloadRef
, treeReloadRef
...
...
src/Gargantext/Components/Nodes/Lists/Types.purs
View file @
d9a55b09
...
@@ -6,8 +6,12 @@ import Data.Either (Either(..))
...
@@ -6,8 +6,12 @@ import Data.Either (Either(..))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
import Reactix as R
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Types (ListId, NodeID)
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Lists.Types"
thisModule = "Gargantext.Components.Nodes.Lists.Types"
...
@@ -29,3 +33,46 @@ instance encodeJsonCacheState :: EncodeJson CacheState where
...
@@ -29,3 +33,46 @@ instance encodeJsonCacheState :: EncodeJson CacheState where
encodeJson CacheOff = encodeJson "CacheOff"
encodeJson CacheOff = encodeJson "CacheOff"
instance showCacheState :: Show CacheState where
instance showCacheState :: Show CacheState where
show = genericShow
show = genericShow
data SidePanelState = InitialClosed | Opened | Closed
derive instance eqSidePanelState :: Eq SidePanelState
toggleSidePanelState :: SidePanelState -> SidePanelState
toggleSidePanelState InitialClosed = Opened
toggleSidePanelState Closed = Opened
toggleSidePanelState Opened = Closed
type TriggerAnnotatedDocIdChangeParams = (
corpusId :: NodeID
, listId :: ListId
, nodeId :: NodeID
)
type SidePanelTriggers = (
toggleSidePanel :: R2.Trigger Unit -- toggles side panel
, triggerSidePanel :: R2.Trigger Unit -- opens side panel
)
emptySidePanelTriggers :: R.Hooks (Record SidePanelTriggers)
emptySidePanelTriggers = do
toggleSidePanel <- R.useRef Nothing
triggerSidePanel <- R.useRef Nothing
pure $ {
toggleSidePanel
, triggerSidePanel
}
type ListsLayoutControls = (
triggers :: Record SidePanelTriggers
)
initialControls :: R.Hooks (Record ListsLayoutControls)
initialControls = do
triggers <- emptySidePanelTriggers
pure $ {
triggers
}
src/Gargantext/Components/Nodes/Texts.purs
View file @
d9a55b09
...
@@ -420,7 +420,7 @@ sidePanelDocView :: R2.Component SidePanelDocView
...
@@ -420,7 +420,7 @@ sidePanelDocView :: R2.Component SidePanelDocView
sidePanelDocView = R.createElement sidePanelDocViewCpt
sidePanelDocView = R.createElement sidePanelDocViewCpt
sidePanelDocViewCpt :: R.Component SidePanelDocView
sidePanelDocViewCpt :: R.Component SidePanelDocView
sidePanelDocViewCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
sidePanelDocViewCpt = R.hooksComponentWithModule thisModule "sidePanel
DocView
" cpt
where
where
cpt { mListId: Nothing } _ = do
cpt { mListId: Nothing } _ = do
pure $ H.div {} []
pure $ H.div {} []
...
@@ -430,10 +430,7 @@ sidePanelDocViewCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
...
@@ -430,10 +430,7 @@ sidePanelDocViewCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
, mListId: Just listId
, mListId: Just listId
, mNodeId: Just nodeId
, mNodeId: Just nodeId
, session } _ = do
, session } _ = do
-- pure $ H.h4 {} [ H.text txt ]
pure $ D.documentLayout { listId
pure $ D.documentLayout { listId
, mCorpusId
, mCorpusId
, nodeId
, nodeId
, session } []
, session } []
where
txt = "mCorpusId: " <> show mCorpusId <> ", listId: " <> show listId <> ", nodeId: " <> show 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