Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -768,79 +768,71 @@ def side():
|
|
| 768 |
|
| 769 |
|
| 770 |
trust_buckets = [
|
| 771 |
-
"Stability",
|
| 772 |
-
"Development",
|
| 773 |
-
"Relationship",
|
| 774 |
-
"Benefit",
|
| 775 |
-
"Vision",
|
| 776 |
-
"Competence",
|
| 777 |
]
|
| 778 |
|
| 779 |
-
#
|
| 780 |
-
|
| 781 |
-
"
|
| 782 |
-
|
| 783 |
-
|
| 784 |
-
|
| 785 |
-
|
| 786 |
-
|
| 787 |
-
|
| 788 |
-
|
| 789 |
-
|
| 790 |
-
def get_base64(file_path):
|
| 791 |
-
try:
|
| 792 |
-
with open(file_path, "rb") as f:
|
| 793 |
-
return base64.b64encode(f.read()).decode()
|
| 794 |
-
except FileNotFoundError:
|
| 795 |
-
st.error(f"File not found: {file_path}")
|
| 796 |
-
return ""
|
| 797 |
-
|
| 798 |
-
# Generate HTML for dropdown
|
| 799 |
-
dropdown_html = """
|
| 800 |
-
<style>
|
| 801 |
-
.custom-dropdown {
|
| 802 |
-
width: 100%;
|
| 803 |
-
max-width: 400px;
|
| 804 |
-
margin: 10px auto;
|
| 805 |
-
font-family: Arial, sans-serif;
|
| 806 |
}
|
| 807 |
-
.
|
| 808 |
-
|
| 809 |
-
align-items: center;
|
| 810 |
-
padding: 10px;
|
| 811 |
font-size: 16px;
|
|
|
|
|
|
|
|
|
|
| 812 |
}
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
|
| 816 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 817 |
|
|
|
|
|
|
|
|
|
|
| 818 |
for bucket in trust_buckets:
|
| 819 |
-
|
| 820 |
-
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
<option style="background-image: url('data:image/png;base64,{encoded_img}');
|
| 824 |
-
background-repeat: no-repeat;
|
| 825 |
-
background-size: 20px 20px;
|
| 826 |
-
background-position: left center;
|
| 827 |
-
padding-left: 40px;">
|
| 828 |
-
{bucket}
|
| 829 |
-
</option>
|
| 830 |
-
"""
|
| 831 |
-
else:
|
| 832 |
-
dropdown_html += f"<option>{bucket}</option>"
|
| 833 |
|
| 834 |
-
|
| 835 |
-
|
| 836 |
-
|
| 837 |
-
"""
|
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
st.subheader("Show My TrustBuilders®")
|
| 842 |
search_query = st.text_input("Search by keyword", key="search_query")
|
| 843 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 844 |
|
| 845 |
|
| 846 |
|
|
|
|
| 768 |
|
| 769 |
|
| 770 |
trust_buckets = [
|
| 771 |
+
{"name": "Stability", "color": "rgb(7, 55, 99)"},
|
| 772 |
+
{"name": "Development", "color": "rgb(241, 194, 50)"},
|
| 773 |
+
{"name": "Relationship", "color": "rgb(204, 0, 0)"},
|
| 774 |
+
{"name": "Benefit", "color": "rgb(56, 118, 29)"},
|
| 775 |
+
{"name": "Vision", "color": "rgb(255, 153, 0)"},
|
| 776 |
+
{"name": "Competence", "color": "rgb(111, 168, 220)"},
|
| 777 |
]
|
| 778 |
|
| 779 |
+
# Inject CSS styles for the scrollable dropdown
|
| 780 |
+
st.markdown(
|
| 781 |
+
"""
|
| 782 |
+
<style>
|
| 783 |
+
.scrollable-dropdown {
|
| 784 |
+
max-height: 200px;
|
| 785 |
+
overflow-y: auto;
|
| 786 |
+
border: 1px solid #ccc;
|
| 787 |
+
border-radius: 5px;
|
| 788 |
+
padding: 5px;
|
| 789 |
+
background-color: #f9f9f9;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 790 |
}
|
| 791 |
+
.dropdown-item {
|
| 792 |
+
padding: 8px 12px;
|
|
|
|
|
|
|
| 793 |
font-size: 16px;
|
| 794 |
+
font-weight: bold;
|
| 795 |
+
cursor: pointer;
|
| 796 |
+
border-bottom: 1px solid #ddd;
|
| 797 |
}
|
| 798 |
+
.dropdown-item:hover {
|
| 799 |
+
background-color: #e6f7ff;
|
| 800 |
+
}
|
| 801 |
+
.stability { color: rgb(7, 55, 99); }
|
| 802 |
+
.development { color: rgb(241, 194, 50); }
|
| 803 |
+
.relationship { color: rgb(204, 0, 0); }
|
| 804 |
+
.benefit { color: rgb(56, 118, 29); }
|
| 805 |
+
.vision { color: rgb(255, 153, 0); }
|
| 806 |
+
.competence { color: rgb(111, 168, 220); }
|
| 807 |
+
</style>
|
| 808 |
+
""",
|
| 809 |
+
unsafe_allow_html=True,
|
| 810 |
+
)
|
| 811 |
|
| 812 |
+
# Scrollable Dropdown with colored items
|
| 813 |
+
st.markdown('<div class="scrollable-dropdown">', unsafe_allow_html=True)
|
| 814 |
+
selected_bucket = None
|
| 815 |
for bucket in trust_buckets:
|
| 816 |
+
# Display each item with its unique color
|
| 817 |
+
if st.button(bucket["name"], key=bucket["name"]):
|
| 818 |
+
selected_bucket = bucket["name"]
|
| 819 |
+
st.session_state["selected_bucket_color"] = bucket["color"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 820 |
|
| 821 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
| 822 |
+
|
| 823 |
+
|
|
|
|
| 824 |
|
| 825 |
|
| 826 |
|
| 827 |
st.subheader("Show My TrustBuilders®")
|
| 828 |
search_query = st.text_input("Search by keyword", key="search_query")
|
| 829 |
+
if selected_bucket:
|
| 830 |
+
st.markdown(
|
| 831 |
+
f'<p style="font-size: 18px; color: {st.session_state.get("selected_bucket_color", "#000")};">'
|
| 832 |
+
f"<strong>Selected Trust Bucket:</strong> {selected_bucket}</p>",
|
| 833 |
+
unsafe_allow_html=True,
|
| 834 |
+
)
|
| 835 |
+
|
| 836 |
|
| 837 |
|
| 838 |
|