Commit 03e20929 authored by Sudhir Kumar's avatar Sudhir Kumar

graphExplorer layout

parent b4e74a52
module GraphExplorer where
import React.DOM (button, button', div, form', input, li', menu, text, ul, ul')
import React.DOM.Props (_id, _type, className, name, placeholder, value)
import Thermite (Spec, defaultPerformAction, simpleSpec)
newtype State = State {mode :: String}
data Action = NoOp
initialState :: State
initialState = State {mode : "select"}
spec :: forall eff props. Spec eff State props Action
spec = simpleSpec defaultPerformAction render
where
render _ _ _ _ =
[ div [className "row"] [
div [className "col-md-12"]
[ menu [_id "toolbar"]
[ ul'
[ li'
[--GraphLoader here
]
, li'
[ button [className "btn btn-success btn-sm"] [text "Change Type"]
]
, li'
[ button [className "btn btn-primary btn-sm"] [text "Change Level"]
]
, li'
[ form'
[ input [_type "text", name "query", placeholder "Select Topics"] []
, input [_type "submit", value "Search"] []
]
]
, li'
[ button' [text "Screenshot"]]
, li'
[ button' [text "Save"] -- TODO: Implement Save!
]
]
]
]
]
, div [className "row"]
[ div [className "col-md-8"]
[ div [] [text "GraphExplorer here...."]
]
, div [className "col-md-4"]
[ div [_id "sidepanel"]
[ text "SidePanel for contextual information"
]
]
]
]
...@@ -34,6 +34,7 @@ import Tabview as TV ...@@ -34,6 +34,7 @@ import Tabview as TV
import Thermite (PerformAction, Render, Spec, _render, cotransform, defaultPerformAction, defaultRender, focus, modifyState, simpleSpec, withState) import Thermite (PerformAction, Render, Spec, _render, cotransform, defaultPerformAction, defaultRender, focus, modifyState, simpleSpec, withState)
import Unsafe.Coerce (unsafeCoerce) import Unsafe.Coerce (unsafeCoerce)
import UserPage as UP import UserPage as UP
import GraphExplorer as GE
type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e) type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e)
...@@ -52,6 +53,7 @@ type AppState = ...@@ -52,6 +53,7 @@ type AppState =
, corpusAnalysis :: CA.State , corpusAnalysis :: CA.State
, showLogin :: Boolean , showLogin :: Boolean
, showCorpus :: Boolean , showCorpus :: Boolean
, graphExplorer :: GE.State
} }
initAppState :: AppState initAppState :: AppState
...@@ -70,6 +72,7 @@ initAppState = ...@@ -70,6 +72,7 @@ initAppState =
, corpusAnalysis : CA.initialState , corpusAnalysis : CA.initialState
, showLogin : false , showLogin : false
, showCorpus : false , showCorpus : false
, graphExplorer : GE.initialState
} }
data Action data Action
...@@ -84,6 +87,7 @@ data Action ...@@ -84,6 +87,7 @@ data Action
| AnnotationDocumentViewA D.Action | AnnotationDocumentViewA D.Action
| TreeViewA NT.Action | TreeViewA NT.Action
| TabViewA TV.Action | TabViewA TV.Action
| GraphExplorerA GE.Action
| Search String | Search String
| Go | Go
| CorpusAnalysisA CA.Action | CorpusAnalysisA CA.Action
...@@ -125,7 +129,6 @@ performAction _ _ _ = void do ...@@ -125,7 +129,6 @@ performAction _ _ _ = void do
_landingState :: Lens' AppState L.State _landingState :: Lens' AppState L.State
_landingState = lens (\s -> s.landingState) (\s ss -> s{landingState = ss}) _landingState = lens (\s -> s.landingState) (\s ss -> s{landingState = ss})
_landingAction :: Prism' Action L.Action _landingAction :: Prism' Action L.Action
_landingAction = prism LandingA \action -> _landingAction = prism LandingA \action ->
case action of case action of
...@@ -233,6 +236,16 @@ _corpusAction = prism CorpusAnalysisA \action -> ...@@ -233,6 +236,16 @@ _corpusAction = prism CorpusAnalysisA \action ->
_-> Left action _-> Left action
_graphExplorerState :: Lens' AppState GE.State
_graphExplorerState = lens (\s -> s.graphExplorer) (\s ss -> s{graphExplorer = ss})
_graphExplorerAction :: Prism' Action GE.Action
_graphExplorerAction = prism GraphExplorerA \action ->
case action of
GraphExplorerA 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
...@@ -256,6 +269,7 @@ pagesComponent s = ...@@ -256,6 +269,7 @@ 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 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
...@@ -579,3 +593,8 @@ dispatchAction dispatcher _ CorpusAnalysis = do ...@@ -579,3 +593,8 @@ dispatchAction dispatcher _ CorpusAnalysis = do
_ <- dispatcher $ SetRoute $ CorpusAnalysis _ <- dispatcher $ SetRoute $ CorpusAnalysis
--_ <- dispatcher $ CorpusAnalysisA $ CA.NoOp --_ <- dispatcher $ CorpusAnalysisA $ CA.NoOp
pure unit pure unit
dispatchAction dispatcher _ PGraphExplorer = do
_ <- dispatcher $ SetRoute $ PGraphExplorer
--_ <- dispatcher $ GraphExplorerA $ GE.NoOp
pure unit
...@@ -25,6 +25,7 @@ data Routes ...@@ -25,6 +25,7 @@ data Routes
| AnnotationDocumentView Int | AnnotationDocumentView Int
| Tabview | Tabview
| CorpusAnalysis | CorpusAnalysis
| PGraphExplorer
instance showRoutes :: Show Routes where instance showRoutes :: Show Routes where
...@@ -37,6 +38,7 @@ instance showRoutes :: Show Routes where ...@@ -37,6 +38,7 @@ instance showRoutes :: Show Routes where
show (AnnotationDocumentView i) = "DocumentView" show (AnnotationDocumentView i) = "DocumentView"
show Tabview = "Tabview" show Tabview = "Tabview"
show CorpusAnalysis = "corpus" show CorpusAnalysis = "corpus"
show PGraphExplorer = "graphExplorer"
int :: Match Int int :: Match Int
int = floor <$> num int = floor <$> num
...@@ -52,6 +54,7 @@ routing = ...@@ -52,6 +54,7 @@ routing =
<|> docviewRoute <|> docviewRoute
<|> addcorpusRoute <|> addcorpusRoute
<|> corpusAnalysis <|> corpusAnalysis
<|> graphExplorer
<|> home <|> home
where where
tabview = Tabview <$ route "tabview" tabview = Tabview <$ route "tabview"
...@@ -62,6 +65,7 @@ routing = ...@@ -62,6 +65,7 @@ routing =
addcorpusRoute = AddCorpus <$ route "addCorpus" addcorpusRoute = AddCorpus <$ route "addCorpus"
loginRoute = Login <$ route "login" loginRoute = Login <$ route "login"
corpusAnalysis = CorpusAnalysis <$ route "corpus" corpusAnalysis = CorpusAnalysis <$ route "corpus"
graphExplorer = PGraphExplorer <$ route "graphExplorer"
home = Home <$ lit "" home = Home <$ lit ""
route str = lit "" *> lit str route str = lit "" *> lit str
......
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