Commit cea93004 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[Merge]

parents e275bde5 83b79870
......@@ -169,14 +169,16 @@ topBarCpt = R.hooksComponent "G.C.A.topBar" cpt
, className: "navbar navbar-inverse navbar-fixed-top" }
[ H.div { className: "container-fluid" }
[ H.div { className: "navbar-inner" }
[ logo
, H.div { className: "collapse navbar-collapse" }
[ H.ul { className: "nav navbar-nav" } [divDropdownLeft]
[ logo (fst handed)
, H.div { className: "collapse navbar-collapse" <> navHanded}
$ sortHanded
[ H.ul { className: "nav navbar-nav" <> navHanded} [divDropdownLeft]
, H.ul { title: "If you are Left Handed you can change "
<> "the interface by clicking on me.\n"
<> "Click to come back to previous state."
, className: "nav navbar-nav"
<> "the interface by clicking on me. Click "
<> "again to come back to previous state."
, className: "nav navbar-nav" <> navHanded
} [handedChooser { handed }]
, H.ul { className: "nav navbar-nav" <> navHanded} []
{-, H.ul { title: "Dark Mode soon here"
, className : "nav navbar-nav"
} [ H.li {} [ H.a {} [ H.span {className : "fa fa-moon"}[]
......@@ -188,6 +190,9 @@ topBarCpt = R.hooksComponent "G.C.A.topBar" cpt
]
]
]
where
navHanded = if fst handed == GT.LeftHanded then " navbar-right" else ""
sortHanded = if fst handed == GT.LeftHanded then reverse else reverse -- identity
-- SB.searchBar {session, databases: allDatabases}
type HandedChooserProps = (
......@@ -215,15 +220,16 @@ handedChooserCpt = R.hooksComponent "G.C.A.handedChooser" cpt
GT.LeftHanded -> GT.RightHanded
GT.RightHanded -> GT.LeftHanded
logo :: R.Element
logo =
logo :: GT.Handed -> R.Element
logo handed =
H.a { className, href: "#/" }
[ H.img { src, title, width: "30", height: "28" }
]
where
className = "navbar-brand logoSmall"
className = "navbar-brand logoSmall" <> navHanded
src = "images/logoSmall.png"
title = "Back to home."
navHanded = if handed == GT.LeftHanded then " navbar-right" else ""
divDropdownLeft :: R.Element
divDropdownLeft =
......
......@@ -48,7 +48,6 @@ forestCpt = R.hooksComponent "G.C.Forest.forest" cpt where
)
(cpt' openNodes asyncTasks reload showLogin)
cpt' openNodes asyncTasks reload showLogin (frontends /\ route /\ sessions /\ _ /\ _ /\ _ /\ _ /\ handed) = do
--pure $ R.fragment $ A.cons (plus showLogin) trees
pure $ R2.row $ [plus handed showLogin] <> trees
where
trees = tree <$> unSessions sessions
......
......@@ -132,7 +132,7 @@ settingsBox FolderShared =
SettingsBox { show : true
, edit : true
, doc : Documentation FolderShared
, buttons : [ Add [Team, Folder]
, buttons : [ Add [Team, FolderShared]
-- , Delete
]
}
......
......@@ -116,8 +116,7 @@ pieCpt = R.hooksComponent "G.C.N.C.C.P.pie" cpt
loadedPie :: Record MetricsProps -> HistoMetrics -> R.Element
loadedPie { path, reload, session } loaded =
H.div {} [
U.reloadButton reload
H.div {} [ U.reloadButton reload
, U.chartUpdateButton { chartType: ChartPie, path, reload, session }
, chart $ chartOptionsPie loaded
]
......@@ -132,8 +131,8 @@ barCpt = R.hooksComponent "LoadedMetricsBar" cpt
cpt {path, session} _ = do
reload <- R.useState' 0
--pure $ metricsLoadView {getMetrics, loaded: loadedBar, path, reload, session}
pure $ metricsWithCacheLoadView {
getMetricsHash
pure $ metricsWithCacheLoadView
{ getMetricsHash
, handleResponse
, loaded: loadedPie
, mkRequest: mkRequest session
......
......@@ -19,8 +19,10 @@ import Gargantext.Types (NodeID, Mode(..), TabSubType(..), TabType(..), modeTabT
data PredefinedChart =
CDocsHistogram
| CAuthorsPie
| CSourcesBar
| CInstitutesTree
| CTermsMetrics
derive instance genericPredefinedChart :: Generic PredefinedChart _
instance showPredefinedChart :: Show PredefinedChart where
......@@ -42,30 +44,30 @@ instance encodePredefinedChart :: EncodeJson PredefinedChart where
instance readPredefinedChart :: Read PredefinedChart where
read "CDocsHistogram" = Just CDocsHistogram
read "CAuthorsPie" = Just CAuthorsPie
read "CSourcesBar" = Just CSourcesBar
read "CInstitutesTree" = Just CInstitutesTree
read "CTermsMetrics" = Just CTermsMetrics
read _ = Nothing
allPredefinedCharts :: Array PredefinedChart
allPredefinedCharts = [
CDocsHistogram
allPredefinedCharts =
[ CDocsHistogram
, CAuthorsPie
, CTermsMetrics
, CInstitutesTree
, CSourcesBar
]
type Params =
(
corpusId :: NodeID
( corpusId :: NodeID
, session :: Session
-- optinal params
, limit :: Maybe Int
, listId :: Maybe Int
)
render :: PredefinedChart -> Record Params -> R.Element
render CDocsHistogram { corpusId, listId, session } = histo { path, session }
where
......@@ -93,5 +95,16 @@ render CTermsMetrics { corpusId, limit, listId, session } = metrics { path, sess
path = { corpusId
, limit
, listId: fromMaybe 0 listId
, tabType: TabCorpus (TabNgramType $ modeTabType Authors)
, tabType: TabCorpus (TabNgramType $ modeTabType Terms)
}
render CSourcesBar { corpusId, limit, listId, session } = metrics { path, session }
where
path = { corpusId
, limit
, listId: fromMaybe 0 listId
, tabType: TabCorpus (TabNgramType $ modeTabType Sources)
}
......@@ -18,10 +18,10 @@ import Gargantext.Sessions (Session)
import Gargantext.Types (ChartType(..), CTabNgramType(..), Mode(..), TabSubType(..), TabType(..), chartTypeFromString, modeTabType)
import Gargantext.Utils.Reactix as R2
type Props =
( session :: Session
type Props = ( session :: Session
, corpusId :: Int
, corpusData :: CorpusData )
, corpusData :: CorpusData
)
tabs :: Record Props -> R.Element
tabs props = R.createElement tabsCpt props []
......@@ -54,7 +54,7 @@ ngramsViewCpt = R.hooksComponent "G.C.N.L.T.ngramsView" cpt
chartType <- R.useState' Histo
pure $ R.fragment
$ charts tabNgramType chartType
( charts tabNgramType chartType
<> [ NT.mainNgramsTable { session
, defaultListId
, nodeId: corpusId
......@@ -63,16 +63,20 @@ ngramsViewCpt = R.hooksComponent "G.C.N.L.T.ngramsView" cpt
, withAutoUpdate: false
}
]
)
where
tabNgramType = modeTabType mode
tabType = TabCorpus (TabNgramType tabNgramType)
listId = defaultListId
path = {corpusId, listId, tabType, limit: (Just 1000)}
path = { corpusId
, listId
, tabType
, limit: Just 1000
}
charts CTabTerms (chartType /\ setChartType) = [
H.div { className: "row chart-type-selector" } [
H.div { className: "col-md-3" } [
R2.select { className: "form-control"
, on: { change: \e -> setChartType
$ const
......@@ -84,6 +88,7 @@ ngramsViewCpt = R.hooksComponent "G.C.N.L.T.ngramsView" cpt
H.option { value: show Histo } [ H.text $ show Histo ]
, H.option { value: show Scatter } [ H.text $ show Scatter ]
, H.option { value: show ChartBar } [ H.text $ show ChartBar ]
, H.option { value: show ChartPie } [ H.text $ show ChartPie ]
, H.option { value: show ChartTree } [ H.text $ show ChartTree ]
]
]
......
......@@ -119,7 +119,7 @@ sessionPath (R.Tab t i) = sessionPath (R.NodeAPI Node i (showTabType
sessionPath (R.Children n o l s i) = sessionPath (R.NodeAPI Node i ("children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s))
sessionPath (R.NodeAPI Phylo pId p) = "phyloscape?nodeId=" <> (show $ fromMaybe 0 pId) <> p
sessionPath (R.RecomputeNgrams nt nId lId) = "node/" <> (show nId) <> "/ngrams/recompute?" <> (defaultList lId) <> "&ngramsType=" <> (show nt)
sessionPath (R.RecomputeListChart ChartBar nt nId lId) = "node/" <> (show nId) <> "/pie?" <> (defaultList lId) <> "&ngramsType=" <> (show nt)
sessionPath (R.RecomputeListChart ChartBar nt nId lId) = "node/" <> (show nId) <> "/chart?" <> (defaultList lId) <> "&ngramsType=" <> (show nt)
sessionPath (R.RecomputeListChart ChartPie nt nId lId) = "node/" <> (show nId) <> "/pie?" <> (defaultList lId) <> "&ngramsType=" <> (show nt)
sessionPath (R.RecomputeListChart ChartTree nt nId lId) = "node/" <> (show nId) <> "/tree?" <> (defaultList lId) <> "&ngramsType=" <> (show nt) <> "&listType=" <> show MapTerm
sessionPath (R.RecomputeListChart Histo nt nId lId) = "node/" <> (show nId) <> "/chart?" <> (defaultList lId) <> "&ngramsType=" <> (show nt)
......
......@@ -16,8 +16,6 @@ import Prelude
import Prim.Row (class Union)
import URI.Query (Query)
data Handed = LeftHanded | RightHanded
derive instance genericHanded :: Generic Handed _
......
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