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
143
Issues
143
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
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
514b4eee
Commit
514b4eee
authored
Jan 28, 2025
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Docs] refactor subcorpus modal
parent
ae221fac
Pipeline
#7304
passed with stages
in 24 minutes and 48 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
22 deletions
+21
-22
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+0
-16
SubcorpusCreation.purs
src/Gargantext/Components/DocsTable/SubcorpusCreation.purs
+21
-6
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
514b4eee
...
...
@@ -153,7 +153,6 @@ docViewCpt = R2.hereComponent here "docView" hCpt
isSubcorpusModalVisibleBox <- T.useBox false
onDocumentCreationPending /\ onDocumentCreationPendingBox <-
R2.useBox' false
reuseParentList' /\ reuseParentList <- R2.useBox' true
onSubcorpusCreationPending' /\ onSubcorpusCreationPending <- R2.useBox' false
{ goToRoute } <- useLinkHandler
...
...
@@ -261,19 +260,6 @@ docViewCpt = R2.hereComponent here "docView" hCpt
, status: onDocumentCreationPending ? Deferred $ Enabled
}
]
,
-- Document Creation Modal
B.baseModal
{ isVisibleBox: isDocumentModalVisibleBox
, title: Just "Add a new document"
, hasCollapsibleBackground: false
, size: LargeModalSize
}
[ DFC.documentFormCreation
{ callback: createDocumentCallback
, status: onDocumentCreationPending ? Deferred $ Enabled
}
]
,
-- Subcorpus Creation Modal
B.baseModal
...
...
@@ -285,8 +271,6 @@ docViewCpt = R2.hereComponent here "docView" hCpt
[ subcorpusCreation
{ callback: createSubcorpusCallback
, query'
, reuseParentList
, reuseParentList'
, onSubcorpusCreationPending'
}
]
...
...
src/Gargantext/Components/DocsTable/SubcorpusCreation.purs
View file @
514b4eee
...
...
@@ -3,9 +3,11 @@ module Gargantext.Components.DocsTable.SubcorpusCreation where
import Gargantext.Prelude
import Effect (Effect)
import Gargantext.Hooks.StateRecord (useStateRecord)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ComponentStatus(..), Variant(..))
import Gargantext.Utils.Reactix as R2
import Record.Unsafe (unsafeSet)
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
...
...
@@ -13,8 +15,6 @@ import Toestand as T
type Props =
( callback :: String -> Boolean -> Effect Unit
, query' :: String
, reuseParentList :: T.Box Boolean
, reuseParentList' :: Boolean
, onSubcorpusCreationPending' :: Boolean
)
...
...
@@ -24,23 +24,38 @@ subcorpusCreation = R2.leaf component
component :: R.Component Props
component = R.hooksComponent "subcorpusCreation" cpt
where
cpt { query', reuseParentList, reuseParentList', onSubcorpusCreationPending', callback } _ = do
cpt { query', onSubcorpusCreationPending', callback } _ = do
{ state, stateBox } <- useStateRecord (defaultData :: FormData)
let
onParentListCheckboxChange :: Boolean -> Effect Unit
onParentListCheckboxChange value = T.modify_
(\prev -> unsafeSet "reuseParentList" value prev)
stateBox
pure $ H.div {}
[ H.div { className: "form-group" }
[ H.label {} [ H.text $ "Creating subcorpus from query: " <> query' ]
]
, H.div { className: "form-check" }
[ B.formCheckbox
{ value:
reuseParentList'
, callback:
\_ -> T.modify_ not reuseParentList
{ value:
state.reuseParentList
, callback:
onParentListCheckboxChange
}
, H.label { className: "form-check-label" } [ H.text "Reuse parent list?" ]
]
, B.button
{ callback: \_ -> callback query'
reuseParentList'
{ callback: \_ -> callback query'
state.reuseParentList
, type: "submit"
, variant: ButtonVariant Primary
, status: if query' == "" then Disabled else if onSubcorpusCreationPending' then Deferred else Enabled
}
[ H.text "Create!" ]
]
type FormData = { reuseParentList :: Boolean }
defaultData :: FormData
defaultData =
{ reuseParentList: true
}
\ No newline at end of file
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