Commit f61f59f8 authored by Karen Konou's avatar Karen Konou

[Table] split table header into normal and reneamble

parent 81ccb3fa
...@@ -8,7 +8,6 @@ import Gargantext.Components.App.Data (Boxes) ...@@ -8,7 +8,6 @@ import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.NgramsTable.Loader (clearCache) import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.Node (NodePoly(..)) import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild) import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus.Types (getCorpusInfo, CorpusInfo(..), Hyperdata(..))
import Gargantext.Components.Nodes.Lists.Tabs as Tabs import Gargantext.Components.Nodes.Lists.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Types (CacheState(..)) import Gargantext.Components.Nodes.Lists.Types (CacheState(..))
import Gargantext.Components.Table as Table import Gargantext.Components.Table as Table
...@@ -73,18 +72,17 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where ...@@ -73,18 +72,17 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
, path , path
, loader: loadCorpusWithChild , loader: loadCorpusWithChild
, render: \corpusData@{ corpusId, corpusNode: NodePoly poly } -> , render: \corpusData@{ corpusId, corpusNode: NodePoly poly } ->
let { date, hyperdata : Hyperdata h, name } = poly let { date, hyperdata } = poly
CorpusInfo { authors, desc, query } = getCorpusInfo h.fields
in in
R.fragment [ R.fragment [
Table.tableHeaderLayout { Table.tableHeaderWithRenameLayout {
cacheState cacheState
, date , date
, desc , hyperdata
, nodeId: corpusId
, session
, key: "listsLayoutWithKey-header-" <> (show cacheState') , key: "listsLayoutWithKey-header-" <> (show cacheState')
, query } []
, title: "Corpus " <> name
, user: authors } []
, Tabs.tabs { , Tabs.tabs {
activeTab activeTab
, boxes , boxes
......
...@@ -17,7 +17,7 @@ import Gargantext.Components.Node (NodePoly(..)) ...@@ -17,7 +17,7 @@ import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild) import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo) import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Gargantext.Components.Nodes.Corpus.Document as D import Gargantext.Components.Nodes.Corpus.Document as D
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, CorpusInfo(..), Hyperdata(..), getCorpusInfo) import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
import Gargantext.Components.Nodes.Lists.Types as LT import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Components.Nodes.Texts.Types as TT import Gargantext.Components.Nodes.Texts.Types as TT
import Gargantext.Components.Reload (textsReloadContext) import Gargantext.Components.Reload (textsReloadContext)
...@@ -105,17 +105,15 @@ textsLayoutWithKeyCpt = here.component "textsLayoutWithKey" cpt ...@@ -105,17 +105,15 @@ textsLayoutWithKeyCpt = here.component "textsLayoutWithKey" cpt
, loader: loadCorpusWithChild , loader: loadCorpusWithChild
, path: { nodeId, session } , path: { nodeId, session }
, render: \corpusData@{ corpusId, corpusNode } -> do , render: \corpusData@{ corpusId, corpusNode } -> do
let NodePoly { date, hyperdata: Hyperdata h, name } = corpusNode let NodePoly { date, hyperdata } = corpusNode
CorpusInfo { authors, desc, query } = getCorpusInfo h.fields
title = "Corpus " <> name
R.fragment R.fragment
[ Table.tableHeaderLayout { cacheState [ Table.tableHeaderWithRenameLayout {
cacheState
, date , date
, desc , hyperdata
, query , nodeId: corpusId
, title , session
, user: authors
, key: "textsLayoutWithKey-" <> (show cacheState') } [] , key: "textsLayoutWithKey-" <> (show cacheState') } []
, tabs { boxes , tabs { boxes
, cacheState , cacheState
......
...@@ -7,10 +7,13 @@ import Data.Maybe (Maybe(..)) ...@@ -7,10 +7,13 @@ import Data.Maybe (Maybe(..))
import Data.Sequence as Seq import Data.Sequence as Seq
import Effect (Effect) import Effect (Effect)
import Gargantext.Components.FolderView as FV import Gargantext.Components.FolderView as FV
import Gargantext.Components.Nodes.Corpus.Types (CorpusInfo(..), Hyperdata(..), getCorpusInfo)
import Gargantext.Components.Nodes.Lists.Types as NT import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Renameable (renameable) import Gargantext.Components.Renameable (renameable)
import Gargantext.Components.Search (SearchType(..)) import Gargantext.Components.Search (SearchType(..))
import Gargantext.Components.Table.Types (ColumnName, OrderBy, OrderByDirection(..), Params, Props, TableContainerProps, columnName) import Gargantext.Components.Table.Types (ColumnName, OrderBy, OrderByDirection(..), Params, Props, TableContainerProps, columnName)
import Gargantext.Sessions.Types (Session)
import Gargantext.Types (NodeID)
import Gargantext.Utils.Reactix (effectLink) import Gargantext.Utils.Reactix (effectLink)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R import Reactix as R
...@@ -51,12 +54,79 @@ type TableHeaderLayoutProps = ( ...@@ -51,12 +54,79 @@ type TableHeaderLayoutProps = (
, user :: String , user :: String
) )
type TableHeaderWithRenameLayoutProps = (
cacheState :: T.Box NT.CacheState
, session :: Session
, hyperdata :: Hyperdata
, nodeId :: NodeID
, date :: String
, key :: String
)
initialParams :: Params initialParams :: Params
initialParams = stateParams {page: 1, pageSize: PS10, orderBy: Nothing, searchType: SearchDoc} initialParams = stateParams {page: 1, pageSize: PS10, orderBy: Nothing, searchType: SearchDoc}
-- TODO: Not sure this is the right place for this -- TODO: Not sure this is the right place for this
onRenameDummy :: String -> Effect Unit tableHeaderWithRenameLayout :: R2.Component TableHeaderWithRenameLayoutProps
onRenameDummy _ = do tableHeaderWithRenameLayout = R.createElement tableHeaderWithRenameLayoutCpt
tableHeaderWithRenameLayoutCpt :: R.Component TableHeaderWithRenameLayoutProps
tableHeaderWithRenameLayoutCpt = here.component "tableHeaderWithRenameLayoutCpt" cpt
where
cpt { hyperdata: Hyperdata h, nodeId, session, cacheState, date } _ = do
cacheState' <- T.useLive T.unequal cacheState
let CorpusInfo { authors, desc, query, title} = getCorpusInfo h.fields
pure $ R.fragment
[ R2.row [FV.backButton {} []]
,
R2.row
[ H.div {className: "col-md-3"} [ H.h3 {} [renameable {text: title, onRename: onRenameDummy} []] ]
, H.div {className: "col-md-9"}
[ H.hr {style: {height: "2px", backgroundColor: "black"}} ]
]
, R2.row
[ H.div {className: "col-md-8 content"}
[ H.p {}
[ H.span {className: "fa fa-globe"} []
, renameable {text: " " <> desc, onRename: onRenameDummy} []
]
, H.p {}
[ H.span {className: "fa fa-search-plus"} []
, renameable {text: " " <> query, onRename: onRenameDummy} []
]
, H.p { className: "cache-toggle"
, on: { click: cacheClick cacheState } }
[ H.span { className: "fa " <> (cacheToggle cacheState') } []
, H.text $ cacheText cacheState'
]
]
, H.div {className: "col-md-4 content"}
[ H.p {}
[ H.span {className: "fa fa-calendar"} []
, renameable {text: " " <> date, onRename: onRenameDummy} []
]
, H.p {}
[ H.span {className: "fa fa-user"} []
, renameable {text: " " <> authors, onRename: onRenameDummy} []
]
]
]
]
cacheToggle NT.CacheOn = "fa-toggle-on"
cacheToggle NT.CacheOff = "fa-toggle-off"
cacheText NT.CacheOn = "Cache On"
cacheText NT.CacheOff = "Cache Off"
cacheClick cacheState _ = do
T.modify cacheStateToggle cacheState
cacheStateToggle NT.CacheOn = NT.CacheOff
cacheStateToggle NT.CacheOff = NT.CacheOn
onRenameDummy _ = do
pure unit pure unit
tableHeaderLayout :: R2.Component TableHeaderLayoutProps tableHeaderLayout :: R2.Component TableHeaderLayoutProps
...@@ -71,7 +141,7 @@ tableHeaderLayoutCpt = here.component "tableHeaderLayout" cpt ...@@ -71,7 +141,7 @@ tableHeaderLayoutCpt = here.component "tableHeaderLayout" cpt
[ R2.row [FV.backButton {} []] [ R2.row [FV.backButton {} []]
, ,
R2.row R2.row
[ H.div {className: "col-md-3"} [ H.h3 {} [renameable {text: title, onRename: onRenameDummy} []] ] [ H.div {className: "col-md-3"} [ H.h3 {} [H.text title] ]
, H.div {className: "col-md-9"} , H.div {className: "col-md-9"}
[ H.hr {style: {height: "2px", backgroundColor: "black"}} ] [ H.hr {style: {height: "2px", backgroundColor: "black"}} ]
] ]
...@@ -79,11 +149,11 @@ tableHeaderLayoutCpt = here.component "tableHeaderLayout" cpt ...@@ -79,11 +149,11 @@ tableHeaderLayoutCpt = here.component "tableHeaderLayout" cpt
[ H.div {className: "col-md-8 content"} [ H.div {className: "col-md-8 content"}
[ H.p {} [ H.p {}
[ H.span {className: "fa fa-globe"} [] [ H.span {className: "fa fa-globe"} []
, renameable {text: " " <> desc, onRename: onRenameDummy} [] , H.text $ " " <> desc
] ]
, H.p {} , H.p {}
[ H.span {className: "fa fa-search-plus"} [] [ H.span {className: "fa fa-search-plus"} []
, renameable {text: " " <> query, onRename: onRenameDummy} [] , H.text $ " " <> query
] ]
, H.p { className: "cache-toggle" , H.p { className: "cache-toggle"
, on: { click: cacheClick cacheState } } , on: { click: cacheClick cacheState } }
...@@ -94,11 +164,11 @@ tableHeaderLayoutCpt = here.component "tableHeaderLayout" cpt ...@@ -94,11 +164,11 @@ tableHeaderLayoutCpt = here.component "tableHeaderLayout" cpt
, H.div {className: "col-md-4 content"} , H.div {className: "col-md-4 content"}
[ H.p {} [ H.p {}
[ H.span {className: "fa fa-calendar"} [] [ H.span {className: "fa fa-calendar"} []
, renameable {text: " " <> date, onRename: onRenameDummy} [] , H.text $ " " <> date
] ]
, H.p {} , H.p {}
[ H.span {className: "fa fa-user"} [] [ H.span {className: "fa fa-user"} []
, renameable {text: " " <> user, onRename: onRenameDummy} [] , H.text $ " " <> user
] ]
] ]
] ]
......
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