Annuaire uses the Table component

parent 390aa390
...@@ -8,10 +8,9 @@ import Effect (Effect) ...@@ -8,10 +8,9 @@ import Effect (Effect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import React as React import React as React
import React (ReactElement, ReactClass, Children, createElement) import React (ReactElement, ReactClass, Children, createElement)
import React.DOM (a, b, b', div, option, select, span, table, tbody, td, text, th, thead, tr) import React.DOM (a, b, b', p, i, h3, hr, div, option, select, span, table, tbody, td, text, th, thead, tr)
import React.DOM.Props (className, href, onChange, onClick, scope, selected, value) import React.DOM.Props (className, href, onChange, onClick, scope, selected, value, style)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec, import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec, createReactSpec, StateCoTransformer)
createReactSpec, StateCoTransformer)
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
import Gargantext.Prelude import Gargantext.Prelude
...@@ -60,6 +59,39 @@ changePageSize ps td = ...@@ -60,6 +59,39 @@ changePageSize ps td =
, currentPage = 1 , currentPage = 1
} }
-- TODO: Not sure this is the right place for this function.
renderTableHeaderLayout :: { title :: String
, desc :: String
, query :: String
, date :: String
, user :: String
} -> Array ReactElement
renderTableHeaderLayout {title, desc, query, date, user} =
[ div [className "row"]
[ div [className "col-md-3"] [ h3 [] [text title] ]
, div [className "col-md-9"] [ hr [style {height : "2px",backgroundColor : "black"}] ]
]
, div [className "row"] [ div [className "jumbotron1", style {padding : "12px 0px 20px 12px"}]
[ div [ className "col-md-8 content"]
[ p [] [ i [className "fa fa-globe"] []
, text $ " " <> desc
]
, p [] [ i [className "fab fa-searchengin"] []
, text $ " " <> query
]
]
, div [ className "col-md-4 content"]
[ p [] [ i [className "fa fa-calendar"] []
, text $ " " <> date
]
, p [] [ i [className "fa fa-user"] []
, text $ " " <> user
]
]
]
]
]
tableSpec :: Spec State Props Action tableSpec :: Spec State Props Action
tableSpec = simpleSpec performAction render tableSpec = simpleSpec performAction render
where where
......
This diff is collapsed.
...@@ -7,8 +7,6 @@ import Data.Maybe (maybe) ...@@ -7,8 +7,6 @@ import Data.Maybe (maybe)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import React as React import React as React
import React (ReactClass, ReactElement) import React (ReactClass, ReactElement)
import React.DOM (div, h3, hr, i, p, text)
import React.DOM.Props (className, style)
import Thermite ( Render, Spec, createClass, defaultPerformAction, focus import Thermite ( Render, Spec, createClass, defaultPerformAction, focus
, simpleSpec, noState ) , simpleSpec, noState )
-------------------------------------------------------- --------------------------------------------------------
...@@ -16,6 +14,7 @@ import Gargantext.Prelude ...@@ -16,6 +14,7 @@ import Gargantext.Prelude
import Gargantext.Components.Node (NodePoly(..)) import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Loader as Loader import Gargantext.Components.Loader as Loader
import Gargantext.Components.Loader (createLoaderClass) import Gargantext.Components.Loader (createLoaderClass)
import Gargantext.Components.Table as Table
import Gargantext.Config (toUrl, NodeType(..), End(..)) import Gargantext.Config (toUrl, NodeType(..), End(..))
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import Gargantext.Pages.Corpus.Tabs.Types (CorpusInfo(..), corpusInfoDefault) import Gargantext.Pages.Corpus.Tabs.Types (CorpusInfo(..), corpusInfoDefault)
...@@ -66,36 +65,19 @@ corpusHeaderSpec = simpleSpec defaultPerformAction render ...@@ -66,36 +65,19 @@ corpusHeaderSpec = simpleSpec defaultPerformAction render
where where
render :: Render {} Props Void render :: Render {} Props Void
render dispatch {loaded} _ _ = render dispatch {loaded} _ _ =
[ div [className "row"] Table.renderTableHeaderLayout
[ div [className "col-md-3"] [ h3 [] [text "Corpus " <> text title] ] { title: "Corpus " <> title
, div [className "col-md-9"] [ hr [style {height : "2px",backgroundColor : "black"}] ] , desc: corpus.desc
] , query: corpus.query
, div [className "row"] [ div [className "jumbotron1", style {padding : "12px 0px 20px 12px"}] , date: date'
[ div [ className "col-md-8 content"] , user: corpus.authors
[ p [] [ i [className "fa fa-globe"] [] }
, text $ " " <> corpus.desc where
] NodePoly { name: title
, p [] [ i [className "fab fa-searchengin"] [] , date: date'
, text $ " " <> corpus.query , hyperdata : CorpusInfo corpus
] }
] = maybe corpusInfoDefault identity loaded
, div [ className "col-md-4 content"]
[ p [] [ i [className "fa fa-calendar"] []
, text $ " " <> date'
]
, p [] [ i [className "fa fa-user"] []
, text $ " " <> corpus.authors
]
]
]
]
]
where
NodePoly { name: title
, date: date'
, hyperdata : CorpusInfo corpus
}
= maybe corpusInfoDefault identity loaded
------------------------------------------------------------------------ ------------------------------------------------------------------------
......
...@@ -19,7 +19,7 @@ import Gargantext.Utils.DecodeMaybe ((.|)) ...@@ -19,7 +19,7 @@ import Gargantext.Utils.DecodeMaybe ((.|))
import Gargantext.Components.Charts.Options.ECharts (chart) import Gargantext.Components.Charts.Options.ECharts (chart)
import Gargantext.Components.Table as T import Gargantext.Components.Table as T
import Gargantext.Components.Node (NodePoly(..)) import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Pages.Corpus.Tabs.Types import Gargantext.Pages.Corpus.Tabs.Types (CorpusInfo(..), Props)
import Gargantext.Pages.Corpus.Dashboard (globalPublis) import Gargantext.Pages.Corpus.Dashboard (globalPublis)
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- TODO: Pagination Details are not available from the BackEnd -- TODO: Pagination Details are not available from the BackEnd
...@@ -103,7 +103,7 @@ instance decodeResponse :: DecodeJson Response where ...@@ -103,7 +103,7 @@ instance decodeResponse :: DecodeJson Response where
-- | Filter -- | Filter
filterSpec :: Spec State {} Action filterSpec :: Spec {} {} Void
filterSpec = simpleSpec defaultPerformAction render filterSpec = simpleSpec defaultPerformAction render
where where
render d p s c = [div [] [ text " Filter " render d p s c = [div [] [ text " Filter "
...@@ -111,10 +111,10 @@ filterSpec = simpleSpec defaultPerformAction render ...@@ -111,10 +111,10 @@ filterSpec = simpleSpec defaultPerformAction render
]] ]]
-- | Main layout of the Documents Tab of a Corpus -- | Main layout of the Documents Tab of a Corpus
layoutDocview :: Spec State Props Action layoutDocview :: Spec {} Props Void
layoutDocview = simpleSpec absurd render layoutDocview = simpleSpec absurd render
where where
render :: Render State Props Action render :: Render {} Props Void
render dispatch {path, loaded} _ _ = render dispatch {path, loaded} _ _ =
[ div [className "container1"] [ div [className "container1"]
[ div [className "row"] [ div [className "row"]
...@@ -202,9 +202,6 @@ sampleData = map (\(Tuple t s) -> DocumentsView {_id : 1, url : "", date : "2017 ...@@ -202,9 +202,6 @@ sampleData = map (\(Tuple t s) -> DocumentsView {_id : 1, url : "", date : "2017
sampleDocuments :: Array (Tuple String String) sampleDocuments :: Array (Tuple String String)
sampleDocuments = [Tuple "Macroscopic dynamics of the fusion process" "Journal de Physique Lettres",Tuple "Effects of static and cyclic fatigue at high temperature upon reaction bonded silicon nitride" "Journal de Physique Colloques",Tuple "Reliability of metal/glass-ceramic junctions made by solid state bonding" "Journal de Physique Colloques",Tuple "High temperature mechanical properties and intergranular structure of sialons" "Journal de Physique Colloques",Tuple "SOLUTIONS OF THE LANDAU-VLASOV EQUATION IN NUCLEAR PHYSICS" "Journal de Physique Colloques",Tuple "A STUDY ON THE FUSION REACTION 139La + 12C AT 50 MeV/u WITH THE VUU EQUATION" "Journal de Physique Colloques",Tuple "Atomic structure of \"vitreous\" interfacial films in sialon" "Journal de Physique Colloques",Tuple "MICROSTRUCTURAL AND ANALYTICAL CHARACTERIZATION OF Al2O3/Al-Mg COMPOSITE INTERFACES" "Journal de Physique Colloques",Tuple "Development of oxidation resistant high temperature NbTiAl alloys and intermetallics" "Journal de Physique IV Colloque",Tuple "Determination of brazed joint constitutive law by inverse method" "Journal de Physique IV Colloque",Tuple "Two dimensional estimates from ocean SAR images" "Nonlinear Processes in Geophysics",Tuple "Comparison Between New Carbon Nanostructures Produced by Plasma with Industrial Carbon Black Grades" "Journal de Physique III",Tuple "<i>Letter to the Editor:</i> SCIPION, a new flexible ionospheric sounder in Senegal" "Annales Geophysicae",Tuple "Is reducibility in nuclear multifragmentation related to thermal scaling?" "Physics Letters B",Tuple "Independence of fragment charge distributions of the size of heavy multifragmenting sources" "Physics Letters B",Tuple "Hard photons and neutral pions as probes of hot and dense nuclear matter" "Nuclear Physics A",Tuple "Surveying the nuclear caloric curve" "Physics Letters B",Tuple "A hot expanding source in 50 A MeV Xe+Sn central reactions" "Physics Letters B"] sampleDocuments = [Tuple "Macroscopic dynamics of the fusion process" "Journal de Physique Lettres",Tuple "Effects of static and cyclic fatigue at high temperature upon reaction bonded silicon nitride" "Journal de Physique Colloques",Tuple "Reliability of metal/glass-ceramic junctions made by solid state bonding" "Journal de Physique Colloques",Tuple "High temperature mechanical properties and intergranular structure of sialons" "Journal de Physique Colloques",Tuple "SOLUTIONS OF THE LANDAU-VLASOV EQUATION IN NUCLEAR PHYSICS" "Journal de Physique Colloques",Tuple "A STUDY ON THE FUSION REACTION 139La + 12C AT 50 MeV/u WITH THE VUU EQUATION" "Journal de Physique Colloques",Tuple "Atomic structure of \"vitreous\" interfacial films in sialon" "Journal de Physique Colloques",Tuple "MICROSTRUCTURAL AND ANALYTICAL CHARACTERIZATION OF Al2O3/Al-Mg COMPOSITE INTERFACES" "Journal de Physique Colloques",Tuple "Development of oxidation resistant high temperature NbTiAl alloys and intermetallics" "Journal de Physique IV Colloque",Tuple "Determination of brazed joint constitutive law by inverse method" "Journal de Physique IV Colloque",Tuple "Two dimensional estimates from ocean SAR images" "Nonlinear Processes in Geophysics",Tuple "Comparison Between New Carbon Nanostructures Produced by Plasma with Industrial Carbon Black Grades" "Journal de Physique III",Tuple "<i>Letter to the Editor:</i> SCIPION, a new flexible ionospheric sounder in Senegal" "Annales Geophysicae",Tuple "Is reducibility in nuclear multifragmentation related to thermal scaling?" "Physics Letters B",Tuple "Independence of fragment charge distributions of the size of heavy multifragmenting sources" "Physics Letters B",Tuple "Hard photons and neutral pions as probes of hot and dense nuclear matter" "Nuclear Physics A",Tuple "Surveying the nuclear caloric curve" "Physics Letters B",Tuple "A hot expanding source in 50 A MeV Xe+Sn central reactions" "Physics Letters B"]
initialState :: State
initialState = {}
newtype SearchQuery = SearchQuery newtype SearchQuery = SearchQuery
{ {
query :: Array String query :: Array String
......
...@@ -18,7 +18,7 @@ type State = ...@@ -18,7 +18,7 @@ type State =
initialState :: State initialState :: State
initialState = initialState =
{ docsView : D.initialState { docsView : {}
, authorsView : A.initialState , authorsView : A.initialState
, sourcesView : S.initialState , sourcesView : S.initialState
, termsView : T.initialState , termsView : T.initialState
......
...@@ -11,7 +11,6 @@ import Gargantext.Pages.Corpus.Graph as GE ...@@ -11,7 +11,6 @@ import Gargantext.Pages.Corpus.Graph as GE
-- import Gargantext.Pages.Corpus.Tabs.Terms.NgramsTable as NG -- import Gargantext.Pages.Corpus.Tabs.Terms.NgramsTable as NG
import Gargantext.Pages.Annuaire.User.Contacts as C import Gargantext.Pages.Annuaire.User.Contacts as C
import Gargantext.Pages.Annuaire as Annuaire
-- import Gargantext.Pages.Home as L -- import Gargantext.Pages.Home as L
-- import Gargantext.Pages.Layout.Specs.Search as S -- import Gargantext.Pages.Layout.Specs.Search as S
import Gargantext.Router (Routes(..)) import Gargantext.Router (Routes(..))
...@@ -47,8 +46,7 @@ dispatchAction dispatcher _ (UserPage id) = do ...@@ -47,8 +46,7 @@ dispatchAction dispatcher _ (UserPage id) = do
dispatcher $ UserPageA $ C.FetchContact id dispatcher $ UserPageA $ C.FetchContact id
dispatchAction dispatcher _ (Annuaire id) = do dispatchAction dispatcher _ (Annuaire id) = do
dispatcher $ SetRoute $ Annuaire id dispatcher $ SetRoute $ Annuaire id
dispatcher $ AnnuaireAction $ Annuaire.Load id
dispatchAction dispatcher _ (Folder id) = do dispatchAction dispatcher _ (Folder id) = do
dispatcher $ SetRoute $ Folder id dispatcher $ SetRoute $ Folder id
......
...@@ -23,10 +23,10 @@ import Gargantext.Pages.Corpus.Dashboard as Dsh ...@@ -23,10 +23,10 @@ import Gargantext.Pages.Corpus.Dashboard as Dsh
import Gargantext.Pages.Corpus.Graph as GE import Gargantext.Pages.Corpus.Graph as GE
import Gargantext.Pages.Corpus.Tabs.Terms.NgramsTable as NG import Gargantext.Pages.Corpus.Tabs.Terms.NgramsTable as NG
import Gargantext.Pages.Home as L import Gargantext.Pages.Home as L
import Gargantext.Pages.Layout.Actions (Action(..), _addCorpusAction, _documentViewAction, _graphExplorerAction, _loginAction, _searchAction, _treeAction, _userPageAction, performAction, _annuaireAction) import Gargantext.Pages.Layout.Actions (Action(..), _addCorpusAction, _documentViewAction, _graphExplorerAction, _loginAction, _searchAction, _treeAction, _userPageAction, performAction)
import Gargantext.Pages.Layout.Specs.AddCorpus as AC import Gargantext.Pages.Layout.Specs.AddCorpus as AC
import Gargantext.Pages.Layout.Specs.Search as S import Gargantext.Pages.Layout.Specs.Search as S
import Gargantext.Pages.Layout.States (AppState, _addCorpusState, _documentViewState, _graphExplorerState, _loginState, _searchState, _treeState, _userPageState, _annuaireState) import Gargantext.Pages.Layout.States (AppState, _addCorpusState, _documentViewState, _graphExplorerState, _loginState, _searchState, _treeState, _userPageState)
import Gargantext.Router (Routes(..)) import Gargantext.Router (Routes(..))
layoutSpec :: Spec AppState {} Action layoutSpec :: Spec AppState {} Action
...@@ -62,7 +62,7 @@ pagesComponent s = case s.currentRoute of ...@@ -62,7 +62,7 @@ pagesComponent s = case s.currentRoute of
selectSpec PGraphExplorer = focus _graphExplorerState _graphExplorerAction GE.specOld selectSpec PGraphExplorer = focus _graphExplorerState _graphExplorerAction GE.specOld
selectSpec Dashboard = layout0 $ noState Dsh.layoutDashboard selectSpec Dashboard = layout0 $ noState Dsh.layoutDashboard
selectSpec (Annuaire i) = layout0 $ focus _annuaireState _annuaireAction A.layoutAnnuaire selectSpec (Annuaire i) = layout0 $ cmapProps (const {annuaireId: i}) $ noState A.layout
selectSpec (UserPage i) = layout0 $ focus _userPageState _userPageAction C.layoutUser selectSpec (UserPage i) = layout0 $ focus _userPageState _userPageAction C.layoutUser
-- To be removed -- To be removed
selectSpec NGramsTable = layout0 $ noState NG.ngramsTableSpec selectSpec NGramsTable = layout0 $ noState NG.ngramsTableSpec
......
...@@ -8,8 +8,6 @@ import Gargantext.Components.Login as LN ...@@ -8,8 +8,6 @@ import Gargantext.Components.Login as LN
import Gargantext.Components.Tree as Tree import Gargantext.Components.Tree as Tree
import Gargantext.Pages.Corpus.Document as D import Gargantext.Pages.Corpus.Document as D
import Gargantext.Pages.Annuaire as Annuaire
import Gargantext.Pages.Corpus.Tabs.Documents as DV
import Gargantext.Pages.Corpus.Graph as GE import Gargantext.Pages.Corpus.Graph as GE
import Gargantext.Pages.Annuaire.User.Contacts as C import Gargantext.Pages.Annuaire.User.Contacts as C
import Gargantext.Pages.Layout.Specs.AddCorpus as AC import Gargantext.Pages.Layout.Specs.AddCorpus as AC
...@@ -20,11 +18,9 @@ type AppState = ...@@ -20,11 +18,9 @@ type AppState =
{ currentRoute :: Maybe Routes { currentRoute :: Maybe Routes
, loginState :: LN.State , loginState :: LN.State
, addCorpusState :: AC.State , addCorpusState :: AC.State
, docViewState :: DV.State
, searchState :: S.State , searchState :: S.State
, userPageState :: C.State , userPageState :: C.State
, documentState :: D.State , documentState :: D.State
, annuaireState :: Annuaire.State
, ntreeState :: Tree.State , ntreeState :: Tree.State
, search :: String , search :: String
, showLogin :: Boolean , showLogin :: Boolean
...@@ -38,12 +34,10 @@ initAppState = ...@@ -38,12 +34,10 @@ initAppState =
{ currentRoute : Just Home { currentRoute : Just Home
, loginState : LN.initialState , loginState : LN.initialState
, addCorpusState : AC.initialState , addCorpusState : AC.initialState
, docViewState : DV.initialState
, searchState : S.initialState , searchState : S.initialState
, userPageState : C.initialState , userPageState : C.initialState
, documentState : D.initialState , documentState : D.initialState
, ntreeState : Tree.exampleTree , ntreeState : Tree.exampleTree
, annuaireState : Annuaire.initialState
, search : "" , search : ""
, showLogin : false , showLogin : false
, showCorpus : false , showCorpus : false
...@@ -58,18 +52,12 @@ _loginState = lens (\s -> s.loginState) (\s ss -> s{loginState = ss}) ...@@ -58,18 +52,12 @@ _loginState = lens (\s -> s.loginState) (\s ss -> s{loginState = ss})
_addCorpusState :: Lens' AppState AC.State _addCorpusState :: Lens' AppState AC.State
_addCorpusState = lens (\s -> s.addCorpusState) (\s ss -> s{addCorpusState = ss}) _addCorpusState = lens (\s -> s.addCorpusState) (\s ss -> s{addCorpusState = ss})
_docViewState :: Lens' AppState DV.State
_docViewState = lens (\s -> s.docViewState) (\s ss -> s{docViewState = ss})
_searchState :: Lens' AppState S.State _searchState :: Lens' AppState S.State
_searchState = lens (\s -> s.searchState) (\s ss -> s{searchState = ss}) _searchState = lens (\s -> s.searchState) (\s ss -> s{searchState = ss})
_userPageState :: Lens' AppState C.State _userPageState :: Lens' AppState C.State
_userPageState = lens (\s -> s.userPageState) (\s ss -> s{userPageState = ss}) _userPageState = lens (\s -> s.userPageState) (\s ss -> s{userPageState = ss})
_annuaireState :: Lens' AppState Annuaire.State
_annuaireState = lens (\s -> s.annuaireState) (\s ss -> s{annuaireState = ss})
_documentViewState :: Lens' AppState D.State _documentViewState :: Lens' AppState D.State
_documentViewState = lens (\s -> s.documentState) (\s ss -> s{documentState = ss}) _documentViewState = lens (\s -> s.documentState) (\s ss -> s{documentState = ss})
......
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