-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
81 lines (70 loc) · 2.1 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# -*- coding: utf-8 -*-
# Run this app with `python app.py` and
# visit http://127.0.0.1:8050/ in your web browser.
import dash
from dash import html
from components.header import header
from components.sidebar import sidebar
from components.about import about_box
from components.body import body
from utils.get_data.refresh_data import refresh_data
from dash.dependencies import Input, Output, State
import visdcc
app = dash.Dash(
__name__,
meta_tags = [
{
'og:title': 'Effective Altruism Data',
"og:url": "https://effectivealtruismdata.com",
"og:site_name": "Effective Altruism Data",
"og:image": "https://i.ibb.co/mqbpdXW/eadata.png",
"og:image:width": "1440",
"og:image:height": "630",
"twitter:card": "summary_large_image",
'name': 'viewport',
'content': 'width=device-width, initial-scale=1.0',
}
],
)
app.title = 'Effective Altruism Data'
server = app.server
# refresh_data()
# def serve_layout():
# return html.Div(
app.layout = html.Div(
[
header(),
html.Div(
[
html.Div(
[
sidebar(),
],
),
about_box(),
body(),
visdcc.Run_js(id='javascript-body'),
],
className = 'body',
id = "sidebar-visdcc",
)
],
)
@app.callback(
Output('javascript-body', 'run'),
[Input('sidebar-visdcc', 'n_clicks')])
def sidebar(x):
if x:
return "document.getElementById('sidebar').setAttribute('onclick', 'mobileSidebar()')"
return ""
@app.callback(
Output('javascript-header', 'run'),
[Input('header-sidebar-visdcc', 'n_clicks')])
def sidebar(x):
if x:
return "document.getElementById('sidebar').setAttribute('onclick', 'mobileSidebar()')"
return ""
# app.layout = serve_layout
if __name__ == '__main__':
#app.run_server(debug=True)
app.run_server(debug=False)