Initial commit

This commit is contained in:
2026-04-07 12:31:22 +05:30
commit 510fba47b5
54 changed files with 2964 additions and 0 deletions

101
app.py Normal file
View File

@@ -0,0 +1,101 @@
# -*- 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
# ✅ FIXED MENU (no emojis here)
menu = ["Analytics", "Data", "Mailer", "Mappings"]
# ✅ ICON MAP
icons = {
"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")
choice = st.selectbox(
"Page",
menu,
index=0,
format_func=lambda x: f"{icons.get(x, '')} {x}" # ✅ Safe rendering
)
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 FIXED (no emojis in condition)
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()