Wajahat698 commited on
Commit
9854c22
·
verified ·
1 Parent(s): d4ce59e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -48
app.py CHANGED
@@ -776,62 +776,29 @@ def side():
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
 
 
776
  {"name": "Competence", "color": "rgb(111, 168, 220)"},
777
  ]
778
 
779
+ # Extract bucket names for the selectbox
780
+ bucket_names = [bucket["name"] for bucket in trust_buckets]
781
+
782
+ # Add a dropdown for selecting a Trust Bucket
783
+ selected_bucket = st.selectbox("Select Trust Bucket", bucket_names)
784
+
785
+ # Find the corresponding color for the selected Trust Bucket
786
+ selected_color = next(
787
+ (bucket["color"] for bucket in trust_buckets if bucket["name"] == selected_bucket),
788
+ "black",
789
+ )
790
+
791
+ # Display the selected Trust Bucket with its color
792
  st.markdown(
793
+ f'<p style="font-size: 18px; color: {selected_color};"><strong>Selected Trust Bucket:</strong> {selected_bucket}</p>',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
794
  unsafe_allow_html=True,
795
  )
796
 
 
 
 
 
 
 
 
 
 
 
 
 
 
797
 
798
 
799
  st.subheader("Show My TrustBuilders®")
800
  search_query = st.text_input("Search by keyword", key="search_query")
801
+
 
 
 
 
 
802
 
803
 
804