-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
122 lines (102 loc) · 3.7 KB
/
Copy pathapp.py
File metadata and controls
122 lines (102 loc) · 3.7 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import streamlit as st
st.set_page_config(
layout="wide",
initial_sidebar_state="collapsed"
)
import requests as rq
import time as time
import math
import randfacts
from getData import pod_fake_data, getUserData
pod_fake_data()
getUserData()
from config import weather_map, urls, paths, getFakeData, fullscreen_loader
from contextlib import contextmanager
from pathlib import Path
import random
#----------------------------------------------------------------------------------
if "loader" not in st.session_state:
st.session_state.loader = True
if st.session_state.loader:
loader = fullscreen_loader(paths["gif_path"])
st.session_state.loader = False
else:
loader = st.empty()
#----------------------------------------------------------------------------------
if "isLoggedIn" not in st.session_state:
st.session_state.isLoggedIn = False
if (st.session_state.isLoggedIn == True):
st.markdown(f"<div style='text-align: right;'>{st.session_state.user_name}: <span style='color: {st.session_state.user_privileges[1]};'>{st.session_state.user_privileges[0]}</span></div>", unsafe_allow_html=True)
st.divider()
#----------------------------------------------------------------------------------
st.markdown("""
<h1 style='font-family: Helvetica; color: white; text-align: center'>🚄 Hyperloop Control Dashboard</h1>
""", unsafe_allow_html=True)
st.divider()
st.markdown("""
<style>
div.stButton > button{
height: 80px;
width: 100%;
font-size: 20px;
font-weight: 600;
}
</style>
""", unsafe_allow_html=True)
#----------------------------------------------------------------------------------
col1,col2,col3,col4,col5 = st.columns(5)
with col1:
if st.button("🚄 Pod Tracker", use_container_width=True):
st.switch_page("pages/podTracker.py")
with col2:
if st.button("🛣️ Route Monitoring", use_container_width=True):
st.switch_page("pages/routeMonitoring.py")
with col3:
if st.button("⚡️ Energy Optimization", use_container_width=True):
st.switch_page("pages/energyOptimization.py")
with col4:
if st.button("🩺 Pod Health Insights", use_container_width=True):
st.switch_page("pages/podHealthInsights.py")
with col5:
if st.button("🤔 Did You Know?", use_container_width=True):
st.switch_page("pages/didYouKnow.py")
st.divider()
col6,col7,col8 = st.columns(3)
with col6:
if st.button("🔴 Live Tracking", use_container_width=True):
st.switch_page("pages/liveTracking.py")
with col7:
if st.button("🔧 Check Maintenance Requirement", use_container_width=True):
st.switch_page("pages/maintenanceRequirement.py")
if "isLoggedIn" not in st.session_state:
st.session_state.isLoggedIn = False
if (st.session_state.isLoggedIn == False):
with col8:
if st.button("🔒 Log In", use_container_width=True):
st.switch_page("pages/logIn.py")
else:
with col8:
if st.button("🔓 Sign Out", use_container_width=True):
st.session_state.isLoggedIn = False
st.user_name = ""
st.user_privileges = {"",""}
st.switch_page("app.py")
st.divider()
st.components.v1.html("""
<script>
(function() {
function activateShockwave() {
const loader = window.parent.document.getElementById("loader-overlay");
if(loader) {
loader.classList.add("shockwave");
loader.addEventListener("transitionend", function() {
loader.remove();
});
} else {
setTimeout(activateShockwave, 50);
}
}
activateShockwave();
})();
</script>
""", height=0)