Commit a1a1795c authored by Abinaya Sudhir's avatar Abinaya Sudhir

Ngrams Table Added to Navigation

parent 1e5fbdae
...@@ -27,3 +27,8 @@ ...@@ -27,3 +27,8 @@
#user-page-info { #user-page-info {
margin-top : 38px; margin-top : 38px;
} }
.tableHeader {
background-color : blue;
color: white;
}
...@@ -35,6 +35,7 @@ import Thermite (PerformAction, Render, Spec, _render, cotransform, defaultPerfo ...@@ -35,6 +35,7 @@ import Thermite (PerformAction, Render, Spec, _render, cotransform, defaultPerfo
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
import UserPage as UP import UserPage as UP
import GraphExplorer as GE import GraphExplorer as GE
import NgramsTable as NG
type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e) type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e)
...@@ -54,6 +55,7 @@ type AppState = ...@@ -54,6 +55,7 @@ type AppState =
, showLogin :: Boolean , showLogin :: Boolean
, showCorpus :: Boolean , showCorpus :: Boolean
, graphExplorer :: GE.State , graphExplorer :: GE.State
, ngState :: NG.State
} }
initAppState :: AppState initAppState :: AppState
...@@ -73,6 +75,7 @@ initAppState = ...@@ -73,6 +75,7 @@ initAppState =
, showLogin : false , showLogin : false
, showCorpus : false , showCorpus : false
, graphExplorer : GE.initialState , graphExplorer : GE.initialState
, ngState : NG.initialState
} }
data Action data Action
...@@ -93,6 +96,7 @@ data Action ...@@ -93,6 +96,7 @@ data Action
| CorpusAnalysisA CA.Action | CorpusAnalysisA CA.Action
| ShowLogin | ShowLogin
| ShowAddcorpus | ShowAddcorpus
| NgramsA NG.Action
...@@ -246,6 +250,17 @@ _graphExplorerAction = prism GraphExplorerA \action -> ...@@ -246,6 +250,17 @@ _graphExplorerAction = prism GraphExplorerA \action ->
_-> Left action _-> Left action
_ngState :: Lens' AppState NG.State
_ngState = lens (\s -> s.ngState) (\s ss -> s{ngState = ss})
_ngAction :: Prism' Action NG.Action
_ngAction = prism NgramsA \action ->
case action of
NgramsA caction -> Right caction
_-> Left action
pagesComponent :: forall props eff. AppState -> Spec (E eff) AppState props Action pagesComponent :: forall props eff. AppState -> Spec (E eff) AppState props Action
pagesComponent s = pagesComponent s =
case s.currentRoute of case s.currentRoute of
...@@ -269,7 +284,9 @@ pagesComponent s = ...@@ -269,7 +284,9 @@ pagesComponent s =
selectSpec Tabview = layout0 $ focus _tabviewState _tabviewAction TV.tab1 selectSpec Tabview = layout0 $ focus _tabviewState _tabviewAction TV.tab1
-- To be removed -- To be removed
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
selectSpec NGramsTable = layout0 $ focus _ngState _ngAction NG.ngramsTableSpec
selectSpec PGraphExplorer = focus _graphExplorerState _graphExplorerAction GE.spec selectSpec PGraphExplorer = focus _graphExplorerState _graphExplorerAction GE.spec
selectSpec _ = simpleSpec defaultPerformAction defaultRender selectSpec _ = simpleSpec defaultPerformAction defaultRender
routingSpec :: forall props eff. Spec (dom :: DOM |eff) AppState props Action routingSpec :: forall props eff. Spec (dom :: DOM |eff) AppState props Action
...@@ -598,3 +615,8 @@ dispatchAction dispatcher _ PGraphExplorer = do ...@@ -598,3 +615,8 @@ dispatchAction dispatcher _ PGraphExplorer = do
_ <- dispatcher $ SetRoute $ PGraphExplorer _ <- dispatcher $ SetRoute $ PGraphExplorer
--_ <- dispatcher $ GraphExplorerA $ GE.NoOp --_ <- dispatcher $ GraphExplorerA $ GE.NoOp
pure unit pure unit
dispatchAction dispatcher _ NGramsTable = do
_ <- dispatcher $ SetRoute $ NGramsTable
_ <- dispatcher $ NgramsA $ NG.NoOp
pure unit
module NgramsTable where
import Prelude
import Control.Monad.Eff.Console (CONSOLE)
import DOM (DOM)
import Network.HTTP.Affjax (AJAX)
import React.DOM (input, table, tbody, td, text, th, thead, tr)
import React.DOM.Props (_type, checked, className, onChange, scope, title)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
import Unsafe.Coerce (unsafeCoerce)
type State =
{
completed :: Boolean
}
initialState :: State
initialState =
{
completed : true
}
data Action
= NoOp
| ChangeCompleted Boolean
performAction :: forall eff props. PerformAction ( console :: CONSOLE , ajax :: AJAX, dom :: DOM | eff ) State props Action
performAction NoOp _ _ = void do
modifyState id
performAction (ChangeCompleted b) _ _ = void $ modifyState $ _ { completed = b }
ngramsTableSpec :: forall props eff . Spec (console::CONSOLE, ajax::AJAX, dom::DOM | eff) State props Action
ngramsTableSpec = simpleSpec performAction render
where
render :: Render State props Action
render dispatch _ state _ =
[table [ className "table able table-bordered"]
[ thead [ className "tableHeader table-bordered"]
[ tr []
[ th [ scope "col"] [ text "Map" ]
, th [ scope "col"] [ text "Stop"]
, th [ scope "col"] [ text "Terms"]
, th [ scope "col"] [ text "Occurences(nb)" ]
]
]
, tbody []
[ tr [] [
td [] [ input_checkbox]
, td [][ input_checkbox]
, td [] [ text "India"]
, td [] [ text "807"]
]
, tr [] [ td [][ input_checkbox]
, td [] [ input_checkbox]
, td [] [ text "Tobacco use"]
, td [] [ text "351"]
]
, tr [] [ td []
[ input_checkbox]
, td []
[ input_checkbox]
, td [] [ text "tobacco"]
, td [] [ text "336"]
]
,tr [] [ td []
[ input_checkbox]
, td []
[ input_checkbox]
, td [] [ text "studies"]
, td [] [ text "282"]
]
, tr [] [ td []
[ input_checkbox]
, td []
[ input_checkbox]
, td [] [ text "prevalence"]
, td [] [ text "217"]
]
, tr [] [ td []
[ input_checkbox]
, td []
[ input_checkbox]
, td [] [ text "smoking"]
, td [] [ text "169"]
]
]
]
]
where
input_checkbox = input [ _type "checkbox"
, className "checkbox"
, checked state.completed
, title "Mark as completed"
, onChange \e -> dispatch (ChangeCompleted (unsafeCoerce e).target.checked)
] []
...@@ -26,6 +26,7 @@ data Routes ...@@ -26,6 +26,7 @@ data Routes
| Tabview | Tabview
| CorpusAnalysis | CorpusAnalysis
| PGraphExplorer | PGraphExplorer
| NGramsTable
instance showRoutes :: Show Routes where instance showRoutes :: Show Routes where
...@@ -39,6 +40,7 @@ instance showRoutes :: Show Routes where ...@@ -39,6 +40,7 @@ instance showRoutes :: Show Routes where
show Tabview = "Tabview" show Tabview = "Tabview"
show CorpusAnalysis = "corpus" show CorpusAnalysis = "corpus"
show PGraphExplorer = "graphExplorer" show PGraphExplorer = "graphExplorer"
show NGramsTable = "NGramsTable"
int :: Match Int int :: Match Int
int = floor <$> num int = floor <$> num
...@@ -55,8 +57,10 @@ routing = ...@@ -55,8 +57,10 @@ routing =
<|> addcorpusRoute <|> addcorpusRoute
<|> corpusAnalysis <|> corpusAnalysis
<|> graphExplorer <|> graphExplorer
<|> ngramsTable
<|> home <|> home
where where
ngramsTable = NGramsTable <$ route "ngrams"
tabview = Tabview <$ route "tabview" tabview = Tabview <$ route "tabview"
documentView = AnnotationDocumentView <$> (route "documentView" *> int) documentView = AnnotationDocumentView <$> (route "documentView" *> int)
userPageRoute = UserPage <$ route "userPage" userPageRoute = UserPage <$ route "userPage"
......
...@@ -2653,15 +2653,6 @@ react-echarts-v3@^1.0.14: ...@@ -2653,15 +2653,6 @@ react-echarts-v3@^1.0.14:
element-resize-detector latest element-resize-detector latest
lodash latest lodash latest
"react-graph-explorer@git+ssh://git@gitlab.iscpif.fr:20022/gargantext/reactGraphExplorer.git":
version "0.1.0"
resolved "git+ssh://git@gitlab.iscpif.fr:20022/gargantext/reactGraphExplorer.git#aaed893de5fc6029639815d75426bc5d06646050"
dependencies:
graph-explorer "git+ssh://git@gitlab.iscpif.fr:20022/gargantext/graphExplorer.git"
prop-types "^15.6.0"
react "^16.2.0"
react-dom "^16.2.0"
react@^16.2.0: react@^16.2.0:
version "16.2.0" version "16.2.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.2.0.tgz#a31bd2dab89bff65d42134fa187f24d054c273ba" resolved "https://registry.yarnpkg.com/react/-/react-16.2.0.tgz#a31bd2dab89bff65d42134fa187f24d054c273ba"
......
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