-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
47 lines (40 loc) · 1.77 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import dash
import dash_core_components as dcc
import dash_html_components as html
from components.comments.component import CommentsComponent
from components.votes.component import VotesComponent
from components.analytics.component import AnalyticsComponent
from dash.dependencies import Input, Output
from dateutil.parser import *
from dateutil.tz import *
import datetime
from datetime import date
class App():
def __init__(self):
self.app = dash.Dash(__name__)
def render(self):
self.votes_component = VotesComponent(self.app)
self.comments_component = CommentsComponent(self.app)
self.analytics_component = AnalyticsComponent(self.app)
self.app.layout = html.Div(children=[
html.Nav(
className="navbar navbar-light bg-white topbar mb-4 static-top shadow", children=[
html.Img(src="./assets/logo-ej-mini.png"),
html.Button(className='dash-icon', children=[html.I(className='fa fa-repeat')],
id='app_reload', n_clicks=0),
]),
html.Div(id="app",
style={"width": "90%", "margin": "auto"},
children=[
html.Div(id="app_loader",
children=self._app_root(self.analytics_component,
self.votes_component, self.comments_component))
])
])
def _app_root(self, analytics_component, votes_component, comments_component):
return [html.Div(style={}, children=[
analytics_component.render(),
]),
html.Div(style={}, children=[
votes_component.render(),
]), comments_component.render()]