-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
68 lines (57 loc) · 2.15 KB
/
Copy pathapp.py
File metadata and controls
68 lines (57 loc) · 2.15 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
import streamlit as st
st.set_page_config(
page_title="MyVault",
page_icon="🔐",
layout="wide",
initial_sidebar_state="expanded"
)
from auth.auth import login, register, logout
from options.dashboard import dashboard
from options.deadlines import deadlines
from options.transactions import transactions
# Initialize session state for login and registration steps
if "logged_in" not in st.session_state:
st.session_state.logged_in = False
if "registration_step" not in st.session_state:
st.session_state.registration_step = 0
if "registration_data" not in st.session_state:
st.session_state.registration_data = {
"username": "",
"face_image": None,
"audio": None
}
if "login_step" not in st.session_state:
st.session_state.login_step = 0
if "login_data" not in st.session_state:
st.session_state.login_data = {
"username": "",
"face_image": None,
"audio": None
}
# Main function for the app
def main():
# st.set_page_config(page_title="MyVault", layout="wide", initial_sidebar_state="expanded", page_icon = ":coin:")
if not st.session_state.logged_in:
option = st.sidebar.selectbox("Choose", ["Register", "Login"])
if option == "Register":
register()
st.write('<script>location.reload()</script>', unsafe_allow_html=True)
elif option == "Login":
login()
st.write('<script>location.reload()</script>', unsafe_allow_html=True)
else:
username = st.session_state.user_data["username"]
st.title(f"Welcome, {username}! 👋")
button = st.sidebar.button("Logout")
if button:
logout()
st.write('<script>location.reload()</script>', unsafe_allow_html=True)
option = st.sidebar.radio("Pages", ["Dashboard", "Transactions", "Reminders"])
if option == "Dashboard":
dashboard(username)
elif option == "Reminders":
deadlines(username)
elif option == "Transactions":
transactions(username)
if __name__ == '__main__':
main()