Files
daily-counter/app/streamlit_app.py

34 lines
1.2 KiB
Python
Raw Normal View History

2026-03-31 19:09:37 +02:00
import streamlit as st
2026-04-28 21:04:52 +02:00
from streamlit import dialog
import queries.user as user_queries
2026-05-01 17:41:42 +02:00
import random
2026-04-28 21:04:52 +02:00
2026-03-31 19:09:37 +02:00
from logger import init_logger
from styles import init_styles
2026-05-01 17:41:42 +02:00
from user import init_user, is_login_enabled, is_logged_in, init_demo_user
2026-04-30 21:31:19 +02:00
from themes import init_themes
2026-03-31 19:09:37 +02:00
init_logger()
2026-04-30 14:16:57 +02:00
init_user()
2026-03-31 19:09:37 +02:00
init_styles()
2026-04-30 21:31:19 +02:00
init_themes()
2026-03-31 19:09:37 +02:00
2026-05-01 17:41:42 +02:00
if not is_login_enabled() or is_logged_in():
2026-03-31 19:09:37 +02:00
counters = st.Page("pages/counters.py", title="Counters", icon=":material/update:")
stats = st.Page("pages/stats.py", title="Statistics", icon=":material/chart_data:")
2026-04-30 14:16:57 +02:00
settings = st.Page("pages/settings.py", title=" ", icon=":material/menu:")
pages = [counters, stats, settings]
2026-04-28 21:04:52 +02:00
pg = st.navigation(position="top", pages=pages)
pg.run()
2026-05-01 17:41:42 +02:00
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()