93 lines
2.3 KiB
Python
93 lines
2.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
import os
|
|
import streamlit as st
|
|
from app_core.config.settings import AppSettings
|
|
from app_core.services.auth_service import AuthService
|
|
from app_core.ui.auth_ui import render_auth_card
|
|
from app_core.ui.layout import apply_global_style, render_topbar, render_header, render_sidebar_logo
|
|
|
|
settings = AppSettings() # loads env
|
|
|
|
# App config
|
|
st.set_page_config(
|
|
page_title="Workolik",
|
|
page_icon="assets/workolik.png",
|
|
layout="wide",
|
|
initial_sidebar_state="expanded",
|
|
)
|
|
|
|
apply_global_style(background_url=os.getenv("BACKGROUND_IMAGE_URL"))
|
|
|
|
auth_service = AuthService()
|
|
|
|
# Initialize session state
|
|
if "auth_user" not in st.session_state:
|
|
st.session_state.auth_user = None
|
|
|
|
# ? SIMPLE MENU (TEXT ONLY)
|
|
menu = ["Analytics", "Data", "Mailer", "Mappings"]
|
|
|
|
if st.session_state.auth_user is None:
|
|
render_topbar()
|
|
st.markdown('<style>[data-testid="stSidebar"]{display:none;}</style>', unsafe_allow_html=True)
|
|
render_auth_card(auth_service)
|
|
st.stop()
|
|
|
|
# Topbar
|
|
render_topbar()
|
|
|
|
# Dim background
|
|
st.markdown("""
|
|
<style>
|
|
.stApp::before { opacity: 0.1 !important; }
|
|
</style>
|
|
""", unsafe_allow_html=True)
|
|
|
|
with st.sidebar:
|
|
render_sidebar_logo()
|
|
|
|
st.markdown('<div class="sidebar-content">', unsafe_allow_html=True)
|
|
|
|
# Navigation
|
|
st.markdown('<div class="sidebar-section">', unsafe_allow_html=True)
|
|
st.markdown("### Navigation")
|
|
|
|
# ? NO format_func, NO icons
|
|
choice = st.selectbox(
|
|
"Page",
|
|
menu,
|
|
index=0
|
|
)
|
|
|
|
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
# Spacer
|
|
st.markdown('<div class="sidebar-spacer"></div>', unsafe_allow_html=True)
|
|
|
|
# Logout Section
|
|
st.markdown('<div class="sidebar-logout">', unsafe_allow_html=True)
|
|
st.caption(f"Logged in as: {st.session_state.auth_user['email']}")
|
|
|
|
if st.button("Logout", type="secondary"):
|
|
st.session_state.auth_user = None
|
|
st.rerun()
|
|
|
|
st.markdown('</div>', unsafe_allow_html=True)
|
|
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
# Routing
|
|
if choice == "Analytics":
|
|
from pages.see_logs import render_page
|
|
render_page()
|
|
|
|
elif choice == "Data":
|
|
from pages.see_payload import render_page
|
|
render_page()
|
|
|
|
elif choice == "Mailer":
|
|
from pages.mailer import render_page
|
|
render_page()
|
|
|
|
elif choice == "Mappings":
|
|
from pages.mappings import render_page
|
|
render_page() |