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
1f854b04
Commit
1f854b04
authored
Jun 20, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACT] frames div
parent
3f39fafc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
12 deletions
+35
-12
Frame.purs
...text/Components/Forest/Tree/Node/Action/Search/Frame.purs
+32
-9
SearchField.purs
...omponents/Forest/Tree/Node/Action/Search/SearchField.purs
+3
-3
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Search/Frame.purs
View file @
1f854b04
...
@@ -4,33 +4,56 @@ import DOM.Simple as DOM
...
@@ -4,33 +4,56 @@ import DOM.Simple as DOM
import DOM.Simple.Event (MessageEvent)
import DOM.Simple.Event (MessageEvent)
import DOM.Simple.EventListener (Callback, addEventListener, callback)
import DOM.Simple.EventListener (Callback, addEventListener, callback)
import DOM.Simple.Window (window)
import DOM.Simple.Window (window)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable)
import Data.Nullable (Nullable)
import Data.String (toLower)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Search, isIsTex_Advanced)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Search, isIsTex_Advanced)
import Gargantext.Prelude (discard, identity, pure, unit, ($), (<>), (==))
import Gargantext.Prelude (discard, identity, pure, unit, ($), (<>), (==)
, class Show, show
)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import URI.Extra.QueryPairs as NQP
import URI.Extra.QueryPairs as NQP
import URI.Query as Query
import URI.Query as Query
--------------------
data FrameSource = Istex | Searx
derive instance genericFrameSource :: Generic FrameSource _
instance showFrameSource :: Show FrameSource where
show = genericShow
--------------------
--------------------
-- | Iframes
-- | Iframes
searchIframes :: R.State Search
searchIframes :: R.State Search
-> R.Ref (Nullable DOM.Element)
-> R.Ref (Nullable DOM.Element)
-> R.Element
-> R.Element
searchIframes search@(search' /\ _) iframeRef =
searchIframes search@(search' /\ _) iframeRef =
if isIsTex_Advanced search'.datafield then
if isIsTex_Advanced search'.datafield
H.div { className: "frame-search panel panel-default" }
then divIframe Istex search iframeRef
[ iframeWith "https://istex.frame.gargantext.org" search iframeRef ]
else
else
if Just Web == search'.datafield then
if Just Web == search'.datafield
H.div { className: "frame-search panel panel-default" }
then divIframe Searx search iframeRef
[ iframeWith "https://searx.frame.gargantext.org" search iframeRef ]
else H.div {} []
else
H.div {} []
divIframe :: FrameSource
-> R.State Search
-> R.Ref (Nullable DOM.Element)
-> R.Element
divIframe frameSource search@(search' /\ _) iframeRef =
H.div { className: "frame-search panel panel-default" }
[ iframeWith (frameUrl frameSource)search iframeRef ]
frameUrl :: FrameSource -> String
frameUrl frameSource = frameUrl' (toLower $ show frameSource)
where
frameUrl' s = "https://" <> s <> ".frame.gargantext.org"
iframeWith :: String
iframeWith :: String
-> R.State Search
-> R.State Search
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchField.purs
View file @
1f854b04
...
@@ -51,7 +51,7 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
...
@@ -51,7 +51,7 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
where
where
cpt props@{onSearch, search: search@(s /\ _)} _ = do
cpt props@{onSearch, search: search@(s /\ _)} _ = do
iframeRef <- R.useRef null
iframeRef <- R.useRef null
let
body
=
let
params
=
[ searchInput {search}
[ searchInput {search}
, if length s.term < 3 -- search with love : <3
, if length s.term < 3 -- search with love : <3
then
then
...
@@ -83,9 +83,9 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
...
@@ -83,9 +83,9 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
]
]
]
]
let
footer
= submitButton {onSearch, search, session: props.session}
let
button
= submitButton {onSearch, search, session: props.session}
pure $ panel
body footer
pure $ panel
params button
componentIMT (search /\ setSearch) =
componentIMT (search /\ setSearch) =
...
...
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