gvlktejaswi commited on
Commit
aed5108
·
verified ·
1 Parent(s): e5ccfd4

Update page_files/Home.py

Browse files
Files changed (1) hide show
  1. page_files/Home.py +16 -8
page_files/Home.py CHANGED
@@ -25,6 +25,14 @@ if "visible_cards" not in st.session_state:
25
 
26
  VISIBLE_CARDS = st.session_state.visible_cards
27
  prop_count = len([c for c in ALL_CARDS if c[2] == "section"])
 
 
 
 
 
 
 
 
28
 
29
  def get_card_icon(title: str, card_type: str) -> str:
30
  if card_type == "material":
@@ -200,6 +208,14 @@ elif _nav == "search":
200
 
201
 
202
 
 
 
 
 
 
 
 
 
203
  # Helper
204
  def go_categorized(material=None, search=None):
205
  if material:
@@ -514,14 +530,6 @@ st.markdown("""
514
 
515
  # Showcase section - Databricks style
516
 
517
- # Handle navigation via session state — avoids toggle on re-render
518
- if st.session_state.get("_go_extract"):
519
- st.session_state["_go_extract"] = False
520
- st.switch_page("page_files/Upload_Data.py")
521
- if st.session_state.get("_go_search"):
522
- st.session_state["_go_search"] = False
523
- st.switch_page("page_files/Categorized_Search.py")
524
-
525
  st.markdown("""
526
  <style>
527
  .st-key-btn_extract button, .st-key-btn_search button {
 
25
 
26
  VISIBLE_CARDS = st.session_state.visible_cards
27
  prop_count = len([c for c in ALL_CARDS if c[2] == "section"])
28
+ # Navigation via session state — fires before any rendering
29
+ if st.session_state.get("_go_extract"):
30
+ st.session_state["_go_extract"] = False
31
+ st.switch_page("page_files/Upload_Data.py")
32
+ if st.session_state.get("_go_search"):
33
+ st.session_state["_go_search"] = False
34
+ st.switch_page("page_files/Categorized_Search.py")
35
+
36
 
37
  def get_card_icon(title: str, card_type: str) -> str:
38
  if card_type == "material":
 
208
 
209
 
210
 
211
+ # Navigation handler - must be before any rendering
212
+ if st.session_state.get("_go_extract"):
213
+ st.session_state["_go_extract"] = False
214
+ st.switch_page("page_files/Upload_Data.py")
215
+ if st.session_state.get("_go_search"):
216
+ st.session_state["_go_search"] = False
217
+ st.switch_page("page_files/Categorized_Search.py")
218
+
219
  # Helper
220
  def go_categorized(material=None, search=None):
221
  if material:
 
530
 
531
  # Showcase section - Databricks style
532
 
 
 
 
 
 
 
 
 
533
  st.markdown("""
534
  <style>
535
  .st-key-btn_extract button, .st-key-btn_search button {