File size: 2,614 Bytes
25eb2b4 f93ba69 53dcb25 f93ba69 866bcb2 f93ba69 1c7dd78 866bcb2 f93ba69 7deb7e8 f93ba69 122a897 f93ba69 122a897 f93ba69 122a897 f93ba69 e97685c 122a897 f93ba69 f4ae373 f93ba69 f4ae373 f93ba69 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
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()
|