lanna_lalala;- commited on
Commit
90985ea
·
1 Parent(s): fc82d73

lesson css try

Browse files
Files changed (1) hide show
  1. phase/Student_view/lesson.py +9 -21
phase/Student_view/lesson.py CHANGED
@@ -375,32 +375,20 @@ def _render_catalog():
375
  for topic in mod['topics']:
376
  st.write(f"• {topic}")
377
 
378
- # Dynamic button styling based on completion
379
- is_completed = mod.get("completed", False)
380
- btn_label = "Review Module →" if is_completed else "Start Learning →"
381
- btn_style = "secondary-button" if is_completed else "primary-button"
382
-
383
- # Create unique key
384
- btn_key = f"start_{level}_{mod['id']}"
385
 
386
- # Render button with custom style
387
- st.markdown(f"""
388
- <form action="#">
389
- <button class="{btn_style}" type="submit">{btn_label}</button>
390
- </form>
391
- """, unsafe_allow_html=True)
392
-
393
- # Actual hidden Streamlit button to handle clicks
394
- if st.button("Start Learning", key=btn_key, help=f"start_{level}_{mod['id']}"):
395
- st.session_state.topics_cache.pop((level, mod["id"]), None)
396
- try:
397
- st.cache_data.clear()
398
- except Exception:
399
- pass
400
  st.session_state.module_id = mod["id"]
401
  st.session_state.topic_idx = 0
402
  st.session_state.mode = "lesson"
403
  st.rerun()
 
 
404
 
405
  st.markdown("</div>", unsafe_allow_html=True)
406
 
 
375
  for topic in mod['topics']:
376
  st.write(f"• {topic}")
377
 
378
+ button_class = mod.get('button_style', 'primary')
379
+ button_text = "Start Learning" if button_class == 'primary' else "Review Module"
 
 
 
 
 
380
 
381
+ if st.button(
382
+ f"{button_text} →",
383
+ key=f"start_{level}_{mod['id']}",
384
+ help=f"Begin the {mod['title']} module"
385
+ ):
 
 
 
 
 
 
 
 
 
386
  st.session_state.module_id = mod["id"]
387
  st.session_state.topic_idx = 0
388
  st.session_state.mode = "lesson"
389
  st.rerun()
390
+
391
+ st.markdown("</div>", unsafe_allow_html=True)
392
 
393
  st.markdown("</div>", unsafe_allow_html=True)
394