Commit 21252bab authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[refactoring] fix broken Cpt refactoring

parent e8ade662
......@@ -38,10 +38,10 @@ type Props = (
forest :: R2.Component Props
forest = R.createElement forestCpt
where
forestCpt :: R.Component Props
forestCpt = R.hooksComponentWithModule thisModule "forest" cpt
forestCpt :: R.Component Props
forestCpt = R.hooksComponentWithModule thisModule "forest" cpt
where
cpt { appReload
, asyncTasksRef
, backend
......@@ -124,10 +124,10 @@ type ForestLayoutProps = (
forestLayout :: R2.Component ForestLayoutProps
forestLayout props = R.createElement forestLayoutCpt props
where
forestLayoutCpt :: R.Component ForestLayoutProps
forestLayoutCpt = R.hooksComponentWithModule thisModule "forestLayout" cpt
forestLayoutCpt :: R.Component ForestLayoutProps
forestLayoutCpt = R.hooksComponentWithModule thisModule "forestLayout" cpt
where
cpt props@{ handed } children = do
pure $ R.fragment [ topBar { handed } [], forestLayoutMain props children ]
......@@ -135,10 +135,10 @@ forestLayout props = R.createElement forestLayoutCpt props
-- while the remaining ones are put into the main view
forestLayoutWithTopBar :: R2.Component ForestLayoutProps
forestLayoutWithTopBar props = R.createElement forestLayoutWithTopBarCpt props
where
forestLayoutWithTopBarCpt :: R.Component ForestLayoutProps
forestLayoutWithTopBarCpt = R.hooksComponentWithModule thisModule "forestLayoutWithTopBar" cpt
forestLayoutWithTopBarCpt :: R.Component ForestLayoutProps
forestLayoutWithTopBarCpt = R.hooksComponentWithModule thisModule "forestLayoutWithTopBar" cpt
where
cpt props@{ handed } children = do
let { head: topBarChild, tail: mainChildren } =
fromMaybe { head: H.div {} [], tail: [] } $ A.uncons children
......@@ -149,10 +149,10 @@ forestLayoutWithTopBar props = R.createElement forestLayoutWithTopBarCpt props
forestLayoutMain :: R2.Component ForestLayoutProps
forestLayoutMain props = R.createElement forestLayoutMainCpt props
where
forestLayoutMainCpt :: R.Component ForestLayoutProps
forestLayoutMainCpt = R.hooksComponentWithModule thisModule "forestLayoutMain" cpt
forestLayoutMainCpt :: R.Component ForestLayoutProps
forestLayoutMainCpt = R.hooksComponentWithModule thisModule "forestLayoutMain" cpt
where
cpt props children = do
pure $ forestLayoutRaw props [
mainPage {} children
......@@ -160,10 +160,10 @@ forestLayoutMain props = R.createElement forestLayoutMainCpt props
forestLayoutRaw :: R2.Component ForestLayoutProps
forestLayoutRaw props = R.createElement forestLayoutRawCpt props
where
forestLayoutRawCpt :: R.Component ForestLayoutProps
forestLayoutRawCpt = R.hooksComponentWithModule thisModule "forestLayoutRaw" cpt
forestLayoutRawCpt :: R.Component ForestLayoutProps
forestLayoutRawCpt = R.hooksComponentWithModule thisModule "forestLayoutRaw" cpt
where
cpt { appReload
, asyncTasksRef
, backend
......@@ -194,10 +194,10 @@ forestLayoutRaw props = R.createElement forestLayoutRawCpt props
mainPage :: R2.Component ()
mainPage = R.createElement mainPageCpt
where
mainPageCpt :: R.Component ()
mainPageCpt = R.hooksComponentWithModule thisModule "mainPage" cpt
mainPageCpt :: R.Component ()
mainPageCpt = R.hooksComponentWithModule thisModule "mainPage" cpt
where
cpt {} children = do
pure $ H.div {className: "col-md-10"} [
H.div {id: "page-wrapper"} [
......
......@@ -63,11 +63,11 @@ type Props = (
)
treeView :: R2.Component Props
treeView = R.createElement elCpt
where
elCpt :: R.Component Props
elCpt = R.hooksComponentWithModule thisModule "treeView" cpt
treeView = R.createElement treeViewCpt
treeViewCpt :: R.Component Props
treeViewCpt = R.hooksComponentWithModule thisModule "treeView" cpt
where
cpt { appReload
, asyncTasks
, currentRoute
......@@ -90,11 +90,11 @@ treeView = R.createElement elCpt
} []
treeLoadView :: R2.Component Props
treeLoadView = R.createElement elCpt
where
elCpt :: R.Component Props
elCpt = R.hooksComponentWithModule thisModule "treeLoadView" cpt
treeLoadView = R.createElement treeLoadViewCpt
treeLoadViewCpt :: R.Component Props
treeLoadViewCpt = R.hooksComponentWithModule thisModule "treeLoadView" cpt
where
cpt { appReload
, asyncTasks
, currentRoute
......@@ -135,11 +135,11 @@ type TreeViewProps = (
)
loadedTreeViewFirstLevel :: R2.Component TreeViewProps
loadedTreeViewFirstLevel = R.createElement elCpt
where
elCpt :: R.Component TreeViewProps
elCpt = R.hooksComponentWithModule thisModule "loadedTreeViewFirstLevel" cpt
loadedTreeViewFirstLevel = R.createElement loadedTreeViewFirstLevelCpt
loadedTreeViewFirstLevelCpt :: R.Component TreeViewProps
loadedTreeViewFirstLevelCpt = R.hooksComponentWithModule thisModule "loadedTreeViewFirstLevel" cpt
where
cpt { appReload
, asyncTasks
, currentRoute
......@@ -180,11 +180,11 @@ type ToHtmlProps = (
)
toHtmlFirstLevel :: R2.Component ToHtmlProps
toHtmlFirstLevel = R.createElement elCpt
where
elCpt :: R.Component ToHtmlProps
elCpt = R.hooksComponentWithModule thisModule "toHtmlFirstLevel" cpt
toHtmlFirstLevel = R.createElement toHtmlFirstLevelCpt
toHtmlFirstLevelCpt :: R.Component ToHtmlProps
toHtmlFirstLevelCpt = R.hooksComponentWithModule thisModule "toHtmlFirstLevel" cpt
where
cpt p@{ appReload
, asyncTasks
, currentRoute
......@@ -268,11 +268,11 @@ type ChildNodeFirstLevelProps = (
)
childNodeFirstLevel :: R2.Component ChildNodeFirstLevelProps
childNodeFirstLevel = R.createElement elCpt
where
elCpt :: R.Component ChildNodeFirstLevelProps
elCpt = R.hooksComponentWithModule thisModule "childNodeFirstLevel" cpt
childNodeFirstLevel = R.createElement childNodeFirstLevelCpt
childNodeFirstLevelCpt :: R.Component ChildNodeFirstLevelProps
childNodeFirstLevelCpt = R.hooksComponentWithModule thisModule "childNodeFirstLevel" cpt
where
cpt props@{ appReload
, asyncTasks
, currentRoute
......@@ -313,11 +313,11 @@ type ChildNodeFirstLevelPaintProps = (
)
childNodeFirstLevelPaint :: R2.Component ChildNodeFirstLevelPaintProps
childNodeFirstLevelPaint = R.createElement elCpt
where
elCpt :: R.Component ChildNodeFirstLevelPaintProps
elCpt = R.hooksComponentWithModule thisModule "childNodeFirstLevelPaint" cpt
childNodeFirstLevelPaint = R.createElement childNodeFirstLevelPainCpt
childNodeFirstLevelPainCpt :: R.Component ChildNodeFirstLevelPaintProps
childNodeFirstLevelPainCpt = R.hooksComponentWithModule thisModule "childNodeFirstLevelPaint" cpt
where
-- TODO folderOpen is unused
cpt props@{ asyncTasks
......
......@@ -60,19 +60,19 @@ type IsLeaf = Boolean
nodeSpan :: R2.Component NodeMainSpanProps
nodeSpan = R.createElement nodeSpanCpt
where
nodeSpanCpt :: R.Component NodeMainSpanProps
nodeSpanCpt = R.hooksComponentWithModule thisModule "nodeSpan" cpt
nodeSpanCpt :: R.Component NodeMainSpanProps
nodeSpanCpt = R.hooksComponentWithModule thisModule "nodeSpan" cpt
where
cpt props children = do
pure $ H.div {} ([ nodeMainSpan props [] ] <> children)
nodeMainSpan :: R2.Component NodeMainSpanProps
nodeMainSpan = R.createElement nodeMainSpanCpt
where
nodeMainSpanCpt :: R.Component NodeMainSpanProps
nodeMainSpanCpt = R.hooksComponentWithModule thisModule "nodeMainSpan" cpt
nodeMainSpanCpt :: R.Component NodeMainSpanProps
nodeMainSpanCpt = R.hooksComponentWithModule thisModule "nodeMainSpan" cpt
where
cpt props@{ appReload
, asyncTasks: (asyncTasks /\ dispatchAsyncTasks)
, currentRoute
......@@ -249,10 +249,10 @@ type NodeActionsProps =
nodeActions :: Record NodeActionsProps -> R.Element
nodeActions p = R.createElement nodeActionsCpt p []
where
nodeActionsCpt :: R.Component NodeActionsProps
nodeActionsCpt = R.hooksComponentWithModule thisModule "nodeActions" cpt
nodeActionsCpt :: R.Component NodeActionsProps
nodeActionsCpt = R.hooksComponentWithModule thisModule "nodeActions" cpt
where
cpt { id
, nodeType: GT.Graph
, session
......
......@@ -24,10 +24,10 @@ moveNodeReq session fromId toId =
moveNode :: Record SubTreeParamsIn -> R.Element
moveNode p = R.createElement moveNodeCpt p []
where
moveNodeCpt :: R.Component SubTreeParamsIn
moveNodeCpt = R.hooksComponentWithModule thisModule "moveNode" cpt
moveNodeCpt :: R.Component SubTreeParamsIn
moveNodeCpt = R.hooksComponentWithModule thisModule "moveNode" cpt
where
cpt { dispatch, handed, id, nodeType, session, subTreeParams } _ = do
action@(valAction /\ setAction) :: R.State Action <- R.useState' (MoveNode {params: Nothing})
......
......@@ -41,10 +41,10 @@ type SearchIFramesProps = (
searchIframes :: Record SearchIFramesProps -> R.Element
searchIframes props = R.createElement searchIframesCpt props []
where
searchIframesCpt :: R.Component SearchIFramesProps
searchIframesCpt = R.hooksComponentWithModule thisModule "searchIframes" cpt
searchIframesCpt :: R.Component SearchIFramesProps
searchIframesCpt = R.hooksComponentWithModule thisModule "searchIframes" cpt
where
cpt { iframeRef, search: search@(search' /\ _) } _ = do
pure $ if isIsTex_Advanced search'.datafield
then divIframe { frameSource: Istex, iframeRef, search }
......@@ -62,10 +62,10 @@ type IFrameProps = (
divIframe :: Record IFrameProps -> R.Element
divIframe props = R.createElement divIframeCpt props []
where
divIframeCpt :: R.Component IFrameProps
divIframeCpt = R.hooksComponentWithModule thisModule "divIframe" cpt
divIframeCpt :: R.Component IFrameProps
divIframeCpt = R.hooksComponentWithModule thisModule "divIframe" cpt
where
cpt { frameSource, iframeRef, search: search@(search' /\ _) } _ = do
pure $ H.div { className: "frame-search card" }
[ iframeWith { frameSource, iframeRef, search } ]
......@@ -77,10 +77,10 @@ frameUrl Searx = "https://searx.frame.gargantext.org" -- 192.168.1.4:8080"
iframeWith :: Record IFrameProps -> R.Element
iframeWith props = R.createElement iframeWithCpt props []
where
iframeWithCpt :: R.Component IFrameProps
iframeWithCpt = R.hooksComponentWithModule thisModule "iframeWith" cpt
iframeWithCpt :: R.Component IFrameProps
iframeWithCpt = R.hooksComponentWithModule thisModule "iframeWith" cpt
where
cpt { frameSource, iframeRef, search: (search /\ setSearch) } _ =
pure $ H.iframe { src: src frameSource search.term
, width: "100%"
......
......@@ -26,10 +26,10 @@ type Props = ( langs :: Array Lang
searchBar :: Record Props -> R.Element
searchBar props = R.createElement searchBarCpt props []
where
searchBarCpt :: R.Component Props
searchBarCpt = R.hooksComponentWithModule thisModule "searchBar" cpt
searchBarCpt :: R.Component Props
searchBarCpt = R.hooksComponentWithModule thisModule "searchBar" cpt
where
cpt {langs, onSearch, search: search@(s /\ _), session} _ = do
--onSearchChange session s
pure $ H.div { className: "search-bar" }
......
......@@ -266,10 +266,10 @@ type DatabaseInputProps = (
databaseInput :: R2.Component DatabaseInputProps
databaseInput = R.createElement databaseInputCpt
where
databaseInputCpt :: R.Component DatabaseInputProps
databaseInputCpt = R.hooksComponentWithModule thisModule "databaseInput" cpt
databaseInputCpt :: R.Component DatabaseInputProps
databaseInputCpt = R.hooksComponentWithModule thisModule "databaseInput" cpt
where
cpt { databases
, search: (search /\ setSearch) } _ = do
pure $
......@@ -338,10 +338,10 @@ type SearchInputProps =
searchInput :: Record SearchInputProps -> R.Element
searchInput p = R.createElement searchInputCpt p []
where
searchInputCpt :: R.Component SearchInputProps
searchInputCpt = R.hooksComponentWithModule thisModule "searchInput" cpt
searchInputCpt :: R.Component SearchInputProps
searchInputCpt = R.hooksComponentWithModule thisModule "searchInput" cpt
where
cpt {search: (search@{ term } /\ setSearch)} _ = do
valueRef <- R.useRef term
......
......@@ -57,10 +57,10 @@ instance encodeJsonShareNodeParams :: Argonaut.EncodeJson ShareNodeParams where
------------------------------------------------------------------------
shareNode :: Record SubTreeParamsIn -> R.Element
shareNode p = R.createElement shareNodeCpt p []
where
shareNodeCpt :: R.Component SubTreeParamsIn
shareNodeCpt = R.hooksComponentWithModule thisModule "shareNode" cpt
shareNodeCpt :: R.Component SubTreeParamsIn
shareNodeCpt = R.hooksComponentWithModule thisModule "shareNode" cpt
where
cpt p@{dispatch, subTreeParams, id, nodeType, session, handed} _ = do
action@(valAction /\ setAction) :: R.State Action <- R.useState' (Action.SharePublic {params: Nothing})
......
......@@ -71,10 +71,10 @@ type UploadFile =
uploadFileView :: Record Props -> R.Element
uploadFileView props = R.createElement uploadFileViewCpt props []
where
uploadFileViewCpt :: R.Component Props
uploadFileViewCpt = R.hooksComponentWithModule thisModule "uploadFileView" cpt
uploadFileViewCpt :: R.Component Props
uploadFileViewCpt = R.hooksComponentWithModule thisModule "uploadFileView" cpt
where
cpt {dispatch, id, nodeType} _ = do
mFile :: R.State (Maybe UploadFile) <- R.useState' Nothing
fileType@(_ /\ setFileType) <- R.useState' CSV
......
......@@ -48,10 +48,10 @@ type CommonProps =
nodePopupView :: Record NodePopupProps -> R.Element
nodePopupView p = R.createElement nodePopupCpt p []
where
nodePopupCpt :: R.Component NodePopupProps
nodePopupCpt = R.hooksComponentWithModule thisModule "nodePopupView" cpt
nodePopupCpt :: R.Component NodePopupProps
nodePopupCpt = R.hooksComponentWithModule thisModule "nodePopupView" cpt
where
cpt p _ = do
renameIsOpen <- R.useState' false
......@@ -254,10 +254,10 @@ type PanelActionProps =
panelAction :: Record PanelActionProps -> R.Element
panelAction p = R.createElement panelActionCpt p []
where
panelActionCpt :: R.Component PanelActionProps
panelActionCpt = R.hooksComponentWithModule thisModule "panelAction" cpt
panelActionCpt :: R.Component PanelActionProps
panelActionCpt = R.hooksComponentWithModule thisModule "panelAction" cpt
where
cpt {action: Documentation nodeType} _ = actionDoc nodeType
cpt {action: Download, id, nodeType, session} _ = actionDownload nodeType id session
cpt {action: Upload, dispatch, id, nodeType, session} _ = actionUpload nodeType id session dispatch
......
......@@ -292,10 +292,10 @@ type NodeLinkProps = (
nodeLink :: R2.Component NodeLinkProps
nodeLink = R.createElement nodeLinkCpt
where
nodeLinkCpt :: R.Component NodeLinkProps
nodeLinkCpt = R.hooksComponentWithModule thisModule "nodeLink" cpt
nodeLinkCpt :: R.Component NodeLinkProps
nodeLinkCpt = R.hooksComponentWithModule thisModule "nodeLink" cpt
where
cpt { folderOpen: (_ /\ setFolderOpen)
, frontends
, handed
......@@ -348,10 +348,10 @@ type NodeTextProps =
nodeText :: Record NodeTextProps -> R.Element
nodeText p = R.createElement nodeTextCpt p []
where
nodeTextCpt :: R.Component NodeTextProps
nodeTextCpt = R.hooksComponentWithModule thisModule "nodeText" cpt
nodeTextCpt :: R.Component NodeTextProps
nodeTextCpt = R.hooksComponentWithModule thisModule "nodeText" cpt
where
cpt { isSelected: true, name } _ = do
pure $ H.u {} [
H.b {} [
......
......@@ -36,10 +36,10 @@ type SubTreeParamsProps =
subTreeView :: Record SubTreeParamsProps -> R.Element
subTreeView props = R.createElement subTreeViewCpt props []
where
subTreeViewCpt :: R.Component SubTreeParamsProps
subTreeViewCpt = R.hooksComponentWithModule thisModule "subTreeView" cpt
subTreeViewCpt :: R.Component SubTreeParamsProps
subTreeViewCpt = R.hooksComponentWithModule thisModule "subTreeView" cpt
where
cpt params@{ action
, dispatch
, handed
......
......@@ -54,10 +54,10 @@ type Props =
sidebar :: Record Props -> R.Element
sidebar props = R.createElement sidebarCpt props []
where
sidebarCpt :: R.Component Props
sidebarCpt = R.hooksComponentWithModule thisModule "sidebar" cpt
sidebarCpt :: R.Component Props
sidebarCpt = R.hooksComponentWithModule thisModule "sidebar" cpt
where
cpt {showSidePanel: (GET.Closed /\ _)} _children = do
pure $ RH.div {} []
cpt {showSidePanel: (GET.InitialClosed /\ _)} _children = do
......
......@@ -25,10 +25,9 @@ type Props a = (
inputWithEnter :: forall a. Record (Props a) -> R.Element
inputWithEnter props = R.createElement inputWithEnterCpt props []
inputWithEnterCpt :: forall a. R.Component (Props a)
inputWithEnterCpt = R.hooksComponentWithModule thisModule "inputWithEnter" cpt
where
inputWithEnterCpt :: forall a. R.Component (Props a)
inputWithEnterCpt = R.hooksComponentWithModule thisModule "inputWithEnter" cpt
cpt props@{ onEnter, onValueChanged
, autoFocus, autoSave, className, defaultValue, placeholder } _ = do
pure $ H.input { on: { blur: \_ -> if autoSave then onEnter unit else pure unit
......
......@@ -274,10 +274,9 @@ type Props = (
loadedNgramsTable :: R2.Component Props
loadedNgramsTable = R.createElement loadedNgramsTableCpt
loadedNgramsTableCpt :: R.Component Props
loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable" cpt
where
loadedNgramsTableCpt :: R.Component Props
loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable" cpt
cpt props@{ afterSync
, appReload
, asyncTasksRef
......@@ -524,10 +523,9 @@ type MainNgramsTableProps = (
mainNgramsTable :: R2.Component MainNgramsTableProps
mainNgramsTable = R.createElement mainNgramsTableCpt
mainNgramsTableCpt :: R.Component MainNgramsTableProps
mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
where
mainNgramsTableCpt :: R.Component MainNgramsTableProps
mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
cpt props@{ afterSync
, appReload
, asyncTasksRef
......@@ -631,10 +629,10 @@ type MainNgramsTablePaintProps = (
mainNgramsTablePaint :: R2.Component MainNgramsTablePaintProps
mainNgramsTablePaint = R.createElement mainNgramsTablePaintCpt
where
mainNgramsTablePaintCpt :: R.Component MainNgramsTablePaintProps
mainNgramsTablePaintCpt = R.hooksComponentWithModule thisModule "mainNgramsTablePaint" cpt
mainNgramsTablePaintCpt :: R.Component MainNgramsTablePaintProps
mainNgramsTablePaintCpt = R.hooksComponentWithModule thisModule "mainNgramsTablePaint" cpt
where
cpt props@{ afterSync
, appReload
, asyncTasksRef
......@@ -670,10 +668,10 @@ type MainNgramsTablePaintNoCacheProps = (
mainNgramsTablePaintNoCache :: R2.Component MainNgramsTablePaintNoCacheProps
mainNgramsTablePaintNoCache = R.createElement mainNgramsTablePaintNoCacheCpt
where
mainNgramsTablePaintNoCacheCpt :: R.Component MainNgramsTablePaintNoCacheProps
mainNgramsTablePaintNoCacheCpt = R.hooksComponentWithModule thisModule "mainNgramsTablePaintNoCache" cpt
mainNgramsTablePaintNoCacheCpt :: R.Component MainNgramsTablePaintNoCacheProps
mainNgramsTablePaintNoCacheCpt = R.hooksComponentWithModule thisModule "mainNgramsTablePaintNoCache" cpt
where
cpt props@{ afterSync
, appReload
, asyncTasksRef
......
......@@ -1129,10 +1129,10 @@ type SyncResetButtonsProps =
syncResetButtons :: Record SyncResetButtonsProps -> R.Element
syncResetButtons p = R.createElement syncResetButtonsCpt p []
where
syncResetButtonsCpt :: R.Component SyncResetButtonsProps
syncResetButtonsCpt = R.hooksComponentWithModule thisModule "syncResetButtons" cpt
syncResetButtonsCpt :: R.Component SyncResetButtonsProps
syncResetButtonsCpt = R.hooksComponentWithModule thisModule "syncResetButtons" cpt
where
cpt { afterSync, ngramsLocalPatch, performAction } _ = do
synchronizing@(s /\ setSynchronizing) <- R.useState' false
......
......@@ -144,10 +144,10 @@ type NgramsViewTabsProps = (
ngramsView :: R2.Component NgramsViewTabsProps
ngramsView = R.createElement ngramsViewCpt
where
ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
where
cpt { appReload
, asyncTasksRef
, cacheState
......
......@@ -47,10 +47,10 @@ type KeyProps =
corpusLayout :: Record Props -> R.Element
corpusLayout props = R.createElement corpusLayoutCpt props []
where
corpusLayoutCpt :: R.Component Props
corpusLayoutCpt = R.hooksComponentWithModule thisModule "corpusLayout" cpt
corpusLayoutCpt :: R.Component Props
corpusLayoutCpt = R.hooksComponentWithModule thisModule "corpusLayout" cpt
where
cpt { nodeId, session } _ = do
let sid = sessionId session
......@@ -59,10 +59,9 @@ corpusLayout props = R.createElement corpusLayoutCpt props []
corpusLayoutWithKey :: Record KeyProps -> R.Element
corpusLayoutWithKey props = R.createElement corpusLayoutWithKeyCpt props []
corpusLayoutWithKeyCpt :: R.Component KeyProps
corpusLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "corpusLayoutWithKey" cpt
where
corpusLayoutWithKeyCpt :: R.Component KeyProps
corpusLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "corpusLayoutWithKey" cpt
cpt { nodeId, session } _ = do
reload <- GUR.new
......@@ -77,10 +76,10 @@ type ViewProps =
corpusLayoutView :: Record ViewProps -> R.Element
corpusLayoutView props = R.createElement corpusLayoutViewCpt props []
where
corpusLayoutViewCpt :: R.Component ViewProps
corpusLayoutViewCpt = R.hooksComponentWithModule thisModule "corpusLayoutView" cpt
corpusLayoutViewCpt :: R.Component ViewProps
corpusLayoutViewCpt = R.hooksComponentWithModule thisModule "corpusLayoutView" cpt
where
cpt {corpus: (NodePoly {hyperdata: Hyperdata {fields}}), nodeId, reload, session} _ = do
let fieldsWithIndex = List.mapWithIndex (\idx -> \t -> Tuple idx t) fields
fieldsS <- R.useState' fieldsWithIndex
......@@ -140,11 +139,11 @@ type FieldsCodeEditorProps =
)
fieldsCodeEditor :: R2.Component FieldsCodeEditorProps
fieldsCodeEditor = R.createElement el
where
el :: R.Component FieldsCodeEditorProps
el = R.hooksComponentWithModule thisModule "fieldsCodeEditorCpt" cpt
fieldsCodeEditor = R.createElement fieldsCodeEditorCpt
fieldsCodeEditorCpt :: R.Component FieldsCodeEditorProps
fieldsCodeEditorCpt = R.hooksComponentWithModule thisModule "fieldsCodeEditorCpt" cpt
where
cpt {nodeId, fields: fS@(fields /\ _), session} _ = do
masterKey <- GUR.new
......@@ -210,10 +209,10 @@ type FieldCodeEditorProps =
fieldCodeEditorWrapper :: Record FieldCodeEditorProps -> R.Element
fieldCodeEditorWrapper props = R.createElement fieldCodeEditorWrapperCpt props []
where
fieldCodeEditorWrapperCpt :: R.Component FieldCodeEditorProps
fieldCodeEditorWrapperCpt = R.hooksComponentWithModule thisModule "fieldCodeEditorWrapperCpt" cpt
fieldCodeEditorWrapperCpt :: R.Component FieldCodeEditorProps
fieldCodeEditorWrapperCpt = R.hooksComponentWithModule thisModule "fieldCodeEditorWrapperCpt" cpt
where
cpt props@{canMoveDown, canMoveUp, field: Field {name, typ}, onMoveDown, onMoveUp, onRemove, onRename} _ = do
pure $ H.div { className: "row card" } [
H.div { className: "card-header" } [
......@@ -259,10 +258,10 @@ type RenameableProps =
renameable :: Record RenameableProps -> R.Element
renameable props = R.createElement renameableCpt props []
where
renameableCpt :: R.Component RenameableProps
renameableCpt = R.hooksComponentWithModule thisModule "renameableCpt" cpt
renameableCpt :: R.Component RenameableProps
renameableCpt = R.hooksComponentWithModule thisModule "renameableCpt" cpt
where
cpt {onRename, text} _ = do
isEditing <- R.useState' false
state <- R.useState' text
......@@ -289,10 +288,10 @@ type RenameableTextProps =
renameableText :: Record RenameableTextProps -> R.Element
renameableText props = R.createElement renameableTextCpt props []
where
renameableTextCpt :: R.Component RenameableTextProps
renameableTextCpt = R.hooksComponentWithModule thisModule "renameableTextCpt" cpt
renameableTextCpt :: R.Component RenameableTextProps
renameableTextCpt = R.hooksComponentWithModule thisModule "renameableTextCpt" cpt
where
cpt {isEditing: (false /\ setIsEditing), state: (text /\ _)} _ = do
pure $ H.div { className: "input-group" }
[ H.input { className: "form-control"
......@@ -328,10 +327,10 @@ renameableText props = R.createElement renameableTextCpt props []
fieldCodeEditor :: Record FieldCodeEditorProps -> R.Element
fieldCodeEditor props = R.createElement fieldCodeEditorCpt props []
where
fieldCodeEditorCpt :: R.Component FieldCodeEditorProps
fieldCodeEditorCpt = R.hooksComponentWithModule thisModule "fieldCodeEditorCpt" cpt
fieldCodeEditorCpt :: R.Component FieldCodeEditorProps
fieldCodeEditorCpt = R.hooksComponentWithModule thisModule "fieldCodeEditorCpt" cpt
where
cpt {field: Field {typ: typ@(Haskell {haskell})}, onChange} _ = do
pure $ CE.codeEditor {code: haskell, defaultCodeType: CE.Haskell, onChange: changeCode onChange typ}
......
......@@ -29,10 +29,10 @@ cacheName = "metrics"
metricsLoadView :: forall a. Record (MetricsLoadViewProps a) -> R.Element
metricsLoadView p = R.createElement metricsLoadViewCpt p []
where
metricsLoadViewCpt :: R.Component (MetricsLoadViewProps a)
metricsLoadViewCpt = R.hooksComponentWithModule thisModule "metricsLoadView" cpt
metricsLoadViewCpt :: R.Component (MetricsLoadViewProps a)
metricsLoadViewCpt = R.hooksComponentWithModule thisModule "metricsLoadView" cpt
where
cpt { getMetrics, loaded, path, reload, session } _ = do
useLoader (fst reload /\ path) (getMetrics session) $ \l ->
loaded { path, reload, session } l
......@@ -48,10 +48,10 @@ type MetricsWithCacheLoadViewProps res ret = (
metricsWithCacheLoadView :: forall res ret. DecodeJson res =>
Record (MetricsWithCacheLoadViewProps res ret) -> R.Element
metricsWithCacheLoadView p = R.createElement metricsWithCacheLoadViewCpt p []
where
metricsWithCacheLoadViewCpt :: R.Component (MetricsWithCacheLoadViewProps res ret)
metricsWithCacheLoadViewCpt = R.hooksComponentWithModule thisModule "metricsWithCacheLoadView" cpt
metricsWithCacheLoadViewCpt :: R.Component (MetricsWithCacheLoadViewProps res ret)
metricsWithCacheLoadViewCpt = R.hooksComponentWithModule thisModule "metricsWithCacheLoadView" cpt
where
cpt { getMetricsHash, handleResponse, loaded, mkRequest, path, reload, session } _ = do
useLoaderWithCacheAPI { cacheEndpoint: (getMetricsHash session)
, handleResponse
......
......@@ -81,10 +81,10 @@ mkRequest session (_ /\ path@{ corpusId, limit, listId, tabType }) = GUC.makeGet
histo :: Record Props -> R.Element
histo props = R.createElement histoCpt props []
where
histoCpt :: R.Component Props
histoCpt = R.hooksComponentWithModule thisModule "histo" cpt
histoCpt :: R.Component Props
histoCpt = R.hooksComponentWithModule thisModule "histo" cpt
where
cpt { path, session } _ = do
reload <- R.useState' 0
pure $ metricsWithCacheLoadView {
......
......@@ -33,10 +33,10 @@ type Props =
dashboardLayout :: R2.Component Props
dashboardLayout = R.createElement dashboardLayoutCpt
where
dashboardLayoutCpt :: R.Component Props
dashboardLayoutCpt = R.hooksComponentWithModule thisModule "dashboardLayout" cpt
dashboardLayoutCpt :: R.Component Props
dashboardLayoutCpt = R.hooksComponentWithModule thisModule "dashboardLayout" cpt
where
cpt { nodeId, session } _ = do
let sid = sessionId session
......@@ -49,10 +49,10 @@ type KeyProps = (
dashboardLayoutWithKey :: R2.Component KeyProps
dashboardLayoutWithKey = R.createElement dashboardLayoutWithKeyCpt
where
dashboardLayoutWithKeyCpt :: R.Component KeyProps
dashboardLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "dashboardLayoutWithKey" cpt
dashboardLayoutWithKeyCpt :: R.Component KeyProps
dashboardLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "dashboardLayoutWithKey" cpt
where
cpt { nodeId, session } _ = do
reload <- GUR.new
......@@ -90,10 +90,10 @@ type LoadedProps =
dashboardLayoutLoaded :: R2.Component LoadedProps
dashboardLayoutLoaded = R.createElement dashboardLayoutLoadedCpt
where
dashboardLayoutLoadedCpt :: R.Component LoadedProps
dashboardLayoutLoadedCpt = R.hooksComponentWithModule thisModule "dashboardLayoutLoaded" cpt
dashboardLayoutLoadedCpt :: R.Component LoadedProps
dashboardLayoutLoadedCpt = R.hooksComponentWithModule thisModule "dashboardLayoutLoaded" cpt
where
cpt props@{ charts, corpusId, defaultListId, fields, nodeId, onChange, session } _ = do
pure $ H.div {}
[ H.div { className: "row" }
......@@ -201,10 +201,10 @@ type PredefinedChartProps =
renderChart :: R2.Component PredefinedChartProps
renderChart = R.createElement renderChartCpt
where
renderChartCpt :: R.Component PredefinedChartProps
renderChartCpt = R.hooksComponentWithModule thisModule "renderChart" cpt
renderChartCpt :: R.Component PredefinedChartProps
renderChartCpt = R.hooksComponentWithModule thisModule "renderChart" cpt
where
cpt { chart, corpusId, defaultListId, onChange, onRemove, session } _ = do
pure $ H.div { className: "row chart card" }
[ H.div { className: "card-header" }
......
......@@ -54,10 +54,10 @@ type DocViewProps = (
docView :: R2.Component DocViewProps
docView = R.createElement docViewCpt
where
docViewCpt :: R.Component DocViewProps
docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt
docViewCpt :: R.Component DocViewProps
docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt
where
cpt { path
, loaded: loaded@{ ngramsTable: Versioned { data: initTable }, document }
, state: state@({ ngramsVersion: version, ngramsLocalPatch } /\ _)
......
......@@ -35,10 +35,10 @@ type ListsWithForest = (