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
a93a4fcb
Verified
Commit
a93a4fcb
authored
May 15, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[doc table] mark category as checked when document is previewed
parent
c9d48a87
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
24 deletions
+43
-24
Types.purs
src/Gargantext/Components/Category/Types.purs
+4
-0
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+39
-24
No files found.
src/Gargantext/Components/Category/Types.purs
View file @
a93a4fcb
...
@@ -115,3 +115,7 @@ star2catSimple Star_1 = Checked
...
@@ -115,3 +115,7 @@ star2catSimple Star_1 = Checked
star2catSimple Star_2 = Topic
star2catSimple Star_2 = Topic
star2catSimple Star_3 = Favorite
star2catSimple Star_3 = Favorite
star2catSimple Star_4 = ToCite
star2catSimple Star_4 = ToCite
markCategoryChecked :: Category -> Category
markCategoryChecked UnRead = Checked
markCategoryChecked s = s
src/Gargantext/Components/DocsTable.purs
View file @
a93a4fcb
...
@@ -27,9 +27,10 @@ import Gargantext.Components.App.Store (Boxes)
...
@@ -27,9 +27,10 @@ import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), ModalSizing(..), Variant(..))
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), ModalSizing(..), Variant(..))
import Gargantext.Components.Category (rating, ratingSimple)
import Gargantext.Components.Category (rating, ratingSimple)
import Gargantext.Components.Category.Types (Category(..), Star(..))
import Gargantext.Components.Category.Types (Category(..), Star(..)
, cat2score, markCategoryChecked
)
import Gargantext.Components.DocsTable.DocumentFormCreation as DFC
import Gargantext.Components.DocsTable.DocumentFormCreation as DFC
import Gargantext.Components.DocsTable.Types (DocumentsView(..), Hyperdata(..), LocalCategories, Query, Response(..), Year, sampleData, showSource)
import Gargantext.Components.DocsTable.Types (DocumentsView(..), Hyperdata(..), LocalCategories, Query, Response(..), Year, sampleData, showSource)
import Gargantext.Components.GraphQL.Endpoints (updateNodeContextCategory)
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Reload (textsReloadContext)
import Gargantext.Components.Reload (textsReloadContext)
...
@@ -636,7 +637,6 @@ tableRowCpt = here.component "tableRow" cpt where
...
@@ -636,7 +637,6 @@ tableRowCpt = here.component "tableRow" cpt where
let cat :: Category
let cat :: Category
cat = fromMaybe category (localCategories ^. at _id)
cat = fromMaybe category (localCategories ^. at _id)
-- checked = Star_1 == cat
selected = mCurrentDocId' == Just r._id
selected = mCurrentDocId' == Just r._id
sid = sessionId session
sid = sessionId session
corpusDocument
corpusDocument
...
@@ -657,9 +657,12 @@ tableRowCpt = here.component "tableRow" cpt where
...
@@ -657,9 +657,12 @@ tableRowCpt = here.component "tableRow" cpt where
[ -- H.div {} [ H.a { className, style, on: {click: click Favorite} } [] ]
[ -- H.div {} [ H.a { className, style, on: {click: click Favorite} } [] ]
H.div { className: "" }
H.div { className: "" }
[ docChooser { boxes
[ docChooser { boxes
, category: categoryS
, docId: r._id
, listId
, listId
, mCorpusId
, mCorpusId
, nodeId: r._id
, nodeId: r._id
, session
, sidePanel } []
, sidePanel } []
]
]
--, H.div { className: "column-tag flex" } [ caroussel { category: cat, nodeId, row: dv, session, setLocalCategories } [] ]
--, H.div { className: "column-tag flex" } [ caroussel { category: cat, nodeId, row: dv, session, setLocalCategories } [] ]
...
@@ -695,9 +698,12 @@ tableRowCpt = here.component "tableRow" cpt where
...
@@ -695,9 +698,12 @@ tableRowCpt = here.component "tableRow" cpt where
type DocChooser = (
type DocChooser = (
boxes :: Boxes
boxes :: Boxes
, category :: T.Box Category
, docId :: Int
, listId :: ListId
, listId :: ListId
, mCorpusId :: Maybe NodeID
, mCorpusId :: Maybe NodeID
, nodeId :: NodeID
, nodeId :: NodeID
, session :: Session
, sidePanel :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanel :: T.Box (Maybe (Record TextsT.SidePanel))
)
)
...
@@ -710,31 +716,23 @@ docChooserCpt = here.component "docChooser" cpt
...
@@ -710,31 +716,23 @@ docChooserCpt = here.component "docChooser" cpt
pure $ H.div {} []
pure $ H.div {} []
cpt { boxes: { sidePanelState }
cpt { boxes: { sidePanelState }
, category
, docId
, listId
, listId
, mCorpusId: Just corpusId
, mCorpusId: Just corpusId
, nodeId
, nodeId
, session
, sidePanel } _ = do
, sidePanel } _ = do
mCurrentDocId <- T.useFocused
mCurrentDocId <- T.useFocused
(maybe Nothing _.mCurrentDocId)
(maybe Nothing _.mCurrentDocId)
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentDocId = val })) sidePanel
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentDocId = val })) sidePanel
mCurrentDocId' <- T.useLive T.unequal mCurrentDocId
mCurrentDocId' <- T.useLive T.unequal mCurrentDocId
category' <- T.useLive T.unequal category
let selected = mCurrentDocId' == Just nodeId
let selected = mCurrentDocId' == Just nodeId
eyeClass = selected ? "eye" $ "eye-slash"
eyeClass = selected ? "eye" $ "eye-slash"
variant = selected ? Info $ Dark
variant = selected ? Info $ Dark
pure $
H.div
{ className: "doc-chooser" }
[
B.iconButton
{ name: eyeClass
, overlay: false
, variant
, callback: onClick selected
}
]
where
onClick selected _ = do
onClick selected _ = do
-- here.log2 "[docChooser] onClick, listId" listId
-- here.log2 "[docChooser] onClick, listId" listId
-- here.log2 "[docChooser] onClick, corpusId" corpusId
-- here.log2 "[docChooser] onClick, corpusId" corpusId
...
@@ -750,7 +748,24 @@ docChooserCpt = here.component "docChooser" cpt
...
@@ -750,7 +748,24 @@ docChooserCpt = here.component "docChooser" cpt
, mCurrentDocId: Just nodeId
, mCurrentDocId: Just nodeId
, nodeId: nodeId }) sidePanel
, nodeId: nodeId }) sidePanel
T.write_ Opened sidePanelState
T.write_ Opened sidePanelState
here.log2 "[docChooser] sidePanel opened" sidePanelState
let categoryMarked = markCategoryChecked category'
launchAff_ $ do
_ <- updateNodeContextCategory session docId corpusId $ cat2score categoryMarked
pure unit
T.write_ categoryMarked category
-- here.log2 "[docChooser] sidePanel opened" sidePanelState
pure $
H.div
{ className: "doc-chooser" }
[
B.iconButton
{ name: eyeClass
, overlay: false
, variant
, callback: onClick selected
}
]
newtype SearchQuery = SearchQuery {
newtype SearchQuery = SearchQuery {
...
...
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