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
137
Issues
137
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
d98fd4a9
Commit
d98fd4a9
authored
Aug 26, 2024
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/262-dev-phylo-doc-search-ux-improvements' into dev-merge
parents
8d645385
364aee5f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
25 deletions
+37
-25
DocList.purs
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
+19
-14
DocList.purs
src/Gargantext/Components/PhyloExplorer/Sidebar/DocList.purs
+9
-9
LinkHandler.purs
src/Gargantext/Hooks/LinkHandler.purs
+9
-2
No files found.
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
View file @
d98fd4a9
...
@@ -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)
...
@@ -174,7 +174,7 @@ docListCpt = here.component "main" cpt where
...
@@ -174,7 +174,7 @@ docListCpt = here.component "main" cpt where
, state
, state
}
}
{ goToURL } <- useLinkHandler
{ goToURL
, goToURLInNewTab
} <- useLinkHandler
-- | Effects
-- | Effects
-- |
-- |
...
@@ -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
...
@@ -258,11 +260,11 @@ docListCpt = here.component "main" cpt where
...
@@ -258,11 +260,11 @@ docListCpt = here.component "main" cpt where
R2.when (results == Seq.empty) $
R2.when (results == Seq.empty) $
H.div {}
H.div {}
[
[
H.ul { className: "flex-row list-group
vertical-align-middle
" }
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.
h6 {
} [ 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') goToURL } ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch (A.fromFoldable selectedNgramsTerms') goToURL
InNewTab
} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURL } ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURL
InNewTab
} ]
]
]
, B.caveat
, B.caveat
{}
{}
...
@@ -275,11 +277,11 @@ docListCpt = here.component "main" cpt where
...
@@ -275,11 +277,11 @@ docListCpt = here.component "main" cpt where
H.div {}
H.div {}
[
[
H.ul { className: "flex-row list-group
vertical-align-middle
" }
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.
h6 {
} [ 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') goToURL } ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch (A.fromFoldable selectedNgramsTerms') goToURL
InNewTab
} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURL } ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch (A.fromFoldable selectedNgramsTerms') goToURL
InNewTab
} ]
]
]
, H.ul
, H.ul
{ className: intercalate " "
{ className: intercalate " "
...
@@ -394,6 +396,7 @@ itemCpt = here.component "item" cpt where
...
@@ -394,6 +396,7 @@ 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 $
...
...
src/Gargantext/Components/PhyloExplorer/Sidebar/DocList.purs
View file @
d98fd4a9
...
@@ -164,7 +164,7 @@ docListCpt = here.component "main" cpt where
...
@@ -164,7 +164,7 @@ docListCpt = here.component "main" cpt where
, path: path'
, path: path'
}
}
{ goToURL } <- useLinkHandler
{ goToURL
, goToURLInNewTab
} <- useLinkHandler
-- | Effects
-- | Effects
-- |
-- |
...
@@ -245,11 +245,11 @@ docListCpt = here.component "main" cpt where
...
@@ -245,11 +245,11 @@ docListCpt = here.component "main" cpt where
R2.when (results == Seq.empty) $
R2.when (results == Seq.empty) $
H.div {}
H.div {}
[
[
H.ul { className: "flex-row list-group
vertical-align-middle
" }
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 } ]
, H.li {} [ H.
h6 {
} [ 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 q' goToURL} ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch q' goToURL
InNewTab
} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch q' goToURL} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch q' goToURL
InNewTab
} ]
]
]
, B.caveat
, B.caveat
{}
{}
...
@@ -261,11 +261,11 @@ docListCpt = here.component "main" cpt where
...
@@ -261,11 +261,11 @@ docListCpt = here.component "main" cpt where
R2.when (not $ eq results Seq.empty) $
R2.when (not $ eq results Seq.empty) $
H.div {}
H.div {}
[
[
H.ul { className: "flex-row list-group
vertical-align-middle
" }
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 } ]
, H.li {} [ H.
h6 {
} [ 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 q' goToURL} ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> webSearch q' goToURL
InNewTab
} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch q' goToURL} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> wikipediaSearch q' goToURL
InNewTab
} ]
]
]
,
,
H.ul
H.ul
...
...
src/Gargantext/Hooks/LinkHandler.purs
View file @
d98fd4a9
module Gargantext.Hooks.LinkHandler
module Gargantext.Hooks.LinkHandler
( Methods, useLinkHandler
( Methods, useLinkHandler
, goToRoute, goTo
URL, goToPreviousPage
, goToRoute, goTo
PreviousPage, goToURL, goToURLInNewTab
) where
) where
import Gargantext.Prelude
import Gargantext.Prelude
...
@@ -18,12 +18,13 @@ import Type.Proxy (Proxy(..))
...
@@ -18,12 +18,13 @@ import Type.Proxy (Proxy(..))
import Web.HTML (window)
import Web.HTML (window)
import Web.HTML.History (back)
import Web.HTML.History (back)
import Web.HTML.Location (assign, setHref)
import Web.HTML.Location (assign, setHref)
import Web.HTML.Window (history, location)
import Web.HTML.Window (history, location
, open
)
type Methods =
type Methods =
( goToRoute :: AppRoute -> Effect Unit
( goToRoute :: AppRoute -> Effect Unit
, goToPreviousPage :: Unit -> Effect Unit
, goToPreviousPage :: Unit -> Effect Unit
, goToURL :: String -> Effect Unit
, goToURL :: String -> Effect Unit
, goToURLInNewTab :: String -> Effect Unit
)
)
useLinkHandler :: R.Hooks (Record Methods)
useLinkHandler :: R.Hooks (Record Methods)
...
@@ -41,6 +42,7 @@ useLinkHandler = do
...
@@ -41,6 +42,7 @@ useLinkHandler = do
tile
tile
, goToPreviousPage : const goToPreviousPage
, goToPreviousPage : const goToPreviousPage
, goToURL : goToURL
, goToURL : goToURL
, goToURLInNewTab : goToURLInNewTab
}
}
-- (?) Also exporting implementation methods, as it can be useful in an
-- (?) Also exporting implementation methods, as it can be useful in an
...
@@ -55,6 +57,11 @@ goToPreviousPage = window >>= history >>= back
...
@@ -55,6 +57,11 @@ goToPreviousPage = window >>= history >>= back
goToURL :: String -> Effect Unit
goToURL :: String -> Effect Unit
goToURL url = window >>= location >>= setHref url
goToURL url = window >>= location >>= setHref url
goToURLInNewTab :: String -> Effect Unit
goToURLInNewTab url = do
_ <- window >>= open url "_blank" ""
pure unit
--------------------------------------
--------------------------------------
changeTileRoute ::
changeTileRoute ::
...
...
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