lanna_lalala;- commited on
Commit ·
fdb7966
1
Parent(s): 97ef44b
lesson css try
Browse files- phase/Student_view/lesson.py +163 -43
phase/Student_view/lesson.py
CHANGED
|
@@ -260,51 +260,171 @@ def _fallback_text(title: str, module_id: int, topic_ordinal: int) -> str:
|
|
| 260 |
def _render_catalog():
|
| 261 |
st.header("Financial Education")
|
| 262 |
st.caption("Build your financial knowledge with structured paths for every skill level.")
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
for i, mod in enumerate(MODULES_META[level]):
|
| 268 |
with cols[i % 2]:
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
<
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
<
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
|
| 309 |
def _get_topics(level: str, module_id: int) -> List[Tuple[str, str]]:
|
| 310 |
"""
|
|
|
|
| 260 |
def _render_catalog():
|
| 261 |
st.header("Financial Education")
|
| 262 |
st.caption("Build your financial knowledge with structured paths for every skill level.")
|
| 263 |
+
|
| 264 |
+
# Custom CSS for card styling
|
| 265 |
+
st.markdown("""
|
| 266 |
+
<style>
|
| 267 |
+
.card {
|
| 268 |
+
background: white;
|
| 269 |
+
padding: 1.5rem;
|
| 270 |
+
border-radius: 12px;
|
| 271 |
+
border: 1px solid #e1e5e9;
|
| 272 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
| 273 |
+
margin-bottom: 1rem;
|
| 274 |
+
height: 100%;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
.card-header {
|
| 278 |
+
display: flex;
|
| 279 |
+
justify-content: space-between;
|
| 280 |
+
align-items: flex-start;
|
| 281 |
+
margin-bottom: 1rem;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
.level-badge {
|
| 285 |
+
background: #f8f9fa;
|
| 286 |
+
color: #6c757d;
|
| 287 |
+
padding: 0.25rem 0.75rem;
|
| 288 |
+
border-radius: 20px;
|
| 289 |
+
font-size: 0.875rem;
|
| 290 |
+
font-weight: 500;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
.card-icon {
|
| 294 |
+
font-size: 1.5rem;
|
| 295 |
+
color: #28a745;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
.card-title {
|
| 299 |
+
font-size: 1.25rem;
|
| 300 |
+
font-weight: 600;
|
| 301 |
+
color: #212529;
|
| 302 |
+
margin: 0.5rem 0;
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
.card-description {
|
| 306 |
+
color: #6c757d;
|
| 307 |
+
font-size: 0.95rem;
|
| 308 |
+
line-height: 1.4;
|
| 309 |
+
margin-bottom: 1rem;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
.card-meta {
|
| 313 |
+
display: flex;
|
| 314 |
+
justify-content: space-between;
|
| 315 |
+
align-items: center;
|
| 316 |
+
margin: 1rem 0;
|
| 317 |
+
color: #6c757d;
|
| 318 |
+
font-size: 0.875rem;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
.meta-item {
|
| 322 |
+
display: flex;
|
| 323 |
+
align-items: center;
|
| 324 |
+
gap: 0.25rem;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
.learn-section {
|
| 328 |
+
margin: 1rem 0;
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
.learn-title {
|
| 332 |
+
font-size: 0.75rem;
|
| 333 |
+
font-weight: 600;
|
| 334 |
+
color: #6c757d;
|
| 335 |
+
text-transform: uppercase;
|
| 336 |
+
letter-spacing: 0.5px;
|
| 337 |
+
margin-bottom: 0.5rem;
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
.learn-item {
|
| 341 |
+
color: #28a745;
|
| 342 |
+
font-size: 0.9rem;
|
| 343 |
+
margin-bottom: 0.25rem;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
.primary-button {
|
| 347 |
+
background: #28a745 !important;
|
| 348 |
+
color: white !important;
|
| 349 |
+
border: none !important;
|
| 350 |
+
border-radius: 6px !important;
|
| 351 |
+
padding: 0.75rem 1.5rem !important;
|
| 352 |
+
font-weight: 500 !important;
|
| 353 |
+
width: 100% !important;
|
| 354 |
+
margin-top: 1rem !important;
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
.secondary-button {
|
| 358 |
+
background: #f8f9fa !important;
|
| 359 |
+
color: #495057 !important;
|
| 360 |
+
border: 1px solid #dee2e6 !important;
|
| 361 |
+
border-radius: 6px !important;
|
| 362 |
+
padding: 0.75rem 1.5rem !important;
|
| 363 |
+
font-weight: 500 !important;
|
| 364 |
+
width: 100% !important;
|
| 365 |
+
margin-top: 1rem !important;
|
| 366 |
+
}
|
| 367 |
+
</style>
|
| 368 |
+
""", unsafe_allow_html=True)
|
| 369 |
+
|
| 370 |
+
level = st.session_state.get("level", "beginner")
|
| 371 |
+
|
| 372 |
+
# Create columns for cards
|
| 373 |
+
cols = st.columns(2, gap="large")
|
| 374 |
+
|
| 375 |
for i, mod in enumerate(MODULES_META[level]):
|
| 376 |
with cols[i % 2]:
|
| 377 |
+
# Create card container
|
| 378 |
+
with st.container():
|
| 379 |
+
st.markdown(f"""
|
| 380 |
+
<div class="card">
|
| 381 |
+
<div class="card-header">
|
| 382 |
+
<span class="level-badge">{mod['difficulty']}</span>
|
| 383 |
+
<span class="card-icon">{mod['icon']}</span>
|
| 384 |
+
</div>
|
| 385 |
+
|
| 386 |
+
<h3 class="card-title">{mod['title']}</h3>
|
| 387 |
+
<p class="card-description">{mod['description']}</p>
|
| 388 |
+
|
| 389 |
+
<div class="card-meta">
|
| 390 |
+
<div class="meta-item">
|
| 391 |
+
<span>🕒</span>
|
| 392 |
+
<span>{mod['duration']}</span>
|
| 393 |
+
</div>
|
| 394 |
+
|
| 395 |
+
</div>
|
| 396 |
+
|
| 397 |
+
<div class="learn-section">
|
| 398 |
+
<div class="learn-title">YOU'LL LEARN</div>
|
| 399 |
+
""", unsafe_allow_html=True)
|
| 400 |
+
|
| 401 |
+
# Add learning objectives
|
| 402 |
+
for topic in mod['topics']:
|
| 403 |
+
st.markdown(f'<div class="learn-item">• {topic}</div>', unsafe_allow_html=True)
|
| 404 |
+
|
| 405 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
| 406 |
+
|
| 407 |
+
# Keep the expander as requested
|
| 408 |
+
with st.expander("📋 All Topics"):
|
| 409 |
+
for topic in mod['topics']:
|
| 410 |
+
st.write(f"• {topic}")
|
| 411 |
+
|
| 412 |
+
# Action button
|
| 413 |
+
button_class = mod.get('button_style', 'primary')
|
| 414 |
+
button_text = "Start Learning" if button_class == 'primary' else "Review Module"
|
| 415 |
+
|
| 416 |
+
if st.button(
|
| 417 |
+
f"{button_text} →",
|
| 418 |
+
key=f"start_{level}_{mod['id']}",
|
| 419 |
+
help=f"Begin the {mod['title']} module"
|
| 420 |
+
):
|
| 421 |
+
# Your existing button logic here
|
| 422 |
+
st.session_state.module_id = mod["id"]
|
| 423 |
+
st.session_state.topic_idx = 0
|
| 424 |
+
st.session_state.mode = "lesson"
|
| 425 |
+
st.rerun()
|
| 426 |
+
|
| 427 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
| 428 |
|
| 429 |
def _get_topics(level: str, module_id: int) -> List[Tuple[str, str]]:
|
| 430 |
"""
|