sameernotes commited on
Commit
880ba2c
Β·
verified Β·
1 Parent(s): 6f79b32

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +38 -1
src/streamlit_app.py CHANGED
@@ -628,7 +628,7 @@ def display_all_papers(search_term=""):
628
  continue
629
 
630
  with st.expander(f"πŸ“„ {paper_name}", expanded=False):
631
- display_paper_content(paper_data, search_term)
632
 
633
  def display_single_paper(paper_name, selected_unit="All Units", search_term=""):
634
  """Display a single paper with optional unit filtering"""
@@ -643,6 +643,43 @@ def display_single_paper(paper_name, selected_unit="All Units", search_term=""):
643
  unit_data = {selected_unit: paper_data[selected_unit]}
644
  display_paper_content(unit_data, search_term)
645
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
646
  def display_paper_content(paper_data, search_term=""):
647
  """Display content of a paper"""
648
  for unit_name, unit_data in paper_data.items():
 
628
  continue
629
 
630
  with st.expander(f"πŸ“„ {paper_name}", expanded=False):
631
+ display_paper_content_no_expander(paper_data, search_term)
632
 
633
  def display_single_paper(paper_name, selected_unit="All Units", search_term=""):
634
  """Display a single paper with optional unit filtering"""
 
643
  unit_data = {selected_unit: paper_data[selected_unit]}
644
  display_paper_content(unit_data, search_term)
645
 
646
+ def display_paper_content_no_expander(paper_data, search_term=""):
647
+ """Display content of a paper without nested expanders"""
648
+ for unit_name, unit_data in paper_data.items():
649
+ # Check if unit matches search
650
+ if search_term and not matches_search_unit(unit_name, unit_data, search_term):
651
+ continue
652
+
653
+ st.markdown(f"""
654
+ <div class="unit-card">
655
+ <h3>πŸ“š {unit_name}</h3>
656
+ </div>
657
+ """, unsafe_allow_html=True)
658
+
659
+ for topic_name, topic_items in unit_data.items():
660
+ # Check if topic matches search
661
+ if search_term and not matches_search_topic(topic_name, topic_items, search_term):
662
+ continue
663
+
664
+ st.markdown(f"**πŸ“– {topic_name}**")
665
+ for item in topic_items:
666
+ # Highlight search terms
667
+ if search_term and search_term.lower() in item.lower():
668
+ highlighted_item = item.replace(
669
+ search_term,
670
+ f"**{search_term}**"
671
+ )
672
+ st.markdown(f"""
673
+ <div class="topic-item">
674
+ β€’ {highlighted_item}
675
+ </div>
676
+ """, unsafe_allow_html=True)
677
+ else:
678
+ st.markdown(f"""
679
+ <div class="topic-item">
680
+ β€’ {item}
681
+ </div>
682
+ """, unsafe_allow_html=True)
683
  def display_paper_content(paper_data, search_term=""):
684
  """Display content of a paper"""
685
  for unit_name, unit_data in paper_data.items():