Commit 39228ff0 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/375-dev-docs-focus-rc1.x' into dev-merge

parents 4e1f90a1 0a8ac5fe
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -7,7 +7,6 @@ import Gargantext.Components.Bootstrap.Button(button) as Exports ...@@ -7,7 +7,6 @@ import Gargantext.Components.Bootstrap.Button(button) as Exports
import Gargantext.Components.Bootstrap.Caveat(caveat) as Exports import Gargantext.Components.Bootstrap.Caveat(caveat) as Exports
import Gargantext.Components.Bootstrap.Cloak (cloak) as Exports import Gargantext.Components.Bootstrap.Cloak (cloak) as Exports
import Gargantext.Components.Bootstrap.Fieldset(fieldset) as Exports import Gargantext.Components.Bootstrap.Fieldset(fieldset) as Exports
import Gargantext.Components.Bootstrap.Fluff(fluff, fluff', fluff_) as Exports
import Gargantext.Components.Bootstrap.FormInput(formInput) as Exports import Gargantext.Components.Bootstrap.FormInput(formInput) as Exports
import Gargantext.Components.Bootstrap.FormSelect(formSelect, formSelect') as Exports import Gargantext.Components.Bootstrap.FormSelect(formSelect, formSelect') as Exports
import Gargantext.Components.Bootstrap.FormTextarea(formTextarea) as Exports import Gargantext.Components.Bootstrap.FormTextarea(formTextarea) as Exports
...@@ -17,6 +16,7 @@ import Gargantext.Components.Bootstrap.ProgressBar(progressBar) as Exports ...@@ -17,6 +16,7 @@ import Gargantext.Components.Bootstrap.ProgressBar(progressBar) as Exports
import Gargantext.Components.Bootstrap.Spinner(spinner) as Exports import Gargantext.Components.Bootstrap.Spinner(spinner) as Exports
import Gargantext.Components.Bootstrap.Tabs(tabs) as Exports import Gargantext.Components.Bootstrap.Tabs(tabs) as Exports
import Gargantext.Components.Bootstrap.Tooltip(tooltip, TooltipBindingProps, tooltipBind, tooltipBind', tooltipContainer) as Exports import Gargantext.Components.Bootstrap.Tooltip(tooltip, TooltipBindingProps, tooltipBind, tooltipBind', tooltipContainer) as Exports
import Gargantext.Components.Bootstrap.Wad(wad, wad', wad_) as Exports
import Gargantext.Components.Bootstrap.Shortcut( import Gargantext.Components.Bootstrap.Shortcut(
div', div_ div', div_
......
module Gargantext.Components.Bootstrap.Fluff module Gargantext.Components.Bootstrap.Wad
( fluff ( wad
, fluff' , wad'
, fluff_ , wad_
) where ) where
import Gargantext.Prelude import Gargantext.Prelude
...@@ -11,25 +11,24 @@ import Reactix as R ...@@ -11,25 +11,24 @@ import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
componentName :: String componentName :: String
componentName = "b-fluff" componentName = "b-wad"
-- | Structural Component for a simple Element only serving the purpose to add -- | Structural Component for a simple Element only serving the purpose to add
-- | some classes in it -- | some classes in it
-- | -- |
-- | Hence the name: Fluff (uncountable noun): Consists of soft threads or -- | Hence the name: Wad (noun): a small mass, lump, or ball of anything ;
-- | fibres in the form of small, light balls or lump [or a set of utility -- | a roll of something
-- | classes...] wad :: Array String -> Array R.Element -> R.Element
fluff :: Array String -> Array R.Element -> R.Element wad classes children = R.createDOMElement "div" cls children
fluff classes children = R.createDOMElement "span" cls children
where where
cls = { className: intercalate " " $ cls = { className: intercalate " " $
[ componentName [ componentName
] <> classes ] <> classes
} }
-- | Shorthand for using <fluff> Component without writing its text node -- | Shorthand for using <wad> Component without writing its text node
fluff' :: Array String -> String -> R.Element wad' :: Array String -> String -> R.Element
fluff' classes text = R.createDOMElement "span" cls chd wad' classes text = R.createDOMElement "div" cls chd
where where
cls = { className: intercalate " " $ cls = { className: intercalate " " $
[ componentName [ componentName
...@@ -38,9 +37,9 @@ fluff' classes text = R.createDOMElement "span" cls chd ...@@ -38,9 +37,9 @@ fluff' classes text = R.createDOMElement "span" cls chd
chd = [ H.text text ] chd = [ H.text text ]
-- | Shorthand for using <fluff> Component without any child -- | Shorthand for using <wad> Component without any child
fluff_ :: Array String -> R.Element wad_ :: Array String -> R.Element
fluff_ classes = R.createDOMElement "span" cls [] wad_ classes = R.createDOMElement "div" cls []
where where
cls = { className: intercalate " " $ cls = { className: intercalate " " $
[ componentName [ componentName
......
...@@ -134,7 +134,7 @@ plusCpt = here.component "plus" cpt where ...@@ -134,7 +134,7 @@ plusCpt = here.component "plus" cpt where
B.icon B.icon
{ name: "universal-access" } { name: "universal-access" }
, ,
B.fluff_ [ "d-inline-block", "w-1" ] B.wad_ [ "d-inline-block", "w-1" ]
, ,
H.text $ "Log in/out" H.text $ "Log in/out"
] ]
......
...@@ -15,9 +15,9 @@ import Data.Sequence as Seq ...@@ -15,9 +15,9 @@ import Data.Sequence as Seq
import Data.Set as Set import Data.Set as Set
import Effect.Timer (setTimeout) import Effect.Timer (setTimeout)
import Gargantext.Components.Bootstrap as B import Gargantext.Components.Bootstrap as B
import Gargantext.Components.GraphExplorer.Resources as Graph
import Gargantext.Components.GraphExplorer.Buttons (centerButton, cameraButton, edgesToggleButton, louvainToggleButton, pauseForceAtlasButton, multiSelectEnabledButton) import Gargantext.Components.GraphExplorer.Buttons (centerButton, cameraButton, edgesToggleButton, louvainToggleButton, pauseForceAtlasButton, multiSelectEnabledButton)
import Gargantext.Components.GraphExplorer.RangeControl (edgeConfluenceControl, edgeWeightControl, nodeSizeControl) import Gargantext.Components.GraphExplorer.RangeControl (edgeConfluenceControl, edgeWeightControl, nodeSizeControl)
import Gargantext.Components.GraphExplorer.Resources as Graph
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.GraphExplorer.SlideButton (labelSizeButton, mouseSelectorSizeButton) import Gargantext.Components.GraphExplorer.SlideButton (labelSizeButton, mouseSelectorSizeButton)
import Gargantext.Components.GraphExplorer.Types as GET import Gargantext.Components.GraphExplorer.Types as GET
...@@ -52,7 +52,7 @@ type Controls = ...@@ -52,7 +52,7 @@ type Controls =
, showControls :: T.Box Boolean , showControls :: T.Box Boolean
, showEdges :: T.Box SigmaxT.ShowEdgesState , showEdges :: T.Box SigmaxT.ShowEdgesState
, showLouvain :: T.Box Boolean , showLouvain :: T.Box Boolean
, sidePanelState :: T.Box GT.SidePanelState , showSidebar :: T.Box GT.SidePanelState
, sideTab :: T.Box GET.SideTab , sideTab :: T.Box GET.SideTab
, sigmaRef :: R.Ref Sigmax.Sigma , sigmaRef :: R.Ref Sigmax.Sigma
) )
...@@ -84,7 +84,7 @@ controlsCpt = here.component "controls" cpt ...@@ -84,7 +84,7 @@ controlsCpt = here.component "controls" cpt
, session , session
, showEdges , showEdges
, showLouvain , showLouvain
, sidePanelState , showSidebar
, sideTab , sideTab
, sigmaRef } _ = do , sigmaRef } _ = do
...@@ -94,7 +94,7 @@ controlsCpt = here.component "controls" cpt ...@@ -94,7 +94,7 @@ controlsCpt = here.component "controls" cpt
forceAtlasState' <- T.useLive T.unequal forceAtlasState forceAtlasState' <- T.useLive T.unequal forceAtlasState
graphStage' <- T.useLive T.unequal graphStage graphStage' <- T.useLive T.unequal graphStage
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
sidePanelState' <- T.useLive T.unequal sidePanelState showSidebar' <- T.useLive T.unequal showSidebar
localControls <- initialLocalControls localControls <- initialLocalControls
-- ref to track automatic FA pausing -- ref to track automatic FA pausing
...@@ -123,8 +123,8 @@ controlsCpt = here.component "controls" cpt ...@@ -123,8 +123,8 @@ controlsCpt = here.component "controls" cpt
-- Automatic opening of sidebar when a node is selected (but only first time). -- Automatic opening of sidebar when a node is selected (but only first time).
R.useEffect' $ do R.useEffect' $ do
if sidePanelState' == GT.InitialClosed && (not Set.isEmpty selectedNodeIds') then do if showSidebar' == GT.InitialClosed && (not Set.isEmpty selectedNodeIds') then do
T.write_ GT.Opened sidePanelState T.write_ GT.Opened showSidebar
T.write_ GET.SideTabData sideTab T.write_ GET.SideTabData sideTab
else else
pure unit pure unit
...@@ -322,7 +322,7 @@ useGraphControls :: { forceAtlasS :: SigmaxT.ForceAtlasState ...@@ -322,7 +322,7 @@ useGraphControls :: { forceAtlasS :: SigmaxT.ForceAtlasState
, reloadForest :: T2.ReloadS , reloadForest :: T2.ReloadS
, session :: Session , session :: Session
, sidePanel :: T.Box (Maybe (Record GEST.SidePanel)) , sidePanel :: T.Box (Maybe (Record GEST.SidePanel))
, sidePanelState :: T.Box GT.SidePanelState } }
-> R.Hooks (Record Controls) -> R.Hooks (Record Controls)
useGraphControls { forceAtlasS useGraphControls { forceAtlasS
, graph , graph
...@@ -331,7 +331,7 @@ useGraphControls { forceAtlasS ...@@ -331,7 +331,7 @@ useGraphControls { forceAtlasS
, reloadForest , reloadForest
, session , session
, sidePanel , sidePanel
, sidePanelState } = do } = do
edgeConfluence <- T.useBox $ Range.Closed { min: 0.0, max: 1.0 } edgeConfluence <- T.useBox $ Range.Closed { min: 0.0, max: 1.0 }
edgeWeight <- T.useBox $ Range.Closed { edgeWeight <- T.useBox $ Range.Closed {
min: 0.0 min: 0.0
...@@ -345,7 +345,13 @@ useGraphControls { forceAtlasS ...@@ -345,7 +345,13 @@ useGraphControls { forceAtlasS
sigma <- Sigmax.initSigma sigma <- Sigmax.initSigma
sigmaRef <- R.useRef sigma sigmaRef <- R.useRef sigma
{ multiSelectEnabled, removedNodeIds, selectedNodeIds, showControls, sideTab } <- GEST.focusedSidePanel sidePanel { multiSelectEnabled
, removedNodeIds
, selectedNodeIds
, showControls
, sideTab
, showSidebar
} <- GEST.focusedSidePanel sidePanel
pure { edgeConfluence pure { edgeConfluence
, edgeWeight , edgeWeight
...@@ -362,7 +368,7 @@ useGraphControls { forceAtlasS ...@@ -362,7 +368,7 @@ useGraphControls { forceAtlasS
, showControls , showControls
, showEdges , showEdges
, showLouvain , showLouvain
, sidePanelState , showSidebar
, sideTab , sideTab
, sigmaRef , sigmaRef
, reloadForest , reloadForest
......
...@@ -12,7 +12,6 @@ import Data.Nullable (null, Nullable) ...@@ -12,7 +12,6 @@ import Data.Nullable (null, Nullable)
import Data.Sequence as Seq import Data.Sequence as Seq
import Data.Set as Set import Data.Set as Set
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Gargantext.Components.App.Data (Boxes) import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Bootstrap as B import Gargantext.Components.Bootstrap as B
import Gargantext.Components.GraphExplorer.Resources as Graph import Gargantext.Components.GraphExplorer.Resources as Graph
...@@ -25,7 +24,6 @@ import Gargantext.Config (defaultFrontends) ...@@ -25,7 +24,6 @@ import Gargantext.Config (defaultFrontends)
import Gargantext.Data.Louvain as Louvain import Gargantext.Data.Louvain as Louvain
import Gargantext.Hooks.Sigmax.Types as SigmaxT import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (SidePanelState(..))
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Types as Types import Gargantext.Types as Types
import Gargantext.Utils ((?)) import Gargantext.Utils ((?))
...@@ -62,6 +60,7 @@ layoutCpt = here.component "explorerWriteGraph" cpt where ...@@ -62,6 +60,7 @@ layoutCpt = here.component "explorerWriteGraph" cpt where
, session , session
, hyperdataGraph , hyperdataGraph
} _ = do } _ = do
-- Computed -- Computed
----------------- -----------------
...@@ -78,13 +77,12 @@ layoutCpt = here.component "explorerWriteGraph" cpt where ...@@ -78,13 +77,12 @@ layoutCpt = here.component "explorerWriteGraph" cpt where
-- States -- States
----------------- -----------------
sideBarDisplayed /\ sideBarDisplayedBox <-
R2.useBox' (InitialClosed :: SidePanelState)
{ mMetaData: mMetaDataBox { mMetaData: mMetaDataBox
, showSidebar
} <- GEST.focusedSidePanel boxes.sidePanelGraph } <- GEST.focusedSidePanel boxes.sidePanelGraph
_graphVersion' <- T.useLive T.unequal boxes.graphVersion _graphVersion' <- T.useLive T.unequal boxes.graphVersion
showSidebar' <- R2.useLive' showSidebar
-- _dataRef <- R.useRef graph -- _dataRef <- R.useRef graph
graphRef <- R.useRef null graphRef <- R.useRef null
...@@ -100,13 +98,13 @@ layoutCpt = here.component "explorerWriteGraph" cpt where ...@@ -100,13 +98,13 @@ layoutCpt = here.component "explorerWriteGraph" cpt where
, reloadForest: boxes.reloadForest , reloadForest: boxes.reloadForest
, session , session
, sidePanel: boxes.sidePanelGraph , sidePanel: boxes.sidePanelGraph
, sidePanelState: sideBarDisplayedBox
} }
mTopBarHost <- R.unsafeHooksEffect $ R2.getElementById "portal-topbar" mTopBarHost <- R.unsafeHooksEffect $ R2.getElementById "portal-topbar"
showControls' <- R2.useLive' controls.showControls showControls' <- R2.useLive' controls.showControls
-- graphVersionRef <- R.useRef graphVersion' -- graphVersionRef <- R.useRef graphVersion'
-- R.useEffect' $ do -- R.useEffect' $ do
-- let readData = R.readRef dataRef -- let readData = R.readRef dataRef
...@@ -141,9 +139,7 @@ layoutCpt = here.component "explorerWriteGraph" cpt where ...@@ -141,9 +139,7 @@ layoutCpt = here.component "explorerWriteGraph" cpt where
R2.fragmentWithKey topBarPortalKey R2.fragmentWithKey topBarPortalKey
[ [
GETB.topBar GETB.topBar
{ sidePanelState: sideBarDisplayedBox { sidePanelGraph: props.boxes.sidePanelGraph }
, sidePanelGraph: props.boxes.sidePanelGraph
}
] ]
] ]
, ,
...@@ -152,7 +148,7 @@ layoutCpt = here.component "explorerWriteGraph" cpt where ...@@ -152,7 +148,7 @@ layoutCpt = here.component "explorerWriteGraph" cpt where
{ className: "graph-layout__sidebar" { className: "graph-layout__sidebar"
-- @XXX: ReactJS lack of "keep-alive" feature workaround solution -- @XXX: ReactJS lack of "keep-alive" feature workaround solution
-- @link https://github.com/facebook/react/issues/12039 -- @link https://github.com/facebook/react/issues/12039
, style: { display: sideBarDisplayed == GT.Opened ? "block" $ "none" } , style: { display: showSidebar' == GT.Opened ? "block" $ "none" }
} }
[ [
case mMetaData' of case mMetaData' of
......
...@@ -414,8 +414,8 @@ neighborhoodCpt = R.memo' $ here.component "neighborhood" cpt where ...@@ -414,8 +414,8 @@ neighborhoodCpt = R.memo' $ here.component "neighborhood" cpt where
H.div H.div
{ className: "graph-neighborhood__counter" } { className: "graph-neighborhood__counter" }
[ [
B.fluff' B.wad'
[ "text-info" ] $ [ "text-info", "d-inline" ] $
show termCount show termCount
, ,
H.text $ nbsp 1 <> "terms" H.text $ nbsp 1 <> "terms"
......
module Gargantext.Components.GraphExplorer.Sidebar.Types where module Gargantext.Components.GraphExplorer.Sidebar.Types where
import Data.Maybe (Maybe(..), maybe)
import Data.Set as Set
import Reactix as R
import Toestand as T
import Gargantext.Prelude import Gargantext.Prelude
import Data.Maybe (Maybe(..), maybe)
import Data.Set as Set
import Gargantext.Components.GraphExplorer.Types as GET import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Sigmax.Types as SigmaxT import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Types as GT
import Reactix as R
import Toestand as T
type SidePanel = type SidePanel =
( (
...@@ -19,6 +19,7 @@ type SidePanel = ...@@ -19,6 +19,7 @@ type SidePanel =
, selectedNodeIds :: SigmaxT.NodeIds , selectedNodeIds :: SigmaxT.NodeIds
, showControls :: Boolean , showControls :: Boolean
, sideTab :: GET.SideTab , sideTab :: GET.SideTab
, showSidebar :: GT.SidePanelState
) )
initialSidePanel :: Maybe (Record SidePanel) initialSidePanel :: Maybe (Record SidePanel)
...@@ -32,7 +33,9 @@ focusedSidePanel :: T.Box (Maybe (Record SidePanel)) ...@@ -32,7 +33,9 @@ focusedSidePanel :: T.Box (Maybe (Record SidePanel))
, removedNodeIds :: T.Box SigmaxT.NodeIds , removedNodeIds :: T.Box SigmaxT.NodeIds
, selectedNodeIds :: T.Box SigmaxT.NodeIds , selectedNodeIds :: T.Box SigmaxT.NodeIds
, showControls :: T.Box Boolean , showControls :: T.Box Boolean
, sideTab :: T.Box GET.SideTab } , sideTab :: T.Box GET.SideTab
, showSidebar :: T.Box GT.SidePanelState
}
focusedSidePanel sidePanel = do focusedSidePanel sidePanel = do
mGraph <- T.useFocused mGraph <- T.useFocused
(maybe Nothing _.mGraph) (maybe Nothing _.mGraph)
...@@ -55,6 +58,9 @@ focusedSidePanel sidePanel = do ...@@ -55,6 +58,9 @@ focusedSidePanel sidePanel = do
sideTab <- T.useFocused sideTab <- T.useFocused
(maybe GET.SideTabLegend _.sideTab) (maybe GET.SideTabLegend _.sideTab)
(\val -> maybe Nothing (\sp -> Just $ sp { sideTab = val })) sidePanel (\val -> maybe Nothing (\sp -> Just $ sp { sideTab = val })) sidePanel
showSidebar <- T.useFocused
(maybe GT.InitialClosed _.showSidebar)
(\val -> maybe Nothing (\sp -> Just $ sp { showSidebar = val })) sidePanel
pure $ { pure $ {
mGraph mGraph
...@@ -64,4 +70,5 @@ focusedSidePanel sidePanel = do ...@@ -64,4 +70,5 @@ focusedSidePanel sidePanel = do
, selectedNodeIds , selectedNodeIds
, showControls , showControls
, sideTab , sideTab
, showSidebar
} }
...@@ -88,7 +88,7 @@ graphLayoutCpt = here.component "explorerLayout" cpt where ...@@ -88,7 +88,7 @@ graphLayoutCpt = here.component "explorerLayout" cpt where
case mEl of case mEl of
Nothing -> R.nothing Nothing -> R.nothing
Just el -> R2.addClass el [ "p-0--i" ] Just el -> R2.addClass el [ "p-0" ]
R.useEffectOnce do R.useEffectOnce do
pure do pure do
...@@ -96,7 +96,7 @@ graphLayoutCpt = here.component "explorerLayout" cpt where ...@@ -96,7 +96,7 @@ graphLayoutCpt = here.component "explorerLayout" cpt where
case mEl of case mEl of
Nothing -> R.nothing Nothing -> R.nothing
Just el -> R2.removeClass el [ "p-0--i" ] Just el -> R2.removeClass el [ "p-0" ]
-- | Render -- | Render
-- | -- |
...@@ -158,6 +158,7 @@ contentCpt = here.component "content" cpt where ...@@ -158,6 +158,7 @@ contentCpt = here.component "content" cpt where
, selectedNodeIds: Set.empty , selectedNodeIds: Set.empty
, showControls: false , showControls: false
, sideTab: GET.SideTabLegend , sideTab: GET.SideTabLegend
, showSidebar: Types.InitialClosed
} }
-- Render -- Render
......
This diff is collapsed.
This diff is collapsed.
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