sbsmapper / app.py
georad's picture
Update app.py
d8197b6 verified
raw
history blame
2.61 kB
import streamlit as st
import time # Import time for simulating a running task
# --- Custom CSS for Sticky Header ---
st.markdown("""
<style>
/* Make the custom header container sticky */
.sticky-header {
position: sticky;
top: 0;
background-color: white; /* Or your preferred header background color */
padding: 10px 0; /* Adjust padding as needed */
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Optional: Add a subtle shadow */
z-index: 999; /* Ensure the header stays on top */
}
/* Style for the status indicator */
.status-indicator {
margin-left: 20px; /* Adjust spacing */
font-weight: bold;
}
.status-running {
color: orange;
}
.status-complete {
color: green;
}
.status-error {
color: red;
}
</style>
""", unsafe_allow_html=True)
# --- Sticky Header Content ---
# Use a container for the sticky header
header_container = st.container()
with header_container:
col1, col2 = st.columns([1, 5]) # Adjust column ratios as needed
with col1:
st.logo(image="images/menu_book_60dp_75FBFD.png")
with col2:
st.title("Map descriptions to SBS codes") # Your app title
# Placeholder for the status indicator
status_placeholder = st.empty()
# Add spacing below the sticky header to prevent content from being hidden
st.markdown("""<div style="height: 120px;"></div>""", unsafe_allow_html=True) # Adjust height based on your header size
# --- Main App Content ---
st.sidebar.header("SBS V2.0 mapper")
st.sidebar.write("(work in progress)")
st.sidebar.text("Demo by JA-RAD")
st.subheader("Select specific Chapter for quicker results")
# --- Application Logic (Example with Status Update) ---
# Function to simulate a long-running task
def run_mapping_process():
status_placeholder.markdown('<span class="status-indicator status-running">Running...</span>', unsafe_allow_html=True)
# Simulate work
time.sleep(3)
# Update status on completion
status_placeholder.markdown('<span class="status-indicator status-complete">Complete</span>', unsafe_allow_html=True)
# Example of triggering the process (you would integrate this with your actual logic)
if st.button("Start Mapping"):
run_mapping_process()
# --- Navigation (Keep your existing navigation setup) ---
type_text_page = st.Page(
page="pages/type_text.py",
title="DEMO (work in progress)",
icon=":material/keyboard:",
default=True,
)
# --- NAVIGATION SETUP ---
pg = st.navigation(pages=[type_text_page]) # WITHOUT SECTIONS
pg.run()