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
ea1147e6
Commit
ea1147e6
authored
Nov 23, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[docsTable] rows eyes opening/closing for doc annotate popup
parent
cf85eb45
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
20 deletions
+52
-20
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+19
-6
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+24
-11
Types.purs
src/Gargantext/Components/Nodes/Texts/Types.purs
+9
-3
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
ea1147e6
...
@@ -34,7 +34,7 @@ import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse
...
@@ -34,7 +34,7 @@ import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, sessionId, get, delete)
import Gargantext.Sessions (Session, sessionId, get, delete)
import Gargantext.Types (ListId, NodeID, NodeType(..), OrderBy(..), TableResult, TabSubType, TabType, showTabType')
import Gargantext.Types (ListId, NodeID, NodeType(..), OrderBy(..),
ReloadS,
TableResult, TabSubType, TabType, showTabType')
import Gargantext.Utils (sortWith)
import Gargantext.Utils (sortWith)
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParamS, queryParam, queryParamS)
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParamS, queryParam, queryParamS)
...
@@ -351,11 +351,14 @@ pagePaintRawCpt = R.hooksComponentWithModule thisModule "pagePaintRawCpt" cpt wh
...
@@ -351,11 +351,14 @@ pagePaintRawCpt = R.hooksComponentWithModule thisModule "pagePaintRawCpt" cpt wh
, totalRecords }
, totalRecords }
, localCategories
, localCategories
, params } _ = do
, params } _ = do
reload <- R.useState' 0
pure $ T.table
pure $ T.table
{ colNames
{ colNames
, container: T.defaultContainer { title: "Documents" }
, container: T.defaultContainer { title: "Documents" }
, params
, params
, rows: rows localCategories
, rows: rows
reload
localCategories
, totalRecords
, totalRecords
, wrapColElts
, wrapColElts
}
}
...
@@ -371,14 +374,14 @@ pagePaintRawCpt = R.hooksComponentWithModule thisModule "pagePaintRawCpt" cpt wh
...
@@ -371,14 +374,14 @@ pagePaintRawCpt = R.hooksComponentWithModule thisModule "pagePaintRawCpt" cpt wh
colNames = T.ColumnName <$> [ "Tag", "Date", "Title", "Source"]
colNames = T.ColumnName <$> [ "Tag", "Date", "Title", "Source"]
wrapColElts = const identity
wrapColElts = const identity
getCategory (lc /\ _) {_id, category} = fromMaybe category (lc ^. at _id)
getCategory (lc /\ _) {_id, category} = fromMaybe category (lc ^. at _id)
rows lc@(_ /\ setLocalCategories) = row <$> A.toUnfoldable documents
rows
reload
lc@(_ /\ setLocalCategories) = row <$> A.toUnfoldable documents
where
where
row dv@(DocumentsView r) =
row dv@(DocumentsView r) =
{ row:
{ row:
T.makeRow [ -- H.div {} [ H.a { className, style, on: {click: click Favorite} } [] ]
T.makeRow [ -- H.div {} [ H.a { className, style, on: {click: click Favorite} } [] ]
H.div { className: "column-tag flex" } [
H.div { className: "column-tag flex" } [
caroussel { category: cat, nodeId, row: dv, session, setLocalCategories } []
caroussel { category: cat, nodeId, row: dv, session, setLocalCategories } []
, docChooser { listId, mCorpusId, nodeId: r._id, sidePanelTriggers } []
, docChooser { listId, mCorpusId, nodeId: r._id, sidePanelTriggers
, tableReload: reload
} []
]
]
--, H.input { type: "checkbox", defaultValue: checked, on: {click: click Trash} }
--, H.input { type: "checkbox", defaultValue: checked, on: {click: click Trash} }
-- TODO show date: Year-Month-Day only
-- TODO show date: Year-Month-Day only
...
@@ -400,6 +403,7 @@ type DocChooser = (
...
@@ -400,6 +403,7 @@ type DocChooser = (
, mCorpusId :: Maybe NodeID
, mCorpusId :: Maybe NodeID
, nodeId :: NodeID
, nodeId :: NodeID
, sidePanelTriggers :: Record SidePanelTriggers
, sidePanelTriggers :: Record SidePanelTriggers
, tableReload :: ReloadS
)
)
docChooser :: R2.Component DocChooser
docChooser :: R2.Component DocChooser
...
@@ -414,9 +418,17 @@ docChooserCpt = R.hooksComponentWithModule thisModule "docChooser" cpt
...
@@ -414,9 +418,17 @@ docChooserCpt = R.hooksComponentWithModule thisModule "docChooser" cpt
cpt { listId
cpt { listId
, mCorpusId: Just corpusId
, mCorpusId: Just corpusId
, nodeId
, nodeId
, sidePanelTriggers: { triggerAnnotatedDocIdChange } } _ = do
, sidePanelTriggers: { currentDocIdRef
, triggerAnnotatedDocIdChange }
, tableReload: (_ /\ setReload) } _ = do
let eyeClass = if (R.readRef currentDocIdRef) == Just nodeId then
"fa-eye"
else
"fa-eye-slash"
pure $ H.div { className: "doc-chooser" } [
pure $ H.div { className: "doc-chooser" } [
H.span { className: "fa
fa-eye"
H.span { className: "fa
" <> eyeClass
, on: { click: onClick } } []
, on: { click: onClick } } []
]
]
where
where
...
@@ -425,6 +437,7 @@ docChooserCpt = R.hooksComponentWithModule thisModule "docChooser" cpt
...
@@ -425,6 +437,7 @@ docChooserCpt = R.hooksComponentWithModule thisModule "docChooser" cpt
-- log2 "[docChooser] onClick, corpusId" corpusId
-- log2 "[docChooser] onClick, corpusId" corpusId
-- log2 "[docChooser] onClick, nodeId" nodeId
-- log2 "[docChooser] onClick, nodeId" nodeId
R2.callTrigger triggerAnnotatedDocIdChange { corpusId, listId, nodeId }
R2.callTrigger triggerAnnotatedDocIdChange { corpusId, listId, nodeId }
setReload $ (_ + 1)
newtype SearchQuery = SearchQuery {
newtype SearchQuery = SearchQuery {
...
...
src/Gargantext/Components/Nodes/Texts.purs
View file @
ea1147e6
...
@@ -350,31 +350,40 @@ sidePanel = R.createElement sidePanelCpt
...
@@ -350,31 +350,40 @@ sidePanel = R.createElement sidePanelCpt
sidePanelCpt :: R.Component SidePanelProps
sidePanelCpt :: R.Component SidePanelProps
sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
where
where
cpt { controls: { triggers: { triggerAnnotatedDocIdChange
cpt { controls: { triggers: { currentDocIdRef
, triggerSidePanel } }
, toggleSidePanel
, triggerAnnotatedDocIdChange
, triggerSidePanel
} }
, session } _ = do
, session } _ = do
showSidePanel <- R.useState' InitialClosed
showSidePanel <- R.useState' InitialClosed
R.useEffect' $ do
R.useEffect' $ do
let trigger _ = do
let toggleSidePanel' _ = snd showSidePanel toggleSidePanelState
snd showSidePanel $ const Opened
triggerSidePanel' _ = snd showSidePanel $ const Opened
R2.setTrigger triggerSidePanel trigger
R2.setTrigger toggleSidePanel toggleSidePanel'
R2.setTrigger triggerSidePanel triggerSidePanel'
(mCorpusId /\ setMCorpusId) <- R.useState' Nothing
(mCorpusId /\ setMCorpusId) <- R.useState' Nothing
(mListId /\ setMListId) <- R.useState' Nothing
(mListId /\ setMListId) <- R.useState' Nothing
(mNodeId /\ setMNodeId) <- R.useState' Nothing
(mNodeId /\ setMNodeId) <- R.useState' Nothing
R.useEffect
2
mListId mNodeId $ do
R.useEffect
3 mCorpusId
mListId mNodeId $ do
let trigger :: Record TriggerAnnotatedDocIdChangeParams -> Effect Unit
let trigger :: Record TriggerAnnotatedDocIdChangeParams -> Effect Unit
trigger { corpusId, listId, nodeId } = do
trigger { corpusId, listId, nodeId } = do
-- log2 "[sidePanel trigger] trigger corpusId change" corpusId
-- log2 "[sidePanel trigger] trigger corpusId change" corpusId
-- log2 "[sidePanel trigger] trigger listId change" listId
-- log2 "[sidePanel trigger] trigger listId change" listId
-- log2 "[sidePanel trigger] trigger nodeId change" nodeId
-- log2 "[sidePanel trigger] trigger nodeId change" nodeId
setMCorpusId $ const $ Just corpusId
if mCorpusId == Just corpusId && mListId == Just listId && mNodeId == Just nodeId && R.readRef currentDocIdRef == Just nodeId then do
setMListId $ const $ Just listId
R.setRef currentDocIdRef Nothing
setMNodeId $ const $ Just nodeId
R2.callTrigger toggleSidePanel unit
R2.callTrigger triggerSidePanel unit
else do
setMCorpusId $ const $ Just corpusId
setMListId $ const $ Just listId
setMNodeId $ const $ Just nodeId
R.setRef currentDocIdRef $ Just nodeId
R2.callTrigger triggerSidePanel unit
-- log2 "[sidePanel] trigger" trigger
-- log2 "[sidePanel] trigger" trigger
R2.setTrigger triggerAnnotatedDocIdChange trigger
R2.setTrigger triggerAnnotatedDocIdChange trigger
...
@@ -386,10 +395,14 @@ sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
...
@@ -386,10 +395,14 @@ sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
Opened -> { display: "block" }
Opened -> { display: "block" }
_ -> { display: "none" }
_ -> { display: "none" }
let closeSidePanel _ = do
R.setRef currentDocIdRef Nothing
snd showSidePanel $ const Closed
pure $ H.div { style: mainStyle } [
pure $ H.div { style: mainStyle } [
H.div { className: "header" } [
H.div { className: "header" } [
H.span { className: "btn btn-danger"
H.span { className: "btn btn-danger"
, on: { click:
\_ -> snd showSidePanel $ const Closed
} } [
, on: { click:
closeSidePanel
} } [
H.span { className: "fa fa-times" } []
H.span { className: "fa fa-times" } []
]
]
]
]
...
...
src/Gargantext/Components/Nodes/Texts/Types.purs
View file @
ea1147e6
...
@@ -24,17 +24,23 @@ type TriggerAnnotatedDocIdChangeParams = (
...
@@ -24,17 +24,23 @@ type TriggerAnnotatedDocIdChangeParams = (
)
)
type SidePanelTriggers = (
type SidePanelTriggers = (
triggerAnnotatedDocIdChange :: R2.Trigger (Record TriggerAnnotatedDocIdChangeParams)
currentDocIdRef :: R.Ref (Maybe Int)
, triggerSidePanel :: R2.Trigger Unit
, toggleSidePanel :: R2.Trigger Unit -- toggles side panel
, triggerAnnotatedDocIdChange :: R2.Trigger (Record TriggerAnnotatedDocIdChangeParams)
, triggerSidePanel :: R2.Trigger Unit -- opens side panel
)
)
emptySidePanelTriggers :: R.Hooks (Record SidePanelTriggers)
emptySidePanelTriggers :: R.Hooks (Record SidePanelTriggers)
emptySidePanelTriggers = do
emptySidePanelTriggers = do
currentDocIdRef <- R.useRef Nothing
toggleSidePanel <- R.useRef Nothing
triggerAnnotatedDocIdChange <- R.useRef Nothing
triggerAnnotatedDocIdChange <- R.useRef Nothing
triggerSidePanel <- R.useRef Nothing
triggerSidePanel <- R.useRef Nothing
pure $ {
pure $ {
triggerAnnotatedDocIdChange
currentDocIdRef
, toggleSidePanel
, triggerAnnotatedDocIdChange
, triggerSidePanel
, triggerSidePanel
}
}
...
...
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