wercore / Home.py
rawshal's picture
Update Home.py
010c50f verified
Raw History Blame Contribute Delete
3.82 kB
import streamlit as st
import os
# ── 1. CONFIG & ASSETS ────────────────────────────────────────────────────────
st.set_page_config(page_title="Wercore | App Generator", page_icon="🏒", layout="wide")
st.markdown("""
<style>
[data-testid="stLogo"] { height: 6rem !important; object-fit: contain !important; }
/* Make the page links look like large menu cards */
div[data-testid="stPageLink-NavLink"] {
background-color: #f8f9fa;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 15px !important;
text-align: center;
transition: all 0.3s ease;
}
div[data-testid="stPageLink-NavLink"]:hover {
background-color: #0054a6;
color: white !important;
border-color: #0054a6;
transform: translateY(-2px);
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
div[data-testid="stPageLink-NavLink"] p {
font-size: 1.1rem;
font-weight: 600;
}
</style>
""", unsafe_allow_html=True)
st.logo("WERCORE logo.png")
# ── 2. LOGIN SYSTEM ───────────────────────────────────────────────────────────
if not st.session_state.get("authenticated", False):
# CRITICAL FIX: Hide the sidebar and its toggle button entirely until logged in
st.markdown("""
<style>
[data-testid="stSidebar"] { display: none !important; }
[data-testid="collapsedControl"] { display: none !important; }
</style>
""", unsafe_allow_html=True)
col1, col2, col3 = st.columns([1, 2, 1])
with col2:
st.title("πŸ”’ Wercore Portal")
st.info("Please log in to access the reporting engines.")
password = st.text_input("Master Password", type="password")
if st.button("Secure Login", type="primary", use_container_width=True):
if password == "Wercore2026":
st.session_state["authenticated"] = True
st.rerun()
else:
st.error("❌ Incorrect Password.")
st.stop()
# ── 3. HEADER ─────────────────────────────────────────────────────────────────
st.title("Wercore App Generator")
st.markdown("Select a reporting engine below to begin generating compliance documentation.")
st.markdown("---")
# ── 4. NAVIGATION GRID (CRASH-PROOF) ──────────────────────────────────────────
# This function stops the app from crashing if a file name is misspelled
def safe_link(file_path, label, icon):
if os.path.exists(file_path):
st.page_link(file_path, label=label, icon=icon)
else:
st.warning(f"⚠️ **Missing File:** Please ensure `{file_path}` exists.")
col1, col2 = st.columns(2)
with col1:
safe_link("pages/1_Water_Tank_Report.py", "Water Tank Disinfection", "πŸ’§")
st.write("") # Spacer
safe_link("pages/4_Pipeline_Disinfection.py", "Pipeline Disinfection", "🚰")
with col2:
safe_link("pages/2_Pest_Control_Report.py", "Pest Control Report", "πŸͺ³")
st.write("") # Spacer
# Updated to the correct exact filename you provided
safe_link("pages/3_Termite_Control_Report.py", "Termite Control Report", "🐜")
st.markdown("---")
st.caption("Β© 2026 Sterdil Labs")