-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
64 lines (59 loc) · 2.21 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
import dash
from dash import Dash
from dash import dcc, html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output
import polars as pl
from modules import posture_monitoring, day_analisys
from modules.base_app import app, DEBUG_STATE
from tabs import realtime_data, time_selector, general_view
external_stylesheets = [
dbc.themes.LITERA,
"https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap"
]
app.layout = html.Div([
# Header
dbc.Row(className="header", justify="between", children=[
dbc.Col([
html.H3("SmartChair", className="headerElement", id="title"),
], width=2),
dbc.Col(className="alignRight", children=[
html.A("Luís Fernando Laguardia", className="headerElement", id="username"),
html.Img(src="https://yt3.googleusercontent.com/XzyXdpLZBe2Mci_xqo2h-UynYktaAXL4FNdoPL_jAWJn16aiHkiilmYxqaOP6AANFQno4RBn=s176-c-k-c0x00ffffff-no-rj", className="headerElement", id="profilePic"),
], width=3)
]),
# Posture Monitoring Stats
html.Div(id="postureMonitorContainer", children=[
posture_monitoring.layout
]),
day_analisys.get_layout(),
html.Div(className="separator"),
dcc.Tabs(id="tabsSelector", children=[
dcc.Tab(label="General View", className="tab", value="General View"),
dcc.Tab(label="Real Time Data", className="tab", value="Real Time Data"),
dcc.Tab(label="Time Selector", className="tab", value="Time Selector")
]),
html.Div(id="panelGraph", children=[
html.Div(id="tabContent")
]),
html.Div([
html.Div(
dcc.Link(
f"{page['name']} - {page['path']}", href=page["relative_path"]
)
)
for page in dash.page_registry.values()
]),
])
@app.callback(Output('tabContent', 'children'),
Input('tabsSelector', 'value'))
def render_content(tab):
match tab:
case "General View":
return general_view.layout
case "Real Time Data":
return realtime_data.layout
case "Time Selector":
return time_selector.layout
if __name__ == '__main__':
app.run_server(debug=True, port=8000)