Spaces:
Running
Running
Standardize button styling throughout the app
Browse files
app.py
CHANGED
@@ -1206,6 +1206,43 @@ with main_tab1:
|
|
1206 |
if 'sample_document_processed' not in st.session_state:
|
1207 |
st.session_state.sample_document_processed = False
|
1208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1209 |
# Use uploaded_file or sample_document if available
|
1210 |
if 'sample_document' in st.session_state and st.session_state.sample_document is not None:
|
1211 |
# Use the sample document
|
@@ -1246,17 +1283,7 @@ with main_tab1:
|
|
1246 |
|
1247 |
# Process button - flush left with similar padding as file browser
|
1248 |
with left_col:
|
1249 |
-
#
|
1250 |
-
st.markdown("""
|
1251 |
-
<style>
|
1252 |
-
/* Ensure primary buttons stay blue */
|
1253 |
-
button[data-testid="baseButton-primary"] {
|
1254 |
-
background-color: rgb(19, 119, 187) !important;
|
1255 |
-
color: rgb(255, 255, 255) !important;
|
1256 |
-
border-color: rgb(19, 119, 187) !important;
|
1257 |
-
}
|
1258 |
-
</style>
|
1259 |
-
""", unsafe_allow_html=True)
|
1260 |
|
1261 |
# Make the button more clear about its function
|
1262 |
if st.session_state.processed_document_active:
|
@@ -2077,71 +2104,14 @@ with main_tab1:
|
|
2077 |
# Set processed_document_active to True when a new document is processed
|
2078 |
st.session_state.processed_document_active = True
|
2079 |
|
2080 |
-
#
|
2081 |
-
st.markdown("""
|
2082 |
-
<style>
|
2083 |
-
/* Apply to all Streamlit buttons to maintain consistent styling */
|
2084 |
-
button[data-testid="baseButton-secondary"],
|
2085 |
-
button[data-testid="baseButton-primary"] {
|
2086 |
-
opacity: 1 !important;
|
2087 |
-
}
|
2088 |
-
|
2089 |
-
/* Fix for buttons turning white after clicking */
|
2090 |
-
.stButton button:active,
|
2091 |
-
.stButton button:focus,
|
2092 |
-
.stButton button:hover {
|
2093 |
-
opacity: 0.8 !important;
|
2094 |
-
color: inherit !important;
|
2095 |
-
background-color: inherit !important;
|
2096 |
-
border-color: inherit !important;
|
2097 |
-
}
|
2098 |
-
|
2099 |
-
/* Close button specific styling */
|
2100 |
-
.close-button {
|
2101 |
-
background-color: #e7e7e7 !important;
|
2102 |
-
color: #666 !important;
|
2103 |
-
border: none !important;
|
2104 |
-
border-radius: 4px !important;
|
2105 |
-
padding: 0.25rem 0.5rem !important;
|
2106 |
-
font-size: 0.8rem !important;
|
2107 |
-
cursor: pointer !important;
|
2108 |
-
transition: all 0.2s ease !important;
|
2109 |
-
}
|
2110 |
-
.close-button:hover {
|
2111 |
-
background-color: #d7d7d7 !important;
|
2112 |
-
color: #333 !important;
|
2113 |
-
}
|
2114 |
-
</style>
|
2115 |
-
""", unsafe_allow_html=True)
|
2116 |
|
2117 |
# Display success message with close button for dismissing processed documents
|
2118 |
success_cols = st.columns([5, 1])
|
2119 |
with success_cols[0]:
|
2120 |
metadata_placeholder.success("**Document processed successfully**")
|
2121 |
with success_cols[1]:
|
2122 |
-
#
|
2123 |
-
st.markdown("""
|
2124 |
-
<style>
|
2125 |
-
/* Style for the Close Document button */
|
2126 |
-
div[data-testid="stButton"] button[kind="secondary"] {
|
2127 |
-
background-color: #f8f9fa !important;
|
2128 |
-
border: 1px solid #dee2e6 !important;
|
2129 |
-
padding: 0.25rem 0.5rem !important;
|
2130 |
-
font-size: 0.875rem !important;
|
2131 |
-
border-radius: 0.2rem !important;
|
2132 |
-
color: #333333 !important;
|
2133 |
-
}
|
2134 |
-
|
2135 |
-
/* Maintain styling on hover/focus/active states */
|
2136 |
-
div[data-testid="stButton"] button[kind="secondary"]:hover,
|
2137 |
-
div[data-testid="stButton"] button[kind="secondary"]:focus,
|
2138 |
-
div[data-testid="stButton"] button[kind="secondary"]:active {
|
2139 |
-
background-color: #e9ecef !important;
|
2140 |
-
border-color: #dee2e6 !important;
|
2141 |
-
color: #333333 !important;
|
2142 |
-
}
|
2143 |
-
</style>
|
2144 |
-
""", unsafe_allow_html=True)
|
2145 |
|
2146 |
if st.button("✕ Close Document", key="close_document_button", help="Clear current document and start over"):
|
2147 |
# Clear the session state
|
@@ -2403,26 +2373,7 @@ with main_tab1:
|
|
2403 |
if selected_sample > 0:
|
2404 |
selected_url = sample_urls[selected_sample]
|
2405 |
|
2406 |
-
#
|
2407 |
-
st.markdown("""
|
2408 |
-
<style>
|
2409 |
-
/* Ensure primary buttons stay blue even after clicking */
|
2410 |
-
button[data-testid="baseButton-primary"] {
|
2411 |
-
background-color: rgb(19, 119, 187) !important;
|
2412 |
-
color: rgb(255, 255, 255) !important;
|
2413 |
-
border-color: rgb(19, 119, 187) !important;
|
2414 |
-
}
|
2415 |
-
|
2416 |
-
/* Maintain styling on hover/focus/active states */
|
2417 |
-
button[data-testid="baseButton-primary"]:hover,
|
2418 |
-
button[data-testid="baseButton-primary"]:focus,
|
2419 |
-
button[data-testid="baseButton-primary"]:active {
|
2420 |
-
background-color: rgba(19, 119, 187, 0.8) !important;
|
2421 |
-
color: rgb(255, 255, 255) !important;
|
2422 |
-
border-color: rgb(19, 119, 187) !important;
|
2423 |
-
}
|
2424 |
-
</style>
|
2425 |
-
""", unsafe_allow_html=True)
|
2426 |
|
2427 |
# Add process button for the sample document
|
2428 |
if st.button("Load Sample Document"):
|
|
|
1206 |
if 'sample_document_processed' not in st.session_state:
|
1207 |
st.session_state.sample_document_processed = False
|
1208 |
|
1209 |
+
# Add global CSS to ensure consistent button styling throughout the app
|
1210 |
+
st.markdown("""
|
1211 |
+
<style>
|
1212 |
+
/* Standard styling for all primary buttons (blue) */
|
1213 |
+
button[data-testid="baseButton-primary"] {
|
1214 |
+
background-color: rgb(19, 119, 187) !important;
|
1215 |
+
color: rgb(255, 255, 255) !important;
|
1216 |
+
border-color: rgb(19, 119, 187) !important;
|
1217 |
+
}
|
1218 |
+
|
1219 |
+
/* Hover/focus/active states for primary buttons */
|
1220 |
+
button[data-testid="baseButton-primary"]:hover,
|
1221 |
+
button[data-testid="baseButton-primary"]:focus,
|
1222 |
+
button[data-testid="baseButton-primary"]:active {
|
1223 |
+
background-color: rgba(19, 119, 187, 0.8) !important;
|
1224 |
+
color: rgb(255, 255, 255) !important;
|
1225 |
+
border-color: rgb(19, 119, 187) !important;
|
1226 |
+
}
|
1227 |
+
|
1228 |
+
/* Standard styling for all secondary buttons (gray) */
|
1229 |
+
button[data-testid="baseButton-secondary"] {
|
1230 |
+
background-color: #f8f9fa !important;
|
1231 |
+
border: 1px solid #dee2e6 !important;
|
1232 |
+
color: #333333 !important;
|
1233 |
+
}
|
1234 |
+
|
1235 |
+
/* Hover/focus/active states for secondary buttons */
|
1236 |
+
button[data-testid="baseButton-secondary"]:hover,
|
1237 |
+
button[data-testid="baseButton-secondary"]:focus,
|
1238 |
+
button[data-testid="baseButton-secondary"]:active {
|
1239 |
+
background-color: #e9ecef !important;
|
1240 |
+
border-color: #dee2e6 !important;
|
1241 |
+
color: #333333 !important;
|
1242 |
+
}
|
1243 |
+
</style>
|
1244 |
+
""", unsafe_allow_html=True)
|
1245 |
+
|
1246 |
# Use uploaded_file or sample_document if available
|
1247 |
if 'sample_document' in st.session_state and st.session_state.sample_document is not None:
|
1248 |
# Use the sample document
|
|
|
1283 |
|
1284 |
# Process button - flush left with similar padding as file browser
|
1285 |
with left_col:
|
1286 |
+
# Process button styling is now handled by global CSS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1287 |
|
1288 |
# Make the button more clear about its function
|
1289 |
if st.session_state.processed_document_active:
|
|
|
2104 |
# Set processed_document_active to True when a new document is processed
|
2105 |
st.session_state.processed_document_active = True
|
2106 |
|
2107 |
+
# Button styling is now handled by global CSS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2108 |
|
2109 |
# Display success message with close button for dismissing processed documents
|
2110 |
success_cols = st.columns([5, 1])
|
2111 |
with success_cols[0]:
|
2112 |
metadata_placeholder.success("**Document processed successfully**")
|
2113 |
with success_cols[1]:
|
2114 |
+
# Close button styling is now handled by global CSS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2115 |
|
2116 |
if st.button("✕ Close Document", key="close_document_button", help="Clear current document and start over"):
|
2117 |
# Clear the session state
|
|
|
2373 |
if selected_sample > 0:
|
2374 |
selected_url = sample_urls[selected_sample]
|
2375 |
|
2376 |
+
# Load Sample Document button styling is now handled by global CSS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2377 |
|
2378 |
# Add process button for the sample document
|
2379 |
if st.button("Load Sample Document"):
|