Commit 22f768b1 authored by arturo's avatar arturo

>>> BEGIN 375

parent 55b2a8c9
...@@ -10362,6 +10362,9 @@ h4, h5, h6 { ...@@ -10362,6 +10362,9 @@ h4, h5, h6 {
.graph-topbar { .graph-topbar {
padding: 0 8px; padding: 0 8px;
height: 100%; height: 100%;
display: flex;
padding-left: 4px;
padding-right: 4px;
} }
.right-handed .graph-topbar { .right-handed .graph-topbar {
border-left: 1px solid rgba(255, 255, 255, 0.05); border-left: 1px solid rgba(255, 255, 255, 0.05);
...@@ -10371,6 +10374,20 @@ h4, h5, h6 { ...@@ -10371,6 +10374,20 @@ h4, h5, h6 {
border-right: 1px solid rgba(255, 255, 255, 0.05); border-right: 1px solid rgba(255, 255, 255, 0.05);
} }
.graph-topbar__toolbar, .graph-topbar__sidebar {
width: 136px;
margin-left: 4px;
margin-right: 4px;
}
.graph-topbar__search {
width: 304px;
margin-left: 4px;
margin-right: 4px;
}
.graph-topbar__search [type=submit] {
display: none;
}
#logo-designed { #logo-designed {
border: 15px; border: 15px;
} }
...@@ -11355,8 +11372,6 @@ select.form-control { ...@@ -11355,8 +11372,6 @@ select.form-control {
} }
/* Grid constants */ /* Grid constants */
/* Topbar constants */
/* Sidebar constant */
/* Colors */ /* Colors */
.phylo { .phylo {
/* ---------- axis ---------- */ /* ---------- axis ---------- */
......
...@@ -4,10 +4,11 @@ module Gargantext.Components.GraphExplorer.Search ...@@ -4,10 +4,11 @@ module Gargantext.Components.GraphExplorer.Search
import Prelude import Prelude
import DOM.Simple.Console (log2) import DOM.Simple.Console (log2)
import Data.Foldable (foldl) import Data.Foldable (foldl, intercalate)
import Data.Sequence as Seq import Data.Sequence as Seq
import Data.Set as Set import Data.Set as Set
import Effect (Effect) import Effect (Effect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.InputWithAutocomplete (inputWithAutocomplete) import Gargantext.Components.InputWithAutocomplete (inputWithAutocomplete)
import Gargantext.Hooks.Sigmax.Types as SigmaxT import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Utils (queryMatchesLabel) import Gargantext.Utils (queryMatchesLabel)
...@@ -23,6 +24,7 @@ type Props = ( ...@@ -23,6 +24,7 @@ type Props = (
graph :: SigmaxT.SGraph graph :: SigmaxT.SGraph
, multiSelectEnabled :: T.Box Boolean , multiSelectEnabled :: T.Box Boolean
, selectedNodeIds :: T.Box SigmaxT.NodeIds , selectedNodeIds :: T.Box SigmaxT.NodeIds
, className :: String
) )
-- | Whether a node matches a search string -- | Whether a node matches a search string
...@@ -37,28 +39,43 @@ searchNodes :: String -> Seq.Seq (Record SigmaxT.Node) -> Seq.Seq (Record Sigmax ...@@ -37,28 +39,43 @@ searchNodes :: String -> Seq.Seq (Record SigmaxT.Node) -> Seq.Seq (Record Sigmax
searchNodes "" _ = Seq.empty searchNodes "" _ = Seq.empty
searchNodes s nodes = Seq.filter (nodeMatchesSearch s) nodes searchNodes s nodes = Seq.filter (nodeMatchesSearch s) nodes
nodeSearchControl :: R2.Component Props nodeSearchControl :: R2.Leaf Props
nodeSearchControl = R.createElement nodeSearchControlCpt nodeSearchControl = R2.leaf nodeSearchControlCpt
nodeSearchControlCpt :: R.Component Props nodeSearchControlCpt :: R.Component Props
nodeSearchControlCpt = here.component "nodeSearchControl" cpt nodeSearchControlCpt = here.component "nodeSearchControl" cpt
where where
cpt { graph, multiSelectEnabled, selectedNodeIds } _ = do cpt props@{ graph, multiSelectEnabled, selectedNodeIds } _ = do
search <- T.useBox "" search <- T.useBox ""
search' <- T.useLive T.unequal search search' <- T.useLive T.unequal search
multiSelectEnabled' <- T.useLive T.unequal multiSelectEnabled multiSelectEnabled' <- T.useLive T.unequal multiSelectEnabled
let doSearch s = triggerSearch graph s multiSelectEnabled' selectedNodeIds let doSearch s = triggerSearch graph s multiSelectEnabled' selectedNodeIds
pure $ R.fragment pure $
[ inputWithAutocomplete { autocompleteSearch: autocompleteSearch graph
, classes: "mx-2" H.form
, onAutocompleteClick: doSearch { className: intercalate " "
, onEnterPress: doSearch [ "graph-node-search"
, state: search } [] , props.className
, H.div { className: "btn input-group-addon" ]
, on: { click: \_ -> doSearch search' } }
} [
[ H.span { className: "fa fa-search" } [] ] inputWithAutocomplete
{ autocompleteSearch: autocompleteSearch graph
, onAutocompleteClick: doSearch
, onEnterPress: doSearch
, classes: ""
, state: search
}
,
B.button
{ callback: \_ -> doSearch search'
, type: "submit"
, className: "graph-node-search__submit"
}
[
B.icon { name: "search"}
]
] ]
autocompleteSearch :: SigmaxT.SGraph -> String -> Array String autocompleteSearch :: SigmaxT.SGraph -> String -> Array String
......
...@@ -6,7 +6,6 @@ module Gargantext.Components.GraphExplorer.ToggleButton ...@@ -6,7 +6,6 @@ module Gargantext.Components.GraphExplorer.ToggleButton
, edgesToggleButton , edgesToggleButton
, louvainToggleButton , louvainToggleButton
, multiSelectEnabledButton , multiSelectEnabledButton
, sidebarToggleButton
, pauseForceAtlasButton , pauseForceAtlasButton
, resetForceAtlasButton , resetForceAtlasButton
, treeToggleButton , treeToggleButton
...@@ -203,35 +202,3 @@ treeToggleButtonCpt = here.component "treeToggleButton" cpt ...@@ -203,35 +202,3 @@ treeToggleButtonCpt = here.component "treeToggleButton" cpt
, onClick: \_ -> T.modify_ not state , onClick: \_ -> T.modify_ not state
, style: "light" , style: "light"
} [] } []
type SidebarToggleButtonProps = (
state :: T.Box GT.SidePanelState
)
sidebarToggleButton :: R2.Component SidebarToggleButtonProps
sidebarToggleButton = R.createElement sidebarToggleButtonCpt
sidebarToggleButtonCpt :: R.Component SidebarToggleButtonProps
sidebarToggleButtonCpt = here.component "sidebarToggleButton" cpt
where
cpt { state } _ = do
state' <- T.useLive T.unequal state
pure $ H.div { className: "btn btn-outline-light " <> cls state'
, on: { click: onClick state }
} [ R2.small {} [ H.text (text onMessage offMessage state') ] ]
cls GT.Opened = "active"
cls _ = ""
onMessage = "Hide Sidebar"
offMessage = "Show Sidebar"
text on _off GT.Opened = on
text _on off GT.InitialClosed = off
text _on off GT.Closed = off
onClick state = \_ ->
T.modify_ GT.toggleSidePanelState state
-- case s of
-- GET.InitialClosed -> GET.Opened GET.SideTabLegend
-- GET.Closed -> GET.Opened GET.SideTabLegend
-- (GET.Opened _) -> GET.Closed) state
module Gargantext.Components.GraphExplorer.TopBar where module Gargantext.Components.GraphExplorer.TopBar (topBar) where
import Data.Maybe (Maybe(..)) import Gargantext.Prelude hiding (max, min)
import Reactix as R
import Reactix.DOM.HTML as RH
import Toestand as T
import Gargantext.Prelude hiding (max,min)
import Gargantext.Components.App.Data (Boxes) import Data.Maybe (Maybe(..))
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), Variant(..))
import Gargantext.Components.GraphExplorer.Search (nodeSearchControl) import Gargantext.Components.GraphExplorer.Search (nodeSearchControl)
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.GraphExplorer.ToggleButton as Toggle import Gargantext.Types (SidePanelState)
import Gargantext.Types as GT
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
type Props =
( sidePanelGraph :: T.Box (Maybe (Record GEST.SidePanel))
, sidePanelState :: T.Box (SidePanelState)
)
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.TopBar" here = R2.here "Gargantext.Components.GraphExplorer.TopBar"
type TopBar = topBar :: R2.Leaf Props
( topBar = R2.leaf component
boxes :: Boxes
) component :: R.Component Props
component = here.component "topBar" cpt where
cpt { sidePanelGraph, sidePanelState } _ = do
-- States
{ mGraph
, multiSelectEnabled
, selectedNodeIds
, showControls
} <- GEST.focusedSidePanel sidePanelGraph
mGraph' <- R2.useLive' mGraph
showControls' <- R2.useLive' showControls
sidePanelState' <- R2.useLive' sidePanelState
-- Render
pure $
H.div
{ className: "graph-topbar" }
[
-- Toolbar toggle
B.button
{ className: "graph-topbar__toolbar"
, callback: \_ -> T.modify_ (not) showControls
, variant: showControls' ?
ButtonVariant Light $
OutlinedButtonVariant Light
}
[
H.text $ showControls' ? "Hide toolbar" $ "Show toolbar"
]
,
-- Sidebar toggle
B.button
{ className: "graph-topbar__sidebar"
, callback: \_ -> T.modify_ GT.toggleSidePanelState sidePanelState
topBar :: R2.Leaf TopBar , variant: sidePanelState' == GT.Opened ?
topBar = R2.leafComponent topBarCpt ButtonVariant Light $
topBarCpt :: R.Component TopBar OutlinedButtonVariant Light
topBarCpt = here.component "topBar" cpt where }
cpt { boxes: { sidePanelGraph [
, sidePanelState } } _ = do H.text $ sidePanelState' == GT.Opened ?
{ mGraph, multiSelectEnabled, selectedNodeIds, showControls } <- GEST.focusedSidePanel sidePanelGraph "Hide sidebar" $
"Show sidebar"
mGraph' <- T.useLive T.unequal mGraph ]
,
let search = case mGraph' of -- Search
Just graph -> nodeSearchControl { graph -- @WIP: R2.fromMaybe_
, multiSelectEnabled case mGraph' of
, selectedNodeIds } [] Nothing -> mempty
Nothing -> RH.div {} [] Just graph ->
nodeSearchControl
pure $ RH.form { className: "graph-topbar d-flex" } { graph
[ Toggle.controlsToggleButton { state: showControls } [] , multiSelectEnabled
, Toggle.sidebarToggleButton { state: sidePanelState } [] , selectedNodeIds
, search , className: "graph-topbar__search"
}
] ]
...@@ -29,8 +29,8 @@ type Props = ...@@ -29,8 +29,8 @@ type Props =
, state :: T.Box String , state :: T.Box String
) )
inputWithAutocomplete :: R2.Component Props inputWithAutocomplete :: R2.Leaf Props
inputWithAutocomplete = R.createElement inputWithAutocompleteCpt inputWithAutocomplete = R2.leaf inputWithAutocompleteCpt
inputWithAutocompleteCpt :: R.Component Props inputWithAutocompleteCpt :: R.Component Props
inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
where where
......
...@@ -14,7 +14,7 @@ import Gargantext.Components.App.Data (Boxes) ...@@ -14,7 +14,7 @@ import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.ErrorsView (errorsView) import Gargantext.Components.ErrorsView (errorsView)
import Gargantext.Components.Footer (footer) import Gargantext.Components.Footer (footer)
import Gargantext.Components.Forest as Forest import Gargantext.Components.Forest as Forest
import Gargantext.Components.GraphExplorer as GraphExplorer import Gargantext.Components.GraphExplorer.Layout as GraphExplorer
import Gargantext.Components.GraphExplorer.Sidebar as GES import Gargantext.Components.GraphExplorer.Sidebar as GES
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.Lang (LandingLang(LL_EN)) import Gargantext.Components.Lang (LandingLang(LL_EN))
...@@ -434,12 +434,13 @@ graphExplorerCpt = here.component "graphExplorer" cpt where ...@@ -434,12 +434,13 @@ graphExplorerCpt = here.component "graphExplorer" cpt where
authedProps = authedProps =
Record.merge Record.merge
{ content: { content:
\session -> GraphExplorer.explorerLayoutWithKey \session -> GraphExplorer.layout
{ boxes { boxes
, graphId: nodeId , graphId: nodeId
, key: "graphId-" <> show nodeId , key: "graphId-" <> show nodeId
, session } , session
[] }
} }
sessionProps sessionProps
......
...@@ -86,5 +86,25 @@ ...@@ -86,5 +86,25 @@
width: 300px width: 300px
top: 50px top: 50px
/////////////////////////////////////////////
.graph-topbar .graph-topbar
@include aside-topbar @include aside-topbar
display: flex
padding-left: $topbar-item-margin
padding-right: $topbar-item-margin
&__toolbar,
&__sidebar
width: $topbar-fixed-button-width
margin-left: $topbar-item-margin
margin-right: $topbar-item-margin
&__search
width: $topbar-input-width
margin-left: $topbar-item-margin
margin-right: $topbar-item-margin
[type="submit"]
display: none
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
/* Grid constants */ /* Grid constants */
$topbar-height: 56px; // ~ unworthy empirical value (@TODO topbar height calculation)
$graph-margin: 16px; $graph-margin: 16px;
$layout-height: calc(100vh - #{ $topbar-height} ); $layout-height: calc(100vh - #{ $topbar-height} );
...@@ -38,16 +37,6 @@ $left-column-width: 10%; ...@@ -38,16 +37,6 @@ $left-column-width: 10%;
$center-column-width: 85%; $center-column-width: 85%;
$right-column-width: 5%; $right-column-width: 5%;
/* Topbar constants */
$topbar-input-width: 304px;
/* Sidebar constant */
$sidebar-width: 480px;
$sidebar-height: calc(100vh - #{ $topbar-height });
$tab-margin-x: space-x(2.5);
/* Colors */ /* Colors */
$graph-background-color: $body-bg; $graph-background-color: $body-bg;
...@@ -448,34 +437,33 @@ $decreasing-color: #11638F; ...@@ -448,34 +437,33 @@ $decreasing-color: #11638F;
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
.phylo-topbar { .phylo-topbar {
$margin: space-x(0.5);
$fixed-button-width: 136px; $fixed-button-width: 136px;
@include aside-topbar(); @include aside-topbar();
padding-left: $margin; padding-left: $topbar-item-margin;
padding-right: $margin; padding-right: $topbar-item-margin;
display: flex; display: flex;
&__toolbar, &__toolbar,
&__sidebar { &__sidebar {
width: $fixed-button-width; width: $topbar-fixed-button-width;
margin-left: $margin; margin-left: $topbar-item-margin;
margin-right: $margin; margin-right: $topbar-item-margin;
} }
&__source { &__source {
width: $topbar-input-width; width: $topbar-input-width;
margin-left: $margin; margin-left: $topbar-item-margin;
margin-right: $margin; margin-right: $topbar-item-margin;
} }
&__autocomplete { &__autocomplete {
display: flex; display: flex;
width: $topbar-input-width; width: $topbar-input-width;
position: relative; position: relative;
margin-left: $margin; margin-left: $topbar-item-margin;
margin-right: $margin; margin-right: $topbar-item-margin;
} }
&__suggestion { &__suggestion {
...@@ -559,7 +547,7 @@ $decreasing-color: #11638F; ...@@ -559,7 +547,7 @@ $decreasing-color: #11638F;
} }
.phylo-details-tab { .phylo-details-tab {
$margin-x: $tab-margin-x; $margin-x: $sidebar-tab-margin-x;
$margin-y: space-x(2); $margin-y: space-x(2);
&__counter { &__counter {
...@@ -585,7 +573,7 @@ $decreasing-color: #11638F; ...@@ -585,7 +573,7 @@ $decreasing-color: #11638F;
} }
.phylo-selection-tab { .phylo-selection-tab {
$margin-x: $tab-margin-x; $margin-x: $sidebar-tab-margin-x;
$margin-y: space-x(2); $margin-y: space-x(2);
&__highlight { &__highlight {
......
/// Topbar
$topbar-height: 56px; // ~ unworthy empirical value (@TODO topbar height calculation)
$topbar-input-width: 304px;
$topbar-item-margin: space-x(0.5);
$topbar-fixed-button-width: 136px;
/// Sidebar
$sidebar-width: 480px;
$sidebar-height: calc(100vh - #{ $topbar-height });
$sidebar-tab-margin-x: space-x(2.5);
.with-icon-font { .with-icon-font {
font-family: ForkAwesome, $font-family-base; font-family: ForkAwesome, $font-family-base;
} }
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