Commit a60c6c57 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[refactoring] some small refactoring

parent 7a2019fa
...@@ -97,13 +97,14 @@ type FolderProps = ...@@ -97,13 +97,14 @@ type FolderProps =
folder :: R2.Component FolderProps folder :: R2.Component FolderProps
folder = R.createElement folderCpt folder = R.createElement folderCpt
folderCpt :: R.Component FolderProps folderCpt :: R.Component FolderProps
folderCpt = here.component "folderCpt" cpt where folderCpt = here.component "folderCpt" cpt where
cpt {style, text, nodeId, sid, nodeType} _ = do cpt {style, text, nodeId, sid, nodeType} _ = do
pure $ H.a {className: "btn btn-primary", href: "/#/" <> getFolderPath nodeType sid nodeId} [ H.i { className: icon style nodeType } [] pure $ H.a { className: "btn btn-primary"
, H.br {} , href: "/#/" <> getFolderPath nodeType sid nodeId }
, H.text text] [ H.i { className: icon style nodeType } []
, H.br {}
, H.text text ]
icon :: FolderStyle -> GT.NodeType -> String icon :: FolderStyle -> GT.NodeType -> String
icon FolderUp _ = "fa fa-folder-open" icon FolderUp _ = "fa fa-folder-open"
......
...@@ -51,10 +51,10 @@ type Universal = ...@@ -51,10 +51,10 @@ type Universal =
-- Shared by every component here + nodeSpan -- Shared by every component here + nodeSpan
type Global = type Global =
( frontends :: Frontends ( frontends :: Frontends
, handed :: Handed , handed :: Handed
, route :: T.Box AppRoute , route :: T.Box AppRoute
, tasks :: T.Box GAT.Storage , tasks :: T.Box GAT.Storage
| Universal ) | Universal )
-- Shared by every component here -- Shared by every component here
...@@ -69,7 +69,6 @@ type LoaderProps = ( session :: Session, root :: ID | Common ) ...@@ -69,7 +69,6 @@ type LoaderProps = ( session :: Session, root :: ID | Common )
-- | Loads and renders the tree starting at the given root node id. -- | Loads and renders the tree starting at the given root node id.
treeLoader :: R2.Component LoaderProps treeLoader :: R2.Component LoaderProps
treeLoader = R.createElement treeLoaderCpt treeLoader = R.createElement treeLoaderCpt
treeLoaderCpt :: R.Component LoaderProps treeLoaderCpt :: R.Component LoaderProps
treeLoaderCpt = here.component "treeLoader" cpt where treeLoaderCpt = here.component "treeLoader" cpt where
-- treeLoaderCpt :: R.Memo LoaderProps -- treeLoaderCpt :: R.Memo LoaderProps
...@@ -96,7 +95,6 @@ type TreeProps = ( tree :: FTree | NodeProps ) ...@@ -96,7 +95,6 @@ type TreeProps = ( tree :: FTree | NodeProps )
tree :: R2.Leaf TreeProps tree :: R2.Leaf TreeProps
tree props = R.createElement treeCpt props [] tree props = R.createElement treeCpt props []
treeCpt :: R.Component TreeProps treeCpt :: R.Component TreeProps
treeCpt = here.component "tree" cpt where treeCpt = here.component "tree" cpt where
cpt p@{ reload, session, tree: NTree (LNode { id, name, nodeType }) children } _ = do cpt p@{ reload, session, tree: NTree (LNode { id, name, nodeType }) children } _ = do
...@@ -134,7 +132,6 @@ type ChildrenTreeProps = ...@@ -134,7 +132,6 @@ type ChildrenTreeProps =
renderChildren :: R2.Component ChildrenTreeProps renderChildren :: R2.Component ChildrenTreeProps
renderChildren = R.createElement renderChildrenCpt renderChildren = R.createElement renderChildrenCpt
renderChildrenCpt :: R.Component ChildrenTreeProps renderChildrenCpt :: R.Component ChildrenTreeProps
renderChildrenCpt = here.component "renderChildren" cpt where renderChildrenCpt = here.component "renderChildren" cpt where
cpt p@{ childProps: { folderOpen } } _ = do cpt p@{ childProps: { folderOpen } } _ = do
...@@ -147,7 +144,6 @@ renderChildrenCpt = here.component "renderChildren" cpt where ...@@ -147,7 +144,6 @@ renderChildrenCpt = here.component "renderChildren" cpt where
renderTreeChildren :: R2.Component ChildrenTreeProps renderTreeChildren :: R2.Component ChildrenTreeProps
renderTreeChildren = R.createElement renderTreeChildrenCpt renderTreeChildren = R.createElement renderTreeChildrenCpt
renderTreeChildrenCpt :: R.Component ChildrenTreeProps renderTreeChildrenCpt :: R.Component ChildrenTreeProps
renderTreeChildrenCpt = here.component "renderTreeChildren" cpt where renderTreeChildrenCpt = here.component "renderTreeChildren" cpt where
cpt p@{ childProps: { children' cpt p@{ childProps: { children'
...@@ -180,7 +176,6 @@ type ChildLoaderProps = ( id :: ID, render :: R2.Leaf TreeProps | NodeProps ) ...@@ -180,7 +176,6 @@ type ChildLoaderProps = ( id :: ID, render :: R2.Leaf TreeProps | NodeProps )
childLoader :: R2.Component ChildLoaderProps childLoader :: R2.Component ChildLoaderProps
childLoader = R.createElement childLoaderCpt childLoader = R.createElement childLoaderCpt
childLoaderCpt :: R.Component ChildLoaderProps childLoaderCpt :: R.Component ChildLoaderProps
childLoaderCpt = here.component "childLoader" cpt where childLoaderCpt = here.component "childLoader" cpt where
cpt p@{ render } _ = do cpt p@{ render } _ = do
......
...@@ -39,7 +39,6 @@ type SubTreeParamsProps = ...@@ -39,7 +39,6 @@ type SubTreeParamsProps =
subTreeView :: R2.Component SubTreeParamsProps subTreeView :: R2.Component SubTreeParamsProps
subTreeView = R.createElement subTreeViewCpt subTreeView = R.createElement subTreeViewCpt
subTreeViewCpt :: R.Component SubTreeParamsProps subTreeViewCpt :: R.Component SubTreeParamsProps
subTreeViewCpt = here.component "subTreeView" cpt subTreeViewCpt = here.component "subTreeView" cpt
where where
...@@ -86,7 +85,6 @@ type CorpusTreeProps = ...@@ -86,7 +85,6 @@ type CorpusTreeProps =
subTreeViewLoaded :: R2.Component CorpusTreeProps subTreeViewLoaded :: R2.Component CorpusTreeProps
subTreeViewLoaded = R.createElement subTreeViewLoadedCpt subTreeViewLoaded = R.createElement subTreeViewLoadedCpt
subTreeViewLoadedCpt :: R.Component CorpusTreeProps subTreeViewLoadedCpt :: R.Component CorpusTreeProps
subTreeViewLoadedCpt = here.component "subTreeViewLoaded" cpt subTreeViewLoadedCpt = here.component "subTreeViewLoaded" cpt
where where
...@@ -107,7 +105,6 @@ newtype CorpusTreeRenderProps = CorpusTreeRenderProps ...@@ -107,7 +105,6 @@ newtype CorpusTreeRenderProps = CorpusTreeRenderProps
subTreeTreeView :: CorpusTreeRenderProps -> Array R.Element -> R.Element subTreeTreeView :: CorpusTreeRenderProps -> Array R.Element -> R.Element
subTreeTreeView = R2.ntCreateElement subTreeTreeViewCpt subTreeTreeView = R2.ntCreateElement subTreeTreeViewCpt
subTreeTreeViewCpt :: R2.NTComponent CorpusTreeRenderProps subTreeTreeViewCpt :: R2.NTComponent CorpusTreeRenderProps
subTreeTreeViewCpt = here.ntComponent "subTreeTreeView" cpt where subTreeTreeViewCpt = here.ntComponent "subTreeTreeView" cpt where
cpt (CorpusTreeRenderProps p@{ action cpt (CorpusTreeRenderProps p@{ action
......
...@@ -32,10 +32,9 @@ import Gargantext.Components.GraphExplorer.Types as GET ...@@ -32,10 +32,9 @@ import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Data.Louvain as Louvain import Gargantext.Data.Louvain as Louvain
import Gargantext.Ends (Frontends, Backend) import Gargantext.Ends (Frontends, Backend)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Types as SigmaxT import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Routes (SessionRoute(NodeAPI), AppRoute) import Gargantext.Routes (SessionRoute(NodeAPI), AppRoute)
import Gargantext.Sessions (OpenNodes, Session, Sessions, get) import Gargantext.Sessions (Session, Sessions, get)
import Gargantext.Types as Types import Gargantext.Types as Types
import Gargantext.Utils.Range as Range import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -76,7 +75,6 @@ type Props = ...@@ -76,7 +75,6 @@ type Props =
-------------------------------------------------------------- --------------------------------------------------------------
explorerLayout :: R2.Component LayoutProps explorerLayout :: R2.Component LayoutProps
explorerLayout = R.createElement explorerLayoutCpt explorerLayout = R.createElement explorerLayoutCpt
explorerLayoutCpt :: R.Component LayoutProps explorerLayoutCpt :: R.Component LayoutProps
explorerLayoutCpt = here.component "explorerLayout" cpt where explorerLayoutCpt = here.component "explorerLayout" cpt where
cpt props@{ backend, boxes: { graphVersion }, graphId, session } _ = do cpt props@{ backend, boxes: { graphVersion }, graphId, session } _ = do
...@@ -84,15 +82,13 @@ explorerLayoutCpt = here.component "explorerLayout" cpt where ...@@ -84,15 +82,13 @@ explorerLayoutCpt = here.component "explorerLayout" cpt where
useLoader graphId (getNodes session graphVersion') handler useLoader graphId (getNodes session graphVersion') handler
where where
handler loaded = explorerWriteGraph (Record.merge props { graph, hyperdataGraph: loaded, mMetaData' }) [] handler loaded@(GET.HyperdataGraph { graph: hyperdataGraph }) =
-- explorer (Record.merge props { graph, graphVersion, hyperdataGraph: loaded, mMetaData }) explorerWriteGraph (Record.merge props { graph, hyperdataGraph: loaded, mMetaData' }) []
where where
GET.HyperdataGraph { graph: hyperdataGraph } = loaded
Tuple mMetaData' graph = convert hyperdataGraph Tuple mMetaData' graph = convert hyperdataGraph
explorerWriteGraph :: R2.Component GraphWriteProps explorerWriteGraph :: R2.Component GraphWriteProps
explorerWriteGraph = R.createElement explorerWriteGraphCpt explorerWriteGraph = R.createElement explorerWriteGraphCpt
explorerWriteGraphCpt :: R.Component GraphWriteProps explorerWriteGraphCpt :: R.Component GraphWriteProps
explorerWriteGraphCpt = here.component "explorerWriteGraph" cpt where explorerWriteGraphCpt = here.component "explorerWriteGraph" cpt where
cpt props@{ boxes: { sidePanelGraph, sidePanelState } cpt props@{ boxes: { sidePanelGraph, sidePanelState }
...@@ -108,19 +104,11 @@ explorerWriteGraphCpt = here.component "explorerWriteGraph" cpt where ...@@ -108,19 +104,11 @@ explorerWriteGraphCpt = here.component "explorerWriteGraph" cpt where
, showControls: false , showControls: false
, sideTab: GET.SideTabLegend }) sidePanelGraph , sideTab: GET.SideTabLegend }) sidePanelGraph
-- { mGraph, mMetaData, sideTab } <- GEST.focusedSidePanel sidePanelGraph
-- R.useEffect' $ do
-- here.log2 "writing graph" graph
-- T.write_ (Just graph) mGraph
-- T.write_ mMetaData' mMetaData
pure $ explorer (RX.pick props :: Record Props) [] pure $ explorer (RX.pick props :: Record Props) []
-------------------------------------------------------------- --------------------------------------------------------------
explorer :: R2.Component Props explorer :: R2.Component Props
explorer = R.createElement explorerCpt explorer = R.createElement explorerCpt
explorerCpt :: R.Component Props explorerCpt :: R.Component Props
explorerCpt = here.component "explorer" cpt explorerCpt = here.component "explorer" cpt
where where
...@@ -163,32 +151,26 @@ explorerCpt = here.component "explorer" cpt ...@@ -163,32 +151,26 @@ explorerCpt = here.component "explorer" cpt
, sidePanelState , sidePanelState
} }
multiSelectEnabled' <- T.useLive T.unequal controls.multiSelectEnabled multiSelectEnabled' <- T.useLive T.unequal controls.multiSelectEnabled
showTree' <- T.useLive T.unequal controls.showTree
multiSelectEnabledRef <- R.useRef multiSelectEnabled' multiSelectEnabledRef <- R.useRef multiSelectEnabled'
forestOpen <- T.useBox $ (Set.empty :: OpenNodes) -- R.useEffect' $ do
R.useEffectOnce' $ do -- let readData = R.readRef dataRef
R2.loadLocalStorageState R2.openNodesKey forestOpen -- let gv = R.readRef graphVersionRef
T.listen (R2.listenLocalStorageState R2.openNodesKey) forestOpen -- if SigmaxT.eqGraph readData graph then
-- pure unit
R.useEffect' $ do -- else do
let readData = R.readRef dataRef -- -- Graph data changed, reinitialize sigma.
let gv = R.readRef graphVersionRef -- let rSigma = R.readRef controls.sigmaRef
if SigmaxT.eqGraph readData graph then -- Sigmax.cleanupSigma rSigma "explorerCpt"
pure unit -- R.setRef dataRef graph
else do -- R.setRef graphVersionRef graphVersion'
-- Graph data changed, reinitialize sigma. -- -- Reinitialize bunch of state as well.
let rSigma = R.readRef controls.sigmaRef -- T.write_ SigmaxT.emptyNodeIds controls.removedNodeIds
Sigmax.cleanupSigma rSigma "explorerCpt" -- T.write_ SigmaxT.emptyNodeIds controls.selectedNodeIds
R.setRef dataRef graph -- T.write_ SigmaxT.EShow controls.showEdges
R.setRef graphVersionRef graphVersion' -- T.write_ forceAtlasS controls.forceAtlasState
-- Reinitialize bunch of state as well. -- T.write_ Graph.Init controls.graphStage
T.write_ SigmaxT.emptyNodeIds controls.removedNodeIds -- T.write_ Types.InitialClosed controls.sidePanelState
T.write_ SigmaxT.emptyNodeIds controls.selectedNodeIds
T.write_ SigmaxT.EShow controls.showEdges
T.write_ forceAtlasS controls.forceAtlasState
T.write_ Graph.Init controls.graphStage
T.write_ Types.InitialClosed controls.sidePanelState
pure $ pure $
RH.div { className: "graph-meta-container" } RH.div { className: "graph-meta-container" }
...@@ -221,9 +203,8 @@ type TopBar = ...@@ -221,9 +203,8 @@ type TopBar =
boxes :: Boxes boxes :: Boxes
) )
topBar :: R2.Component TopBar topBar :: R2.Leaf TopBar
topBar = R.createElement topBarCpt topBar p = R.createElement topBarCpt p []
topBarCpt :: R.Component TopBar topBarCpt :: R.Component TopBar
topBarCpt = here.component "topBar" cpt where topBarCpt = here.component "topBar" cpt where
cpt { boxes: { showTree cpt { boxes: { showTree
...@@ -268,9 +249,7 @@ type GraphProps = ( ...@@ -268,9 +249,7 @@ type GraphProps = (
) )
graphView :: R2.Component GraphProps graphView :: R2.Component GraphProps
--graphView sigmaRef props = R.createElement (R.memo el memoCmp) props []
graphView = R.createElement graphViewCpt graphView = R.createElement graphViewCpt
graphViewCpt :: R.Component GraphProps graphViewCpt :: R.Component GraphProps
graphViewCpt = here.component "graphView" cpt graphViewCpt = here.component "graphView" cpt
where where
......
...@@ -67,7 +67,6 @@ initialLocalControls = do ...@@ -67,7 +67,6 @@ initialLocalControls = do
controls :: R2.Component Controls controls :: R2.Component Controls
controls = R.createElement controlsCpt controls = R.createElement controlsCpt
controlsCpt :: R.Component Controls controlsCpt :: R.Component Controls
controlsCpt = here.component "controls" cpt controlsCpt = here.component "controls" cpt
where where
......
...@@ -34,7 +34,7 @@ sizeButtonCpt :: R.Component Props ...@@ -34,7 +34,7 @@ sizeButtonCpt :: R.Component Props
sizeButtonCpt = here.component "sizeButton" cpt where sizeButtonCpt = here.component "sizeButton" cpt where
cpt { state, caption, min, max, onChange } _ = do cpt { state, caption, min, max, onChange } _ = do
defaultValue <- T.useLive T.unequal state defaultValue <- T.useLive T.unequal state
pure $ H.span { class: "range-simple" } pure $ H.span { className: "range-simple" }
[ H.label {} [ R2.small {} [ H.text caption ] ] [ H.label {} [ R2.small {} [ H.text caption ] ]
, H.input { type: "range" , H.input { type: "range"
, className: "form-control" , className: "form-control"
......
...@@ -191,7 +191,6 @@ type ContactCellsProps = ...@@ -191,7 +191,6 @@ type ContactCellsProps =
contactCells :: Record ContactCellsProps -> R.Element contactCells :: Record ContactCellsProps -> R.Element
contactCells p = R.createElement contactCellsCpt p [] contactCells p = R.createElement contactCellsCpt p []
contactCellsCpt :: R.Component ContactCellsProps contactCellsCpt :: R.Component ContactCellsProps
contactCellsCpt = here.component "contactCells" cpt where contactCellsCpt = here.component "contactCells" cpt where
cpt { annuaireId, frontends, session cpt { annuaireId, frontends, session
......
...@@ -63,18 +63,18 @@ routerCpt = here.component "router" cpt where ...@@ -63,18 +63,18 @@ routerCpt = here.component "router" cpt where
RightHanded -> "right-handed" RightHanded -> "right-handed"
pure $ R.fragment pure $ R.fragment
([ loginModal { boxes } [] ([ loginModal { boxes }
, topBar { boxes } [] ] <> , topBar { boxes } ] <>
[ H.div { className: handedClassName } $ reverseHanded handed' $ [ H.div { className: handedClassName } $ reverseHanded handed' $
[ forest { boxes } [] [ forest { boxes }
, mainPage { boxes } [] , mainPage { boxes }
, sidePanel { boxes } [] , sidePanel { boxes }
] ]
]) ])
loginModal :: R2.Component Props loginModal :: R2.Leaf Props
loginModal = R.createElement loginModalCpt loginModal p = R.createElement loginModalCpt p []
loginModalCpt :: R.Component Props loginModalCpt :: R.Component Props
loginModalCpt = here.component "loginModal" cpt loginModalCpt = here.component "loginModal" cpt
where where
...@@ -83,8 +83,8 @@ loginModalCpt = here.component "loginModal" cpt ...@@ -83,8 +83,8 @@ loginModalCpt = here.component "loginModal" cpt
pure $ if showLogin' then login' boxes else H.div {} [] pure $ if showLogin' then login' boxes else H.div {} []
topBar :: R2.Component Props topBar :: R2.Leaf Props
topBar = R.createElement topBarCpt topBar p = R.createElement topBarCpt p []
topBarCpt :: R.Component Props topBarCpt :: R.Component Props
topBarCpt = here.component "topBar" cpt where topBarCpt = here.component "topBar" cpt where
cpt props@{ boxes: boxes@{ handed cpt props@{ boxes: boxes@{ handed
...@@ -92,20 +92,20 @@ topBarCpt = here.component "topBar" cpt where ...@@ -92,20 +92,20 @@ topBarCpt = here.component "topBar" cpt where
route' <- T.useLive T.unequal boxes.route route' <- T.useLive T.unequal boxes.route
let children = case route' of let children = case route' of
GR.PGraphExplorer s g -> [ GraphExplorer.topBar { boxes } [] ] GR.PGraphExplorer s g -> [ GraphExplorer.topBar { boxes } ]
_ -> [] _ -> []
pure $ TopBar.topBar { handed } children pure $ TopBar.topBar { handed } children
mainPage :: R2.Component Props mainPage :: R2.Leaf Props
mainPage = R.createElement mainPageCpt mainPage p = R.createElement mainPageCpt p []
mainPageCpt :: R.Component Props mainPageCpt :: R.Component Props
mainPageCpt = here.component "mainPage" cpt where mainPageCpt = here.component "mainPage" cpt where
cpt { boxes } _ = do cpt { boxes } _ = do
pure $ MainPage.mainPage { boxes } [ renderRoute { boxes } [] ] pure $ MainPage.mainPage { boxes } [ renderRoute { boxes } ]
forest :: R2.Component Props forest :: R2.Leaf Props
forest = R.createElement forestCpt forest p = R.createElement forestCpt p []
forestCpt :: R.Component Props forestCpt :: R.Component Props
forestCpt = here.component "forest" cpt where forestCpt = here.component "forest" cpt where
cpt props@{ boxes: boxes@{ backend cpt props@{ boxes: boxes@{ backend
...@@ -132,8 +132,8 @@ forestCpt = here.component "forest" cpt where ...@@ -132,8 +132,8 @@ forestCpt = here.component "forest" cpt where
, showTree , showTree
, tasks } [] , tasks } []
sidePanel :: R2.Component Props sidePanel :: R2.Leaf Props
sidePanel = R.createElement sidePanelCpt sidePanel p = R.createElement sidePanelCpt p []
sidePanelCpt :: R.Component Props sidePanelCpt :: R.Component Props
sidePanelCpt = here.component "sidePanel" cpt where sidePanelCpt = here.component "sidePanel" cpt where
cpt props@{ boxes: boxes@{ graphVersion cpt props@{ boxes: boxes@{ graphVersion
...@@ -153,8 +153,8 @@ sidePanelCpt = here.component "sidePanel" cpt where ...@@ -153,8 +153,8 @@ sidePanelCpt = here.component "sidePanel" cpt where
Opened -> pure $ openedSidePanel (Record.merge { session: s } props) [] Opened -> pure $ openedSidePanel (Record.merge { session: s } props) []
_ -> pure $ H.div {} [] _ -> pure $ H.div {} []
renderRoute :: R2.Component Props renderRoute :: R2.Leaf Props
renderRoute = R.createElement renderRouteCpt renderRoute p = R.createElement renderRouteCpt p []
renderRouteCpt :: R.Component Props renderRouteCpt :: R.Component Props
renderRouteCpt = here.component "renderRoute" cpt where renderRouteCpt = here.component "renderRoute" cpt where
cpt props@{ boxes } _ = do cpt props@{ boxes } _ = do
...@@ -212,7 +212,6 @@ authedCpt = here.component "authed" cpt where ...@@ -212,7 +212,6 @@ authedCpt = here.component "authed" cpt where
openedSidePanel :: R2.Component (WithSession Props) openedSidePanel :: R2.Component (WithSession Props)
openedSidePanel = R.createElement openedSidePanelCpt openedSidePanel = R.createElement openedSidePanelCpt
openedSidePanelCpt :: R.Component (WithSession Props) openedSidePanelCpt :: R.Component (WithSession Props)
openedSidePanelCpt = here.component "openedSidePanel" cpt where openedSidePanelCpt = here.component "openedSidePanel" cpt where
cpt props@{ boxes: boxes@{ graphVersion cpt props@{ boxes: boxes@{ graphVersion
...@@ -262,7 +261,6 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where ...@@ -262,7 +261,6 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
annuaire :: R2.Component SessionNodeProps annuaire :: R2.Component SessionNodeProps
annuaire = R.createElement annuaireCpt annuaire = R.createElement annuaireCpt
annuaireCpt :: R.Component SessionNodeProps annuaireCpt :: R.Component SessionNodeProps
annuaireCpt = here.component "annuaire" cpt where annuaireCpt = here.component "annuaire" cpt where
cpt props@{ boxes, nodeId } _ = do cpt props@{ boxes, nodeId } _ = do
...@@ -274,7 +272,6 @@ annuaireCpt = here.component "annuaire" cpt where ...@@ -274,7 +272,6 @@ annuaireCpt = here.component "annuaire" cpt where
corpus :: R2.Component SessionNodeProps corpus :: R2.Component SessionNodeProps
corpus = R.createElement corpusCpt corpus = R.createElement corpusCpt
corpusCpt :: R.Component SessionNodeProps corpusCpt :: R.Component SessionNodeProps
corpusCpt = here.component "corpus" cpt where corpusCpt = here.component "corpus" cpt where
cpt props@{ boxes, nodeId } _ = do cpt props@{ boxes, nodeId } _ = do
...@@ -290,7 +287,6 @@ type CorpusDocumentProps = ...@@ -290,7 +287,6 @@ type CorpusDocumentProps =
corpusDocument :: R2.Component CorpusDocumentProps corpusDocument :: R2.Component CorpusDocumentProps
corpusDocument = R.createElement corpusDocumentCpt corpusDocument = R.createElement corpusDocumentCpt
corpusDocumentCpt :: R.Component CorpusDocumentProps corpusDocumentCpt :: R.Component CorpusDocumentProps
corpusDocumentCpt = here.component "corpusDocument" cpt corpusDocumentCpt = here.component "corpusDocument" cpt
where where
...@@ -304,7 +300,6 @@ corpusDocumentCpt = here.component "corpusDocument" cpt ...@@ -304,7 +300,6 @@ corpusDocumentCpt = here.component "corpusDocument" cpt
dashboard :: R2.Component SessionNodeProps dashboard :: R2.Component SessionNodeProps
dashboard = R.createElement dashboardCpt dashboard = R.createElement dashboardCpt
dashboardCpt :: R.Component SessionNodeProps dashboardCpt :: R.Component SessionNodeProps
dashboardCpt = here.component "dashboard" cpt dashboardCpt = here.component "dashboard" cpt
where where
...@@ -317,7 +312,6 @@ type DocumentProps = ( listId :: ListId | SessionNodeProps ) ...@@ -317,7 +312,6 @@ type DocumentProps = ( listId :: ListId | SessionNodeProps )
document :: R2.Component DocumentProps document :: R2.Component DocumentProps
document = R.createElement documentCpt document = R.createElement documentCpt
documentCpt :: R.Component DocumentProps documentCpt :: R.Component DocumentProps
documentCpt = here.component "document" cpt where documentCpt = here.component "document" cpt where
cpt props@{ boxes, listId, nodeId } _ = do cpt props@{ boxes, listId, nodeId } _ = do
...@@ -330,7 +324,6 @@ documentCpt = here.component "document" cpt where ...@@ -330,7 +324,6 @@ documentCpt = here.component "document" cpt where
graphExplorer :: R2.Component SessionNodeProps graphExplorer :: R2.Component SessionNodeProps
graphExplorer = R.createElement graphExplorerCpt graphExplorer = R.createElement graphExplorerCpt
graphExplorerCpt :: R.Component SessionNodeProps graphExplorerCpt :: R.Component SessionNodeProps
graphExplorerCpt = here.component "graphExplorer" cpt where graphExplorerCpt = here.component "graphExplorer" cpt where
cpt props@{ boxes: boxes@{ backend cpt props@{ boxes: boxes@{ backend
...@@ -344,7 +337,6 @@ graphExplorerCpt = here.component "graphExplorer" cpt where ...@@ -344,7 +337,6 @@ graphExplorerCpt = here.component "graphExplorer" cpt where
, nodeId } _ = do , nodeId } _ = do
let sessionProps = RE.pick props :: Record SessionProps let sessionProps = RE.pick props :: Record SessionProps
pure $ authed (Record.merge { content: \session -> pure $ authed (Record.merge { content: \session ->
-- simpleLayout { handed }
GraphExplorer.explorerLayout { backend GraphExplorer.explorerLayout { backend
, boxes , boxes
, frontends: defaultFrontends , frontends: defaultFrontends
...@@ -358,7 +350,6 @@ graphExplorerCpt = here.component "graphExplorer" cpt where ...@@ -358,7 +350,6 @@ graphExplorerCpt = here.component "graphExplorer" cpt where
home :: R2.Component Props home :: R2.Component Props
home = R.createElement homeCpt home = R.createElement homeCpt
homeCpt :: R.Component Props homeCpt :: R.Component Props
homeCpt = here.component "home" cpt where homeCpt = here.component "home" cpt where
cpt props@{ boxes: boxes@{ sessions, showLogin } } _ = do cpt props@{ boxes: boxes@{ sessions, showLogin } } _ = do
...@@ -366,7 +357,6 @@ homeCpt = here.component "home" cpt where ...@@ -366,7 +357,6 @@ homeCpt = here.component "home" cpt where
lists :: R2.Component SessionNodeProps lists :: R2.Component SessionNodeProps
lists = R.createElement listsCpt lists = R.createElement listsCpt
listsCpt :: R.Component SessionNodeProps listsCpt :: R.Component SessionNodeProps
listsCpt = here.component "lists" cpt where listsCpt = here.component "lists" cpt where
cpt props@{ boxes: { backend cpt props@{ boxes: { backend
...@@ -418,7 +408,6 @@ type RouteFrameProps = ( ...@@ -418,7 +408,6 @@ type RouteFrameProps = (
routeFrame :: R2.Component RouteFrameProps routeFrame :: R2.Component RouteFrameProps
routeFrame = R.createElement routeFrameCpt routeFrame = R.createElement routeFrameCpt
routeFrameCpt :: R.Component RouteFrameProps routeFrameCpt :: R.Component RouteFrameProps
routeFrameCpt = here.component "routeFrame" cpt where routeFrameCpt = here.component "routeFrame" cpt where
cpt props@{ boxes, nodeId, nodeType } _ = do cpt props@{ boxes, nodeId, nodeType } _ = do
...@@ -428,7 +417,6 @@ routeFrameCpt = here.component "routeFrame" cpt where ...@@ -428,7 +417,6 @@ routeFrameCpt = here.component "routeFrame" cpt where
team :: R2.Component SessionNodeProps team :: R2.Component SessionNodeProps
team = R.createElement teamCpt team = R.createElement teamCpt
teamCpt :: R.Component SessionNodeProps teamCpt :: R.Component SessionNodeProps
teamCpt = here.component "team" cpt where teamCpt = here.component "team" cpt where
cpt props@{ boxes, nodeId } _ = do cpt props@{ boxes, nodeId } _ = do
...@@ -438,7 +426,6 @@ teamCpt = here.component "team" cpt where ...@@ -438,7 +426,6 @@ teamCpt = here.component "team" cpt where
texts :: R2.Component SessionNodeProps texts :: R2.Component SessionNodeProps
texts = R.createElement textsCpt texts = R.createElement textsCpt
textsCpt :: R.Component SessionNodeProps textsCpt :: R.Component SessionNodeProps
textsCpt = here.component "texts" cpt textsCpt = here.component "texts" cpt
where where
...@@ -464,7 +451,6 @@ textsCpt = here.component "texts" cpt ...@@ -464,7 +451,6 @@ textsCpt = here.component "texts" cpt
user :: R2.Component SessionNodeProps user :: R2.Component SessionNodeProps
user = R.createElement userCpt user = R.createElement userCpt
userCpt :: R.Component SessionNodeProps userCpt :: R.Component SessionNodeProps
userCpt = here.component "user" cpt where userCpt = here.component "user" cpt where
cpt props@{ boxes: boxes@{ reloadForest cpt props@{ boxes: boxes@{ reloadForest
...@@ -488,7 +474,6 @@ type ContactProps = ( annuaireId :: NodeID | SessionNodeProps ) ...@@ -488,7 +474,6 @@ type ContactProps = ( annuaireId :: NodeID | SessionNodeProps )
contact :: R2.Component ContactProps contact :: R2.Component ContactProps
contact = R.createElement contactCpt contact = R.createElement contactCpt
contactCpt :: R.Component ContactProps contactCpt :: R.Component ContactProps
contactCpt = here.component "contact" cpt where contactCpt = here.component "contact" cpt where
cpt props@{ annuaireId cpt props@{ annuaireId
......
...@@ -83,27 +83,27 @@ instance showAppRoute :: Show AppRoute where ...@@ -83,27 +83,27 @@ instance showAppRoute :: Show AppRoute where
appPath :: AppRoute -> String appPath :: AppRoute -> String
appPath Home = "" appPath Home = ""
appPath Login = "login" appPath Login = "login"
appPath (Folder s i) = "folder/" <> show s <> "/" <> show i appPath (Folder s i) = "folder/" <> show s <> "/" <> show i
appPath (FolderPrivate s i) = "folderPrivate/" <> show s <> "/" <> show i appPath (FolderPrivate s i) = "folderPrivate/" <> show s <> "/" <> show i
appPath (FolderPublic s i) = "folderPublic/" <> show s <> "/" <> show i appPath (FolderPublic s i) = "folderPublic/" <> show s <> "/" <> show i
appPath (FolderShared s i) = "folderShared/" <> show s <> "/" <> show i appPath (FolderShared s i) = "folderShared/" <> show s <> "/" <> show i
appPath (Team s i) = "team/" <> show s <> "/" <> show i appPath (Team s i) = "team/" <> show s <> "/" <> show i
appPath (CorpusDocument s c l i) = "corpus/" <> show s <> "/" <> show c <> "/list/" <> show l <> "/document/" <> show i appPath (CorpusDocument s c l i) = "corpus/" <> show s <> "/" <> show c <> "/list/" <> show l <> "/document/" <> show i
appPath (Corpus s i) = "corpus/" <> show s <> "/" <> show i appPath (Corpus s i) = "corpus/" <> show s <> "/" <> show i
appPath (Document s l i) = "list/" <> show s <> "/" <> show l <> "/document/" <> show i appPath (Document s l i) = "list/" <> show s <> "/" <> show l <> "/document/" <> show i
appPath (Dashboard s i) = "dashboard/" <> show s <> "/" <> show i appPath (Dashboard s i) = "dashboard/" <> show s <> "/" <> show i
appPath (PGraphExplorer s i) = "graph/" <> show s <> "/" <> show i appPath (PGraphExplorer s i) = "graph/" <> show s <> "/" <> show i
appPath (Texts s i) = "texts/" <> show s <> "/" <> show i appPath (Texts s i) = "texts/" <> show s <> "/" <> show i
appPath (Lists s i) = "lists/" <> show s <> "/" <> show i appPath (Lists s i) = "lists/" <> show s <> "/" <> show i
appPath (Annuaire s i) = "annuaire/" <> show s <> "/" <> show i appPath (Annuaire s i) = "annuaire/" <> show s <> "/" <> show i
appPath (UserPage s i) = "user/" <> show s <> "/" <> show i appPath (UserPage s i) = "user/" <> show s <> "/" <> show i
appPath (ContactPage s a i) = "annuaire/" <> show s <> "/" <> show a <> "/contact/" <> show i appPath (ContactPage s a i) = "annuaire/" <> show s <> "/" <> show a <> "/contact/" <> show i
appPath (RouteFrameWrite s i) = "write/" <> show s <> "/" <> show i appPath (RouteFrameWrite s i) = "write/" <> show s <> "/" <> show i
appPath (RouteFrameCalc s i) = "calc/" <> show s <> "/" <> show i appPath (RouteFrameCalc s i) = "calc/" <> show s <> "/" <> show i
appPath (RouteFrameCode s i) = "code/" <> show s <> "/" <> show i appPath (RouteFrameCode s i) = "code/" <> show s <> "/" <> show i
appPath (RouteFile s i) = "file/" <> show s <> "/" <> show i appPath (RouteFile s i) = "file/" <> show s <> "/" <> show i
nodeTypeAppRoute :: NodeType -> SessionId -> Int -> Maybe AppRoute nodeTypeAppRoute :: NodeType -> SessionId -> Int -> Maybe AppRoute
nodeTypeAppRoute GT.Annuaire s i = Just $ Annuaire s i nodeTypeAppRoute GT.Annuaire s i = Just $ Annuaire s i
......
module Gargantext.Utils where module Gargantext.Utils where
import DOM.Simple.Window (window)
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Foldable (class Foldable, foldr) import Data.Foldable (class Foldable, foldr)
import Data.Lens (Lens', lens) import Data.Lens (Lens', lens)
...@@ -10,6 +9,7 @@ import Data.Set as Set ...@@ -10,6 +9,7 @@ import Data.Set as Set
import Data.Sequence.Ordered as OSeq import Data.Sequence.Ordered as OSeq
import Data.String as S import Data.String as S
import Data.Unfoldable (class Unfoldable) import Data.Unfoldable (class Unfoldable)
import DOM.Simple.Window (window)
import Effect (Effect) import Effect (Effect)
import FFI.Simple ((..)) import FFI.Simple ((..))
import FFI.Simple.Functions (delay) import FFI.Simple.Functions (delay)
...@@ -101,4 +101,4 @@ sortWith :: forall a b f. Functor f => ...@@ -101,4 +101,4 @@ sortWith :: forall a b f. Functor f =>
Unfoldable f => Unfoldable f =>
Ord b => Ord b =>
(a -> b) -> f a -> f a (a -> b) -> f a -> f a
sortWith f = map (\(On _ y) -> y) <<< OSeq.toUnfoldable <<< foldr (\x -> OSeq.insert (On (f x) x)) OSeq.empty sortWith f = map (\(On _ y) -> y) <<< OSeq.toUnfoldable <<< foldr (\x -> OSeq.insert (On (f x) x)) OSeq.empty
\ No newline at end of file
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