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
Christian Merten
purescript-gargantext
Commits
364aee5f
Commit
364aee5f
authored
Aug 26, 2024
by
Fabien Maniere
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the disabled status on OR/AND buttons when there is only 1 term
parent
f2458a01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
DocList.purs
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
+10
-5
No files found.
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
View file @
364aee5f
...
@@ -14,7 +14,7 @@ import Data.Set as Set
...
@@ -14,7 +14,7 @@ import Data.Set as Set
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
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(..),
ComponentStatus(..),
Variant(..))
import Gargantext.Components.FacetsTable (DocumentsView(..), Rows(..), initialPageGQL, loadPageGQL, publicationDate)
import Gargantext.Components.FacetsTable (DocumentsView(..), Rows(..), initialPageGQL, loadPageGQL, publicationDate)
import Gargantext.Components.GraphExplorer.Store as GraphStore
import Gargantext.Components.GraphExplorer.Store as GraphStore
import Gargantext.Components.GraphExplorer.Types (CorpusId, DocId, GraphSideDoc(..), ListId)
import Gargantext.Components.GraphExplorer.Types (CorpusId, DocId, GraphSideDoc(..), ListId)
...
@@ -203,6 +203,8 @@ docListCpt = here.component "main" cpt where
...
@@ -203,6 +203,8 @@ docListCpt = here.component "main" cpt where
Docs { docs } -> T.write_ (Just docs) rows
Docs { docs } -> T.write_ (Just docs) rows
_ -> T.write_ (Just Seq.empty) rows
_ -> T.write_ (Just Seq.empty) rows
let statusOrAndButtons = if A.length selectedNgramsTerms' >= 2 then Enabled else Disabled
-- | Computed
-- | Computed
-- |
-- |
let
let
...
@@ -259,7 +261,7 @@ docListCpt = here.component "main" cpt where
...
@@ -259,7 +261,7 @@ docListCpt = here.component "main" cpt where
H.div {}
H.div {}
[
[
H.ul { className: "flex-row list-group justify-content-space-between align-items-center mb-1" }
H.ul { className: "flex-row list-group justify-content-space-between align-items-center mb-1" }
[ H.li {} [ andOrButton { state: buttonState } ]
[ H.li {} [ andOrButton { state: buttonState
, buttonStatus: statusOrAndButtons
} ]
, H.li {} [ H.p { className: "text-bold" } [ H.text "No related documents" ] ]
, H.li {} [ H.p { className: "text-bold" } [ H.text "No related documents" ] ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch (A.fromFoldable selectedNgramsTerms') goToURLInNewTab } ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch (A.fromFoldable selectedNgramsTerms') goToURLInNewTab } ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURLInNewTab } ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURLInNewTab } ]
...
@@ -276,7 +278,7 @@ docListCpt = here.component "main" cpt where
...
@@ -276,7 +278,7 @@ docListCpt = here.component "main" cpt where
H.div {}
H.div {}
[
[
H.ul { className: "flex-row list-group justify-content-space-between align-items-center mb-1" }
H.ul { className: "flex-row list-group justify-content-space-between align-items-center mb-1" }
[ H.li {} [ andOrButton { state: buttonState } ]
[ H.li {} [ andOrButton { state: buttonState
, buttonStatus: statusOrAndButtons
} ]
, H.li {} [ H.p { className: "text-bold" } [ H.text $ show (Seq.length results) <> " related documents" ] ]
, H.li {} [ H.p { className: "text-bold" } [ H.text $ show (Seq.length results) <> " related documents" ] ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch (A.fromFoldable selectedNgramsTerms') goToURLInNewTab } ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch (A.fromFoldable selectedNgramsTerms') goToURLInNewTab } ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURLInNewTab } ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURLInNewTab } ]
...
@@ -393,7 +395,8 @@ itemCpt = here.component "item" cpt where
...
@@ -393,7 +395,8 @@ itemCpt = here.component "item" cpt where
---------------------------------------------------------
---------------------------------------------------------
type AndOrButtonProps =
type AndOrButtonProps =
( state :: T.Box Boolean
( state :: T.Box Boolean
, buttonStatus :: ComponentStatus
)
)
andOrButton :: R2.Leaf AndOrButtonProps
andOrButton :: R2.Leaf AndOrButtonProps
...
@@ -401,7 +404,7 @@ andOrButton = R2.leaf andOrButtonCpt
...
@@ -401,7 +404,7 @@ andOrButton = R2.leaf andOrButtonCpt
andOrButtonCpt :: R.Component AndOrButtonProps
andOrButtonCpt :: R.Component AndOrButtonProps
andOrButtonCpt = here.component "andOrButton" cpt
andOrButtonCpt = here.component "andOrButton" cpt
where
where
cpt { state } _ = do
cpt { state
, buttonStatus
} _ = do
state' <- R2.useLive' state
state' <- R2.useLive' state
pure $
pure $
...
@@ -415,6 +418,7 @@ andOrButtonCpt = here.component "andOrButton" cpt
...
@@ -415,6 +418,7 @@ andOrButtonCpt = here.component "andOrButton" cpt
[
[
B.button
B.button
{ className: "btn-sm"
{ className: "btn-sm"
, status: buttonStatus
, callback: \_ -> T.write_ false state
, callback: \_ -> T.write_ false state
, variant: state' ?
, variant: state' ?
OutlinedButtonVariant Secondary $
OutlinedButtonVariant Secondary $
...
@@ -424,6 +428,7 @@ andOrButtonCpt = here.component "andOrButton" cpt
...
@@ -424,6 +428,7 @@ andOrButtonCpt = here.component "andOrButton" cpt
,
,
B.button
B.button
{ className: "btn-sm"
{ className: "btn-sm"
, status: buttonStatus
, callback: \_ -> T.write_ true state
, callback: \_ -> T.write_ true state
, variant: state' ?
, variant: state' ?
ButtonVariant Secondary $
ButtonVariant Secondary $
...
...
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