Commit ae221fac authored by Karen Konou's avatar Karen Konou

Tidy

parent b41ffafb
Pipeline #7255 passed with stages
in 19 minutes and 13 seconds
......@@ -197,7 +197,6 @@ docViewCpt = R2.hereComponent here "docView" hCpt
T2.reload reloadForest
goToRoute $ Routes.Corpus (sessionId session) id
-- handleRESTError hp errors eTask
-- \t -> liftEffect $ launchDocumentCreationProgress
-- errors
......@@ -270,8 +269,7 @@ docViewCpt = R2.hereComponent here "docView" hCpt
, hasCollapsibleBackground: false
, size: LargeModalSize
}
[
DFC.documentFormCreation
[ DFC.documentFormCreation
{ callback: createDocumentCallback
, status: onDocumentCreationPending ? Deferred $ Enabled
}
......@@ -284,8 +282,7 @@ docViewCpt = R2.hereComponent here "docView" hCpt
, hasCollapsibleBackground: false
, size: MediumModalSize
}
[
subcorpusCreation
[ subcorpusCreation
{ callback: createSubcorpusCallback
, query'
, reuseParentList
......@@ -337,7 +334,7 @@ docViewCpt = R2.hereComponent here "docView" hCpt
---------------------------------------------------
type SearchBarProps =
( query :: T.Box Query, isSubcorpusModalVisibleBox :: T.Box Boolean )
(query :: T.Box Query, isSubcorpusModalVisibleBox :: T.Box Boolean)
searchBar :: R2.Component SearchBarProps
searchBar = R.createElement searchBarCpt
......@@ -345,24 +342,26 @@ searchBar = R.createElement searchBarCpt
searchBarCpt :: R.Component SearchBarProps
searchBarCpt = here.component "searchBar" cpt
where
cpt { query, isSubcorpusModalVisibleBox} _children = do
cpt { query, isSubcorpusModalVisibleBox } _children = do
query' <- T.useLive T.unequal query
queryText <- T.useBox query'
queryText' <- T.useLive T.unequal queryText
pure $ R.fragment [
H.div {className: "input-group px-5"}
[ H.input { className: "form-control"
pure $ R.fragment
[ H.div { className: "input-group px-5" }
[ H.input
{ className: "form-control"
, id: "docs-input-search"
, defaultValue: query'
, on: { change: onSearchChange queryText
, keyUp: onSearchKeyup query queryText' }
, on:
{ change: onSearchChange queryText
, keyUp: onSearchKeyup query queryText'
}
, placeholder: "Search in documents"
, type: "text" }
, H.div {className: "input-group-append"}
[
if query' /= ""
then
, type: "text"
}
, H.div { className: "input-group-append" }
[ if query' /= "" then
R.fragment
[ clearButton query
, searchButton query queryText'
......@@ -405,12 +404,17 @@ searchBarCpt = here.component "searchBar" cpt
[ H.span { className: "text-danger fa fa-times" } [] ]
subCorpusButton modalVisible queryText' query =
H.button { className: "input-group-text btn btn-light text-secondary"
, on: { click: \_ -> do
H.button
{ className: "input-group-text btn btn-light text-secondary"
, on:
{ click: \_ -> do
T.write_ queryText' query
T.write_ true modalVisible }
, type: "submit" }
[ H.span {className: "fa fa-filter"} [] ]
T.write_ true modalVisible
}
, type: "submit"
, title: "Create a subcorpus"
}
[ H.span { className: "fa fa-filter" } [] ]
mock :: Boolean
mock = false
......
......@@ -22,26 +22,25 @@ subcorpusCreation :: R2.Leaf Props
subcorpusCreation = R2.leaf component
component :: R.Component Props
component = R.hooksComponent "subcorpusCreation" cpt where
cpt {query', reuseParentList, reuseParentList', onSubcorpusCreationPending', callback} _ = do
pure $ H.div {} [
H.div {className: "form-group"} [
H.label {} [ H.text $ "Creating subcorpus from query: " <> query' ]
component = R.hooksComponent "subcorpusCreation" cpt
where
cpt { query', reuseParentList, reuseParentList', onSubcorpusCreationPending', callback } _ = do
pure $ H.div {}
[ H.div { className: "form-group" }
[ H.label {} [ H.text $ "Creating subcorpus from query: " <> query' ]
]
,
H.div {className: "form-check" } [
B.formCheckbox
, H.div { className: "form-check" }
[ B.formCheckbox
{ value: reuseParentList'
, callback: \_ -> T.modify_ not reuseParentList
}
, H.label { className: "form-check-label"} [H.text "Reuse parent list?"]
, H.label { className: "form-check-label" } [ H.text "Reuse parent list?" ]
]
,
B.button
, B.button
{ callback: \_ -> callback query' reuseParentList'
, type: "submit"
, variant: ButtonVariant Primary
, status: if query' == "" then Disabled else if onSubcorpusCreationPending' then Deferred else Enabled
}
[ H.text "Create!"]
[ H.text "Create!" ]
]
......@@ -124,6 +124,7 @@ newtype SubcorpusParams = SubcorpusParams
{ query :: Query
, reuseParentList :: Boolean
}
derive instance Eq SubcorpusParams
derive instance Generic SubcorpusParams _
derive newtype instance JSON.ReadForeign SubcorpusParams
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment