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
051e70fa
Commit
051e70fa
authored
Aug 22, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/427-dev-modal-improvement-rc3.x' into dev-merge
parents
fb4c948f
58bf5b47
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
40 deletions
+117
-40
BaseModal.purs
src/Gargantext/Components/Bootstrap/Floaty/BaseModal.purs
+4
-4
Login.purs
src/Gargantext/Components/Login.purs
+106
-31
Form.purs
src/Gargantext/Components/Login/Form.purs
+1
-1
Router.purs
src/Gargantext/Components/Router.purs
+6
-4
No files found.
src/Gargantext/Components/Bootstrap/Floaty/BaseModal.purs
View file @
051e70fa
...
@@ -78,14 +78,14 @@ componentName = "b-modal"
...
@@ -78,14 +78,14 @@ componentName = "b-modal"
-- | - a FFI fix has been added to remove left elements
-- | - a FFI fix has been added to remove left elements
-- | - an overlay has been added to synchronise the close button
-- | - an overlay has been added to synchronise the close button
-- | - the keyboard shortcut has been removed
-- | - the keyboard shortcut has been removed
-- | @https://stackoverflow.com/questions/50168312/bootstrap-4-close-modal-backdrop-doesnt-disappear
-- | @
link
https://stackoverflow.com/questions/50168312/bootstrap-4-close-modal-backdrop-doesnt-disappear
-- |
-- |
-- | https://getbootstrap.com/docs/4.6/components/modal/
-- |
@link
https://getbootstrap.com/docs/4.6/components/modal/
baseModal :: forall r. R2.OptComponent Options Props r
baseModal :: forall r. R2.OptComponent Options Props r
baseModal = R2.optComponent component options
baseModal = R2.optComponent component options
component :: R.
Component
Props
component :: R.
Memo
Props
component = R.hooksComponent componentName cpt where
component = R.
memo' $ R.
hooksComponent componentName cpt where
cpt props@{ isVisibleBox
cpt props@{ isVisibleBox
, title
, title
, hasCollapsibleBackground
, hasCollapsibleBackground
...
...
src/Gargantext/Components/Login.purs
View file @
051e70fa
...
@@ -5,9 +5,11 @@ module Gargantext.Components.Login where
...
@@ -5,9 +5,11 @@ module Gargantext.Components.Login where
import Gargantext.Prelude
import Gargantext.Prelude
import DOM.Simple.Event as DE
import Data.Array (head)
import Data.Array (head)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.String as DST
import Data.String as DST
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap as B
...
@@ -23,6 +25,7 @@ import Gargantext.Sessions as Sessions
...
@@ -23,6 +25,7 @@ import Gargantext.Sessions as Sessions
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 Reactix.SyntheticEvent as RE
import Toestand as T
import Toestand as T
here :: R2.Here
here :: R2.Here
...
@@ -44,6 +47,27 @@ login :: R2.Leaf Props
...
@@ -44,6 +47,27 @@ login :: R2.Leaf Props
login = R2.leaf loginCpt
login = R2.leaf loginCpt
loginCpt :: R.Component Props
loginCpt :: R.Component Props
loginCpt = here.component "login" cpt where
loginCpt = here.component "login" cpt where
cpt props@{ visible } _ = do
-- Render
pure $
B.baseModal
{ isVisibleBox: visible
, title: Just "GarganText ecosystem explorer"
, size: ExtraLargeModalSize
}
[
loginContainer
props
]
-- | @XXX React re-rendering issue with `React.Portal`
-- | @link https://github.com/facebook/react/issues/12247
loginContainer :: R2.Leaf Props
loginContainer = R2.leaf loginContainerCpt
loginContainerCpt :: R.Component Props
loginContainerCpt = here.component "container" cpt where
cpt props@{ sessions, visible } _ = do
cpt props@{ sessions, visible } _ = do
-- States
-- States
mBackend <- R2.useLive' props.backend
mBackend <- R2.useLive' props.backend
...
@@ -53,49 +77,96 @@ loginCpt = here.component "login" cpt where
...
@@ -53,49 +77,96 @@ loginCpt = here.component "login" cpt where
-- Render
-- Render
pure $
pure $
B.baseModal
H.div
{ isVisibleBox: visible
{}
, title: Just "GarganText ecosystem explorer"
, size: ExtraLargeModalSize
}
[
[
case mBackend of
case mBackend of
Nothing -> chooser props
Nothing -> chooser props
Just backend -> case formType' of
Just backend -> case formType' of
Login -> form { backend, formType, sessions, visible }
Login ->
ForgotPassword -> forgotPassword { backend, sessions }
form
{ backend
, formType
, sessions
, visible
}
ForgotPassword ->
forgotPassword
{ backend
, sessions
}
]
]
chooser :: R2.Leaf Props
chooser :: R2.Leaf Props
chooser = R2.leaf
Component
chooserCpt
chooser = R2.leaf chooserCpt
chooserCpt :: R.Component Props
chooserCpt :: R.Component Props
chooserCpt = here.component "chooser" cpt where
chooserCpt = here.component "chooser" cpt where
cpt { backend, backends, sessions } _ = do
cpt { backend, backends, sessions } _ = do
sessions' <- T.useLive T.unequal sessions
sessions' <- T.useLive T.unequal sessions
pure $
pure $
R.fragment $
H.div
[ H.h2 { className: "mx-auto" } [ H.text "Workspace manager" ]]
{} $
<> activeConnections sessions sessions' <>
[
[ H.h3 {} [ H.text "Existing places (click to login)" ]
H.h2
, H.table { className : "table" }
{ className: "mx-auto" }
[ H.thead { className: "thead-light" }
[ H.text "Workspace manager" ]
[ H.tr {} (map header headers) ]
]
, H.tbody {} (map (renderBackend backend) backends)
<>
activeConnections sessions sessions'
<>
[
H.h3
{}
[ H.text "Existing places (click to login)" ]
,
H.table
{ className : "table" }
[
H.thead
{ className: "thead-light" }
[
H.tr
{}
(map header headers)
]
,
H.tbody
{}
(map (renderBackend backend) backends)
]
,
H.input
{ className: "form-control"
, type:"text"
, placeholder: "Search for your institute"
}
]
]
, H.input { className: "form-control", type:"text", placeholder } ]
placeholder = "Search for your institute"
headers = [ "", "GarganText places", "Fonction", "Garg protocol url" ]
headers = [ "", "GarganText places", "Fonction", "Garg protocol url" ]
header label = H.th {} [ H.text label ]
header label = H.th {} [ H.text label ]
-- Shown in the chooser
-- Shown in the chooser
activeConnections :: forall s. T.ReadWrite s Sessions => s -> Sessions -> Array R.Element
activeConnections :: forall s. T.ReadWrite s Sessions => s -> Sessions -> Array R.Element
activeConnections _ sessions' | Sessions.null sessions'
= []
activeConnections _ sessions' | Sessions.null sessions'
= mempty
activeConnections sessions sessions' =
activeConnections sessions sessions' =
[ H.h3 {} [ H.text "Active place(s)" ]
[
, H.table { className : "table" }
H.h3
[ H.thead { className: "thead-light" }
{}
[ H.tr {} (map header headers) ]
[ H.text "Active place(s)" ]
, H.tbody {} [renderSessions sessions sessions']
,
H.table
{ className : "table" }
[
H.thead
{ className: "thead-light" }
[
H.tr
{}
(map header headers)
]
,
H.tbody
{}
[ renderSessions sessions sessions' ]
]
]
]
]
where
where
...
@@ -144,7 +215,11 @@ renderBackend cursor backend@(Backend {name, baseUrl, backendType}) =
...
@@ -144,7 +215,11 @@ renderBackend cursor backend@(Backend {name, baseUrl, backendType}) =
]
]
where
where
className = "fa fa-hand-o-right" -- "glyphitem fa fa-log-in"
className = "fa fa-hand-o-right" -- "glyphitem fa fa-log-in"
click _ = T.write_ (Just backend) cursor
click :: RE.SyntheticEvent DE.Event -> Effect Unit
click e = do
RE.preventDefault e
T.write_ (Just backend) cursor
backendLabel :: String -> String
backendLabel :: String -> String
backendLabel =
backendLabel =
...
...
src/Gargantext/Components/Login/Form.purs
View file @
051e70fa
src/Gargantext/Components/Router.purs
View file @
051e70fa
...
@@ -575,10 +575,12 @@ listsCpt = here.component "lists" cpt where
...
@@ -575,10 +575,12 @@ listsCpt = here.component "lists" cpt where
login' :: Boxes -> R.Element
login' :: Boxes -> R.Element
login' { backend, sessions, showLogin: visible } =
login' { backend, sessions, showLogin: visible } =
login { backend
login
{ backend
, backends: A.fromFoldable defaultBackends
, backends: A.fromFoldable defaultBackends
, sessions
, sessions
, visible }
, visible
}
--------------------------------------------------------------
--------------------------------------------------------------
...
...
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