File size: 4,246 Bytes
25eb2b4
53dcb25
7b883db
 
 
a2e01d2
 
 
7b883db
 
 
a2e01d2
866bcb2
 
da577a7
 
7b883db
a2e01d2
 
 
 
 
da577a7
 
 
f93ba69
 
a2e01d2
 
 
da577a7
3a2e61d
da577a7
f93ba69
3a2e61d
a2e01d2
3a2e61d
a2e01d2
3a2e61d
 
a2e01d2
 
3a2e61d
a2e01d2
3a2e61d
 
da577a7
 
 
 
 
 
 
 
 
 
 
 
 
 
1c7dd78
866bcb2
 
a2e01d2
122a897
a2e01d2
 
 
7b883db
122a897
a2e01d2
122a897
 
 
f93ba69
a2e01d2
 
 
7b883db
e97685c
122a897
f93ba69
7b883db
 
f4ae373
 
 
a2e01d2
f93ba69
 
f4ae373
 
 
f93ba69
7b883db
a2e01d2
 
7b883db
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
88
89
90
91
92
93
94
95
96
97
98
99
import streamlit as st

# --- Page Configuration ---
# This sets the title and icon that appear in the default header
st.set_page_config(
    page_title="SBS V2.0 mapper", # This title will appear in the sticky header
    # Use the logo image here if you want it in the header (optional)
    # page_icon="images/menu_book_60dp_75FBFD.png",
    layout="wide" # Optional: Use wide layout
)

# --- Custom CSS for Sticky Default Header ---
st.markdown("""
<style>
    /* Target the default Streamlit header element */
    /* This is typically the <header> tag containing the title, menu, and status */
    header {
        position: sticky; /* Use sticky positioning */
        top: 0px;         /* Stick to the top edge */
        z-index: 999;     /* Ensure the header is always on top */
        background-color: rgb(255, 255, 255); /* Use white background or match Streamlit's default header color */
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Add shadow for better visibility */
        /* Ensure no conflicting height/overflow properties that might break sticky */
        height: auto; /* Allow height to adjust based on content */
        overflow: visible; /* Prevent content inside header from being clipped */
    }

    /* Add padding to the main content area to prevent it from starting behind the sticky header */
    /* This targets the main container div where your app content and pages are rendered */
    /* The exact value might need slight adjustment based on the header's actual height */
    /* Inspect the deployed app to confirm the header height and adjust padding-top accordingly */
    [data-testid="stAppViewContainer"] {
        padding-top: 60px; /* Estimate header height (~60px). Adjust if needed after inspection. */
    }

    /* Adjust padding for the sidebar content as well */
     [data-testid="stSidebar"] {
         padding-top: 60px; /* Use the same padding value as the main content */
     }

    /* Ensure the main content block within the container also has correct top padding */
    /* This might be necessary for correct spacing below the header */
    .main .block-container {
        padding-top: 1rem; /* Keep or adjust default Streamlit content padding */
    }

    /* If the above 'header' sticky rule still doesn't work for the main scrollbar
       after adjusting padding-top, it strongly indicates a parent element issue.
       You would need to use browser dev tools to find which parent is breaking it
       and potentially try applying sticky to that parent, but that is more complex.
       For example, if a div wrapping the header and main content had overflow: auto:
       div[data-testid="some-parent-container"] {
           position: sticky;
           top: 0;
           z-index: 998; // Lower z-index than the header
           background: white;
       }
       This is hypothetical and requires DOM inspection.
    */

</style>
""", unsafe_allow_html=True)

# --- App Content (will scroll below the sticky header) ---

# The st.logo call here will place the logo in the sidebar or main body,
# not in the sticky default header. If you want a logo in the header,
# use the page_icon parameter in st.set_page_config above.
st.logo(image="images/menu_book_60dp_75FBFD.png")


st.sidebar.header("SBS V2.0 mapper")
st.sidebar.write("(work in progress)")
st.sidebar.text("Demo by JA-RAD")

# Note: st.title and st.subheader here will appear *below* the sticky header,
# as they are part of the main app content flow. The title in the sticky header
# comes from st.set_page_config.
st.title("Map descriptions to SBS codes with Sentence Transformer + Reasoning")
st.subheader("Select specific Chapter for quicker results")


# --- NAVIGATION SETUP ---
# Keep your existing navigation setup
type_text_page = st.Page(
    page="pages/type_text.py",
    title="DEMO (work in progress)",
    icon=":material/keyboard:", # This icon can appear in the tab/bookmark
    default=True,
)

pg = st.navigation(pages=[type_text_page]) # WITHOUT SECTIONS
pg.run()

# Add some extra content to make the page scrollable for testing
# Remove this loop in your final application if you have enough content already
for i in range(100):
    st.write(f"This is scrollable content line {i}")