Update app.py
Browse files
app.py
CHANGED
@@ -1,42 +1,59 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Set page config
|
4 |
-
st.set_page_config(page_title="
|
5 |
-
|
6 |
-
#
|
7 |
-
|
8 |
-
<
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
background-color: white !important;
|
17 |
-
border-radius: 4px !important;
|
18 |
-
box-shadow: 0 0 10px rgba(0,0,0,0.15) !important;
|
19 |
-
}
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
# Your regular Streamlit app content
|
30 |
-
st.title("App with Fixed Status Widget")
|
31 |
-
st.write("Scroll down to
|
32 |
|
33 |
-
# Generate content for scrolling
|
34 |
for i in range(30):
|
35 |
st.write(f"Testing content line {i}")
|
36 |
if i % 10 == 0:
|
37 |
st.markdown("### Section Break")
|
38 |
|
39 |
-
|
40 |
# --- SHARED ON ALL PAGES ---
|
41 |
st.logo(image="images/menu_book_60dp_75FBFD.png")
|
42 |
st.sidebar.title("SBS V2.0 mapper")
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Set page config
|
4 |
+
st.set_page_config(page_title="JavaScript Status Widget Fix", layout="wide")
|
5 |
+
|
6 |
+
# JavaScript approach to fix the status widget position
|
7 |
+
js_code = """
|
8 |
+
<script>
|
9 |
+
// Function to fix the position of the status widget
|
10 |
+
function fixStatusWidget() {
|
11 |
+
// Try to find the status widget using different possible selectors
|
12 |
+
const statusWidget =
|
13 |
+
document.querySelector('[data-testid="stStatusWidget"]') ||
|
14 |
+
document.querySelector('.stStatusWidget') ||
|
15 |
+
document.querySelector('button[kind="formSubmit"]').closest('div').closest('div');
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
if (statusWidget) {
|
18 |
+
// Set fixed positioning
|
19 |
+
statusWidget.style.position = 'fixed';
|
20 |
+
statusWidget.style.top = '10px';
|
21 |
+
statusWidget.style.right = '10px';
|
22 |
+
statusWidget.style.zIndex = '1000000';
|
23 |
+
statusWidget.style.backgroundColor = 'white';
|
24 |
+
statusWidget.style.borderRadius = '4px';
|
25 |
+
statusWidget.style.boxShadow = '0 0 10px rgba(0,0,0,0.2)';
|
26 |
+
statusWidget.style.padding = '4px';
|
27 |
+
console.log('Status widget positioned successfully');
|
28 |
+
} else {
|
29 |
+
console.log('Status widget not found, will retry');
|
30 |
}
|
31 |
+
}
|
32 |
+
|
33 |
+
// Try to fix the widget immediately
|
34 |
+
fixStatusWidget();
|
35 |
+
|
36 |
+
// Also run after a delay to make sure the DOM is fully loaded
|
37 |
+
setTimeout(fixStatusWidget, 1000);
|
38 |
+
|
39 |
+
// Continue checking periodically in case the widget gets recreated
|
40 |
+
setInterval(fixStatusWidget, 2000);
|
41 |
+
</script>
|
42 |
+
"""
|
43 |
+
|
44 |
+
# Inject the JavaScript
|
45 |
+
st.components.v1.html(js_code, height=0)
|
46 |
|
47 |
# Your regular Streamlit app content
|
48 |
+
st.title("App with JavaScript-Fixed Status Widget")
|
49 |
+
st.write("Scroll down to see if the status widget stays fixed")
|
50 |
|
51 |
+
# Generate content for scrolling test
|
52 |
for i in range(30):
|
53 |
st.write(f"Testing content line {i}")
|
54 |
if i % 10 == 0:
|
55 |
st.markdown("### Section Break")
|
56 |
|
|
|
57 |
# --- SHARED ON ALL PAGES ---
|
58 |
st.logo(image="images/menu_book_60dp_75FBFD.png")
|
59 |
st.sidebar.title("SBS V2.0 mapper")
|