lanna_lalala;- commited on
Commit
1a43d22
·
1 Parent(s): 1ea11f7

lesson css try

Browse files
Files changed (1) hide show
  1. phase/Student_view/lesson.py +3 -88
phase/Student_view/lesson.py CHANGED
@@ -196,32 +196,6 @@ def _fetch_topic_from_backend(level: str, module_id: int, topic_idx: int) -> Tup
196
 
197
  return ui_title, content
198
 
199
- def _extract_takeaways(text: str, max_items: int = 5) -> List[str]:
200
- """Heuristic key-takeaway extractor from raw lesson text."""
201
- if not text:
202
- return []
203
-
204
- # Prefer explicit sections
205
- m = re.search(r"(?mi)^\s*(Key\s*Takeaways?|Summary)\s*[:\n]+(.*)$", text, re.DOTALL)
206
- if m:
207
- body = m.group(2)
208
- lines = [ln.strip(" •-*–\t") for ln in body.splitlines() if ln.strip()]
209
- items = [ln for ln in lines if len(ln) > 3][:max_items]
210
- if items:
211
- return items
212
-
213
- # Otherwise, bullet-ish lines
214
- bullets = [
215
- ln.strip(" •-*–\t")
216
- for ln in text.splitlines()
217
- if ln.strip().startswith(("-", "•", "*", "–")) and len(ln.strip()) > 3
218
- ]
219
- if bullets:
220
- return bullets[:max_items]
221
-
222
- # Fallback: first few sentences
223
- sents = re.split(r"(?<=[.!?])\s+", text.strip())
224
- return [s for s in sents if len(s) > 20][:min(max_items, 3)]
225
 
226
 
227
  def _fallback_text(title: str, module_id: int, topic_ordinal: int) -> str:
@@ -473,35 +447,9 @@ def _render_lesson():
473
  color: #374151;
474
  margin-bottom: 2rem;
475
  }
476
- .takeaways-section {
477
- background: #f9fafb;
478
- border: 1px solid #e5e7eb;
479
- border-radius: 8px;
480
- padding: 1.5rem;
481
- margin-top: 2rem;
482
- }
483
- .takeaways-header {
484
- display: flex;
485
- align-items: center;
486
- gap: 0.5rem;
487
- font-size: 1.125rem;
488
- font-weight: 600;
489
- color: #1f2937;
490
- margin-bottom: 1rem;
491
- }
492
- .takeaway-item {
493
- display: flex;
494
- align-items: flex-start;
495
- gap: 0.75rem;
496
- margin-bottom: 0.75rem;
497
- font-size: 0.95rem;
498
- color: #374151;
499
- }
500
- .takeaway-check {
501
- color: #10b981;
502
- font-size: 1.1rem;
503
- margin-top: 0.1rem;
504
- }
505
  .sidebar-card {
506
  background: white;
507
  border: 1px solid #e5e7eb;
@@ -587,39 +535,6 @@ def _render_lesson():
587
  </div>
588
  """, unsafe_allow_html=True)
589
 
590
- # Key Takeaways
591
- if t_text:
592
- takeaways = _extract_takeaways(t_text)
593
- if takeaways:
594
- takeaways_html = """
595
- <div class="sidebar-card">
596
- <div class="takeaways-section" style="min-height: 150px;">
597
- <div class="takeaways-header">
598
- <span style="color: #10b981;">●</span>
599
- <span>Key Takeaways</span>
600
- </div>
601
- """
602
-
603
- for takeaway in takeaways:
604
- takeaways_html += f"""
605
- <div class="takeaway-item">
606
- <span class="takeaway-check">✓</span>
607
- <span>{takeaway}</span>
608
- </div>
609
- """
610
-
611
- takeaways_html += """
612
- </div>
613
- </div>
614
- """
615
-
616
- st.markdown(takeaways_html, unsafe_allow_html=True)
617
-
618
-
619
-
620
- # Close both divs
621
- st.markdown("</div></div>", unsafe_allow_html=True)
622
-
623
 
624
  # Navigation Buttons OUTSIDE lesson card
625
  st.markdown('<div class="nav-buttons">', unsafe_allow_html=True)
 
196
 
197
  return ui_title, content
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
 
200
 
201
  def _fallback_text(title: str, module_id: int, topic_ordinal: int) -> str:
 
447
  color: #374151;
448
  margin-bottom: 2rem;
449
  }
450
+
451
+
452
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  .sidebar-card {
454
  background: white;
455
  border: 1px solid #e5e7eb;
 
535
  </div>
536
  """, unsafe_allow_html=True)
537
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
 
539
  # Navigation Buttons OUTSIDE lesson card
540
  st.markdown('<div class="nav-buttons">', unsafe_allow_html=True)