This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import streamlit as st
|
||||
from streamlit import dialog
|
||||
import queries.user as user_queries
|
||||
import random
|
||||
|
||||
from logger import init_logger
|
||||
from styles import init_styles
|
||||
from user import init_user, is_login_enabled, is_logged_in
|
||||
from user import init_user, is_login_enabled, is_logged_in, init_demo_user
|
||||
from themes import init_themes
|
||||
|
||||
init_logger()
|
||||
@@ -12,18 +13,21 @@ init_user()
|
||||
init_styles()
|
||||
init_themes()
|
||||
|
||||
if is_login_enabled and not is_logged_in:
|
||||
with st.container(width="stretch", height="stretch", horizontal_alignment="center"):
|
||||
st.title("Daily Counter", width="stretch", text_alignment="center")
|
||||
st.text("Please log in to use this app", width="stretch", text_alignment="center")
|
||||
st.space()
|
||||
if st.button("Log in"):
|
||||
st.login()
|
||||
|
||||
else:
|
||||
if not is_login_enabled() or is_logged_in():
|
||||
counters = st.Page("pages/counters.py", title="Counters", icon=":material/update:")
|
||||
stats = st.Page("pages/stats.py", title="Statistics", icon=":material/chart_data:")
|
||||
settings = st.Page("pages/settings.py", title=" ", icon=":material/menu:")
|
||||
pages = [counters, stats, settings]
|
||||
pg = st.navigation(position="top", pages=pages)
|
||||
pg.run()
|
||||
|
||||
else:
|
||||
with st.container(width="stretch", height="stretch", horizontal_alignment="center"):
|
||||
st.title("Daily Counter", width="stretch", text_alignment="center")
|
||||
st.text("Please log in to use this app", width="stretch", text_alignment="center")
|
||||
st.space()
|
||||
if st.button("Log in", width="stretch",icon=":material/login:"):
|
||||
st.login()
|
||||
if st.button("Demo", width="stretch", icon=":material/account_box:"):
|
||||
init_demo_user()
|
||||
st.rerun()
|
||||
|
||||
Reference in New Issue
Block a user