Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +60 -282
src/streamlit_app.py
CHANGED
|
@@ -95,86 +95,6 @@ st.markdown("""
|
|
| 95 |
font-family: 'Comic Neue', cursive;
|
| 96 |
}
|
| 97 |
|
| 98 |
-
/* Compact Calculator Styles */
|
| 99 |
-
.calculator-container {
|
| 100 |
-
background: rgba(255, 255, 255, 0.95);
|
| 101 |
-
padding: 15px;
|
| 102 |
-
border-radius: 15px;
|
| 103 |
-
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
| 104 |
-
text-align: center;
|
| 105 |
-
border: 4px solid #FFD93D;
|
| 106 |
-
animation: float 4s ease-in-out infinite;
|
| 107 |
-
margin-bottom: 20px;
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
-
@keyframes float {
|
| 111 |
-
0%, 100% { transform: translateY(0px); }
|
| 112 |
-
50% { transform: translateY(-5px); }
|
| 113 |
-
}
|
| 114 |
-
|
| 115 |
-
.calculator-title {
|
| 116 |
-
margin-bottom: 10px;
|
| 117 |
-
color: #FF6B6B;
|
| 118 |
-
font-family: 'Comic Neue', cursive;
|
| 119 |
-
font-size: 20px;
|
| 120 |
-
text-shadow: 1px 1px 0 #FFD93D;
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
.calculator-display {
|
| 124 |
-
width: 100%;
|
| 125 |
-
padding: 12px;
|
| 126 |
-
margin: 8px 0;
|
| 127 |
-
border-radius: 10px;
|
| 128 |
-
border: 3px solid #4ECDC4;
|
| 129 |
-
text-align: right;
|
| 130 |
-
font-size: 18px;
|
| 131 |
-
font-family: 'Comic Neue', cursive;
|
| 132 |
-
background: #FFF9C4;
|
| 133 |
-
font-weight: bold;
|
| 134 |
-
}
|
| 135 |
-
|
| 136 |
-
.calculator-buttons-compact {
|
| 137 |
-
display: grid;
|
| 138 |
-
grid-template-columns: repeat(4, 1fr);
|
| 139 |
-
gap: 5px;
|
| 140 |
-
margin-top: 10px;
|
| 141 |
-
}
|
| 142 |
-
|
| 143 |
-
.calc-btn {
|
| 144 |
-
padding: 12px 8px;
|
| 145 |
-
border: none;
|
| 146 |
-
border-radius: 8px;
|
| 147 |
-
cursor: pointer;
|
| 148 |
-
font-size: 16px;
|
| 149 |
-
color: white;
|
| 150 |
-
background: linear-gradient(45deg, #4ECDC4, #45B7D1);
|
| 151 |
-
transition: all 0.2s ease;
|
| 152 |
-
font-family: 'Comic Neue', cursive;
|
| 153 |
-
font-weight: bold;
|
| 154 |
-
min-height: 45px;
|
| 155 |
-
}
|
| 156 |
-
|
| 157 |
-
.calc-btn:hover {
|
| 158 |
-
transform: scale(1.05);
|
| 159 |
-
background: linear-gradient(45deg, #45B7D1, #4ECDC4);
|
| 160 |
-
}
|
| 161 |
-
|
| 162 |
-
.calc-btn-clear {
|
| 163 |
-
background: linear-gradient(45deg, #FF6B6B, #FF8E8E);
|
| 164 |
-
}
|
| 165 |
-
|
| 166 |
-
.calc-btn-clear:hover {
|
| 167 |
-
background: linear-gradient(45deg, #FF8E8E, #FF6B6B);
|
| 168 |
-
}
|
| 169 |
-
|
| 170 |
-
.calc-btn-equals {
|
| 171 |
-
background: linear-gradient(45deg, #96CEB4, #4ECDC4);
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
.calc-btn-zero {
|
| 175 |
-
grid-column: span 2;
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
/* Fun elements */
|
| 179 |
.emoji-rain {
|
| 180 |
position: fixed;
|
|
@@ -276,161 +196,25 @@ st.markdown("""
|
|
| 276 |
80% { opacity: 1; }
|
| 277 |
100% { opacity: 0; display: none; }
|
| 278 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
</style>
|
| 280 |
""", unsafe_allow_html=True)
|
| 281 |
|
| 282 |
-
# JavaScript for animations
|
| 283 |
st.markdown("""
|
| 284 |
<script>
|
| 285 |
-
// Calculator functionality - COMPLETELY REWRITTEN
|
| 286 |
-
class Calculator {
|
| 287 |
-
constructor() {
|
| 288 |
-
this.currentInput = '0';
|
| 289 |
-
this.previousInput = '';
|
| 290 |
-
this.operation = null;
|
| 291 |
-
this.resetScreen = false;
|
| 292 |
-
this.initializeCalculator();
|
| 293 |
-
}
|
| 294 |
-
|
| 295 |
-
initializeCalculator() {
|
| 296 |
-
this.updateDisplay();
|
| 297 |
-
this.setupEventListeners();
|
| 298 |
-
}
|
| 299 |
-
|
| 300 |
-
setupEventListeners() {
|
| 301 |
-
// Number buttons
|
| 302 |
-
for (let i = 0; i <= 9; i++) {
|
| 303 |
-
const btn = document.getElementById(`calc-btn-${i}`);
|
| 304 |
-
if (btn) {
|
| 305 |
-
btn.addEventListener('click', () => this.appendNumber(i.toString()));
|
| 306 |
-
}
|
| 307 |
-
}
|
| 308 |
-
|
| 309 |
-
// Operation buttons
|
| 310 |
-
document.getElementById('calc-btn-add')?.addEventListener('click', () => this.chooseOperation('+'));
|
| 311 |
-
document.getElementById('calc-btn-subtract')?.addEventListener('click', () => this.chooseOperation('-'));
|
| 312 |
-
document.getElementById('calc-btn-multiply')?.addEventListener('click', () => this.chooseOperation('*'));
|
| 313 |
-
document.getElementById('calc-btn-divide')?.addEventListener('click', () => this.chooseOperation('/'));
|
| 314 |
-
|
| 315 |
-
// Other buttons
|
| 316 |
-
document.getElementById('calc-btn-equals')?.addEventListener('click', () => this.compute());
|
| 317 |
-
document.getElementById('calc-btn-clear')?.addEventListener('click', () => this.clearCalculator());
|
| 318 |
-
document.getElementById('calc-btn-backspace')?.addEventListener('click', () => this.backspace());
|
| 319 |
-
document.getElementById('calc-btn-decimal')?.addEventListener('click', () => this.appendDecimal());
|
| 320 |
-
}
|
| 321 |
-
|
| 322 |
-
updateDisplay() {
|
| 323 |
-
const display = document.getElementById('calc-display');
|
| 324 |
-
if (display) {
|
| 325 |
-
display.value = this.currentInput;
|
| 326 |
-
}
|
| 327 |
-
}
|
| 328 |
-
|
| 329 |
-
appendNumber(number) {
|
| 330 |
-
if (this.currentInput === '0' || this.resetScreen) {
|
| 331 |
-
this.currentInput = number;
|
| 332 |
-
this.resetScreen = false;
|
| 333 |
-
} else {
|
| 334 |
-
this.currentInput += number;
|
| 335 |
-
}
|
| 336 |
-
this.updateDisplay();
|
| 337 |
-
}
|
| 338 |
-
|
| 339 |
-
chooseOperation(op) {
|
| 340 |
-
if (this.currentInput === '') return;
|
| 341 |
-
|
| 342 |
-
if (this.previousInput !== '') {
|
| 343 |
-
this.compute();
|
| 344 |
-
}
|
| 345 |
-
this.operation = op;
|
| 346 |
-
this.previousInput = this.currentInput;
|
| 347 |
-
this.resetScreen = true;
|
| 348 |
-
}
|
| 349 |
-
|
| 350 |
-
compute() {
|
| 351 |
-
let computation;
|
| 352 |
-
const prev = parseFloat(this.previousInput);
|
| 353 |
-
const current = parseFloat(this.currentInput);
|
| 354 |
-
|
| 355 |
-
if (isNaN(prev) || isNaN(current)) return;
|
| 356 |
-
|
| 357 |
-
switch (this.operation) {
|
| 358 |
-
case '+':
|
| 359 |
-
computation = prev + current;
|
| 360 |
-
break;
|
| 361 |
-
case '-':
|
| 362 |
-
computation = prev - current;
|
| 363 |
-
break;
|
| 364 |
-
case '*':
|
| 365 |
-
computation = prev * current;
|
| 366 |
-
break;
|
| 367 |
-
case '/':
|
| 368 |
-
if (current === 0) {
|
| 369 |
-
this.showError("Cannot divide by zero!");
|
| 370 |
-
return;
|
| 371 |
-
}
|
| 372 |
-
computation = prev / current;
|
| 373 |
-
break;
|
| 374 |
-
default:
|
| 375 |
-
return;
|
| 376 |
-
}
|
| 377 |
-
|
| 378 |
-
this.currentInput = this.roundNumber(computation).toString();
|
| 379 |
-
this.operation = undefined;
|
| 380 |
-
this.previousInput = '';
|
| 381 |
-
this.resetScreen = true;
|
| 382 |
-
this.updateDisplay();
|
| 383 |
-
}
|
| 384 |
-
|
| 385 |
-
roundNumber(num) {
|
| 386 |
-
return Math.round((num + Number.EPSILON) * 100000) / 100000;
|
| 387 |
-
}
|
| 388 |
-
|
| 389 |
-
showError(message) {
|
| 390 |
-
const display = document.getElementById('calc-display');
|
| 391 |
-
if (display) {
|
| 392 |
-
display.value = message;
|
| 393 |
-
setTimeout(() => {
|
| 394 |
-
this.clearCalculator();
|
| 395 |
-
}, 2000);
|
| 396 |
-
}
|
| 397 |
-
}
|
| 398 |
-
|
| 399 |
-
clearCalculator() {
|
| 400 |
-
this.currentInput = '0';
|
| 401 |
-
this.previousInput = '';
|
| 402 |
-
this.operation = null;
|
| 403 |
-
this.resetScreen = false;
|
| 404 |
-
this.updateDisplay();
|
| 405 |
-
}
|
| 406 |
-
|
| 407 |
-
backspace() {
|
| 408 |
-
if (this.currentInput.length > 1) {
|
| 409 |
-
this.currentInput = this.currentInput.slice(0, -1);
|
| 410 |
-
} else {
|
| 411 |
-
this.currentInput = '0';
|
| 412 |
-
}
|
| 413 |
-
this.updateDisplay();
|
| 414 |
-
}
|
| 415 |
-
|
| 416 |
-
appendDecimal() {
|
| 417 |
-
if (this.resetScreen) {
|
| 418 |
-
this.currentInput = '0';
|
| 419 |
-
this.resetScreen = false;
|
| 420 |
-
}
|
| 421 |
-
if (!this.currentInput.includes('.')) {
|
| 422 |
-
this.currentInput += '.';
|
| 423 |
-
}
|
| 424 |
-
this.updateDisplay();
|
| 425 |
-
}
|
| 426 |
-
}
|
| 427 |
-
|
| 428 |
-
// Initialize calculator when page loads
|
| 429 |
-
let calculator;
|
| 430 |
-
document.addEventListener('DOMContentLoaded', function() {
|
| 431 |
-
calculator = new Calculator();
|
| 432 |
-
});
|
| 433 |
-
|
| 434 |
// Celebration functions with 3-second limit
|
| 435 |
function createEmojiRain() {
|
| 436 |
const container = document.createElement('div');
|
|
@@ -537,53 +321,32 @@ age_groups = {
|
|
| 537 |
"๐ Math Wizards (13-15)": {"dataset": "src/Datase_of_13-15_Age_Group.xlsx", "zip_file": "src/Image_for_group_13-15.zip", "image_folder": "Image_for_group_13-15", "emoji": "๐"}
|
| 538 |
}
|
| 539 |
|
| 540 |
-
# SIDEBAR -
|
| 541 |
with st.sidebar:
|
| 542 |
-
st.markdown("###
|
| 543 |
-
st.markdown("Use this calculator to help with your math problems! โจ")
|
| 544 |
|
| 545 |
-
# COMPLETELY REDESIGNED CALCULATOR
|
| 546 |
st.markdown("""
|
| 547 |
-
<div class="
|
| 548 |
-
<
|
| 549 |
-
<
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
<button class="calc-btn calc-btn-clear" id="calc-btn-clear">C</button>
|
| 554 |
-
<button class="calc-btn calc-btn-clear" id="calc-btn-backspace">โซ</button>
|
| 555 |
-
<button class="calc-btn" id="calc-btn-divide">/</button>
|
| 556 |
-
<button class="calc-btn" id="calc-btn-multiply">ร</button>
|
| 557 |
-
|
| 558 |
-
<!-- Row 2 -->
|
| 559 |
-
<button class="calc-btn" id="calc-btn-7">7</button>
|
| 560 |
-
<button class="calc-btn" id="calc-btn-8">8</button>
|
| 561 |
-
<button class="calc-btn" id="calc-btn-9">9</button>
|
| 562 |
-
<button class="calc-btn" id="calc-btn-subtract">-</button>
|
| 563 |
-
|
| 564 |
-
<!-- Row 3 -->
|
| 565 |
-
<button class="calc-btn" id="calc-btn-4">4</button>
|
| 566 |
-
<button class="calc-btn" id="calc-btn-5">5</button>
|
| 567 |
-
<button class="calc-btn" id="calc-btn-6">6</button>
|
| 568 |
-
<button class="calc-btn" id="calc-btn-add">+</button>
|
| 569 |
-
|
| 570 |
-
<!-- Row 4 -->
|
| 571 |
-
<button class="calc-btn" id="calc-btn-1">1</button>
|
| 572 |
-
<button class="calc-btn" id="calc-btn-2">2</button>
|
| 573 |
-
<button class="calc-btn" id="calc-btn-3">3</button>
|
| 574 |
-
<button class="calc-btn calc-btn-equals" id="calc-btn-equals">=</button>
|
| 575 |
-
|
| 576 |
-
<!-- Row 5 -->
|
| 577 |
-
<button class="calc-btn calc-btn-zero" id="calc-btn-0">0</button>
|
| 578 |
-
<button class="calc-btn" id="calc-btn-decimal">.</button>
|
| 579 |
-
</div>
|
| 580 |
</div>
|
| 581 |
""", unsafe_allow_html=True)
|
| 582 |
|
| 583 |
-
st.markdown("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 584 |
|
| 585 |
# Live activity monitor
|
| 586 |
-
st.markdown("###
|
| 587 |
activity_time = time.time() - st.session_state.last_activity
|
| 588 |
if activity_time < 10:
|
| 589 |
status = "๐ข Very Active"
|
|
@@ -594,14 +357,15 @@ with st.sidebar:
|
|
| 594 |
|
| 595 |
st.metric("Session Status", status)
|
| 596 |
|
| 597 |
-
st.markdown("
|
|
|
|
|
|
|
| 598 |
st.info("""
|
| 599 |
-
|
| 600 |
-
-
|
| 601 |
-
-
|
| 602 |
-
-
|
| 603 |
-
-
|
| 604 |
-
- Perfect for checking answers! โ
|
| 605 |
""")
|
| 606 |
|
| 607 |
# MAIN CONTENT AREA
|
|
@@ -769,6 +533,12 @@ with col1:
|
|
| 769 |
st.session_state.show_steps = False
|
| 770 |
|
| 771 |
with col_btn2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 772 |
if st.button("โญ๏ธ Skip Challenge", key=f"skip_{st.session_state.question_index}", use_container_width=True):
|
| 773 |
st.session_state.last_activity = time.time() # Update activity
|
| 774 |
st.session_state.question_index += 1
|
|
@@ -788,7 +558,7 @@ with col1:
|
|
| 788 |
""")
|
| 789 |
|
| 790 |
if selected_age_group in ["๐ Math Adventurers (7-9)", "๐ Math Wizards (13-15)"]:
|
| 791 |
-
if st.button("
|
| 792 |
st.session_state.last_activity = time.time() # Update activity
|
| 793 |
st.session_state.show_steps = True
|
| 794 |
if st.session_state.show_steps and pd.notna(question.get("steps", None)):
|
|
@@ -814,6 +584,7 @@ with col1:
|
|
| 814 |
</h1>
|
| 815 |
<p style="font-size: 24px; color: #4ECDC4;">
|
| 816 |
You've completed all the challenges in this category!<br>
|
|
|
|
| 817 |
</p>
|
| 818 |
<div style="font-size: 40px; margin: 20px 0;">
|
| 819 |
๐๐๐๐๐
|
|
@@ -824,7 +595,7 @@ with col1:
|
|
| 824 |
for _ in range(3):
|
| 825 |
st.balloons()
|
| 826 |
|
| 827 |
-
if st.button("๐ Start New Adventure"):
|
| 828 |
st.session_state.last_activity = time.time() # Update activity
|
| 829 |
st.session_state.question_index = 0
|
| 830 |
st.session_state.show_answer = False
|
|
@@ -845,11 +616,18 @@ with col2:
|
|
| 845 |
if not subset_df.empty:
|
| 846 |
completed = min(st.session_state.question_index, len(subset_df))
|
| 847 |
st.metric("Challenges Completed", f"{completed}/{len(subset_df)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 848 |
|
| 849 |
-
|
| 850 |
-
st.
|
| 851 |
-
|
| 852 |
-
|
|
|
|
|
|
|
|
|
|
| 853 |
|
| 854 |
# Add periodic invisible updates to prevent sleeping
|
| 855 |
if 'update_counter' not in st.session_state:
|
|
|
|
| 95 |
font-family: 'Comic Neue', cursive;
|
| 96 |
}
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
/* Fun elements */
|
| 99 |
.emoji-rain {
|
| 100 |
position: fixed;
|
|
|
|
| 196 |
80% { opacity: 1; }
|
| 197 |
100% { opacity: 0; display: none; }
|
| 198 |
}
|
| 199 |
+
|
| 200 |
+
/* Sidebar styling */
|
| 201 |
+
.sidebar-content {
|
| 202 |
+
padding: 20px;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
.help-box {
|
| 206 |
+
background: rgba(255, 255, 255, 0.9);
|
| 207 |
+
padding: 20px;
|
| 208 |
+
border-radius: 15px;
|
| 209 |
+
border: 3px solid #FFD93D;
|
| 210 |
+
margin-bottom: 20px;
|
| 211 |
+
}
|
| 212 |
</style>
|
| 213 |
""", unsafe_allow_html=True)
|
| 214 |
|
| 215 |
+
# JavaScript for animations and celebrations
|
| 216 |
st.markdown("""
|
| 217 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
// Celebration functions with 3-second limit
|
| 219 |
function createEmojiRain() {
|
| 220 |
const container = document.createElement('div');
|
|
|
|
| 321 |
"๐ Math Wizards (13-15)": {"dataset": "src/Datase_of_13-15_Age_Group.xlsx", "zip_file": "src/Image_for_group_13-15.zip", "image_folder": "Image_for_group_13-15", "emoji": "๐"}
|
| 322 |
}
|
| 323 |
|
| 324 |
+
# SIDEBAR - Help and Controls (Calculator Removed)
|
| 325 |
with st.sidebar:
|
| 326 |
+
st.markdown("### ๐ฏ Quick Help Guide")
|
|
|
|
| 327 |
|
|
|
|
| 328 |
st.markdown("""
|
| 329 |
+
<div class="help-box">
|
| 330 |
+
<h4>๐ฎ How to Play:</h4>
|
| 331 |
+
<p>1. Choose your age group<br>
|
| 332 |
+
2. Pick a math category<br>
|
| 333 |
+
3. Solve the fun problems!<br>
|
| 334 |
+
4. Get instant feedback</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 335 |
</div>
|
| 336 |
""", unsafe_allow_html=True)
|
| 337 |
|
| 338 |
+
st.markdown("""
|
| 339 |
+
<div class="help-box">
|
| 340 |
+
<h4>๐ก Math Tips:</h4>
|
| 341 |
+
<p>โข Read questions carefully<br>
|
| 342 |
+
โข Use scrap paper if needed<br>
|
| 343 |
+
โข Check your work<br>
|
| 344 |
+
โข Ask for hints when stuck!</p>
|
| 345 |
+
</div>
|
| 346 |
+
""", unsafe_allow_html=True)
|
| 347 |
|
| 348 |
# Live activity monitor
|
| 349 |
+
st.markdown("### ๐ Activity Monitor")
|
| 350 |
activity_time = time.time() - st.session_state.last_activity
|
| 351 |
if activity_time < 10:
|
| 352 |
status = "๐ข Very Active"
|
|
|
|
| 357 |
|
| 358 |
st.metric("Session Status", status)
|
| 359 |
|
| 360 |
+
st.markdown("---")
|
| 361 |
+
|
| 362 |
+
st.markdown("### ๐ Achievement Tips")
|
| 363 |
st.info("""
|
| 364 |
+
๐ซ **Pro Tips:**
|
| 365 |
+
- Take your time with each problem
|
| 366 |
+
- Use the 'Show Steps' feature to learn
|
| 367 |
+
- Celebrate every correct answer! ๐
|
| 368 |
+
- Practice makes perfect! ๐
|
|
|
|
| 369 |
""")
|
| 370 |
|
| 371 |
# MAIN CONTENT AREA
|
|
|
|
| 533 |
st.session_state.show_steps = False
|
| 534 |
|
| 535 |
with col_btn2:
|
| 536 |
+
if st.button("๐ Show Hint", key=f"hint_{st.session_state.question_index}", use_container_width=True):
|
| 537 |
+
st.session_state.last_activity = time.time() # Update activity
|
| 538 |
+
st.session_state.show_answer = True
|
| 539 |
+
st.info("๐ก Here's a little help! You can do this! ๐")
|
| 540 |
+
|
| 541 |
+
with col_btn3:
|
| 542 |
if st.button("โญ๏ธ Skip Challenge", key=f"skip_{st.session_state.question_index}", use_container_width=True):
|
| 543 |
st.session_state.last_activity = time.time() # Update activity
|
| 544 |
st.session_state.question_index += 1
|
|
|
|
| 558 |
""")
|
| 559 |
|
| 560 |
if selected_age_group in ["๐ Math Adventurers (7-9)", "๐ Math Wizards (13-15)"]:
|
| 561 |
+
if st.button("๐ช Show Magic Steps", key=f"steps_{st.session_state.question_index}"):
|
| 562 |
st.session_state.last_activity = time.time() # Update activity
|
| 563 |
st.session_state.show_steps = True
|
| 564 |
if st.session_state.show_steps and pd.notna(question.get("steps", None)):
|
|
|
|
| 584 |
</h1>
|
| 585 |
<p style="font-size: 24px; color: #4ECDC4;">
|
| 586 |
You've completed all the challenges in this category!<br>
|
| 587 |
+
Ready for more adventures? ๐ช
|
| 588 |
</p>
|
| 589 |
<div style="font-size: 40px; margin: 20px 0;">
|
| 590 |
๐๐๐๐๐
|
|
|
|
| 595 |
for _ in range(3):
|
| 596 |
st.balloons()
|
| 597 |
|
| 598 |
+
if st.button("๐ Start New Adventure", use_container_width=True):
|
| 599 |
st.session_state.last_activity = time.time() # Update activity
|
| 600 |
st.session_state.question_index = 0
|
| 601 |
st.session_state.show_answer = False
|
|
|
|
| 616 |
if not subset_df.empty:
|
| 617 |
completed = min(st.session_state.question_index, len(subset_df))
|
| 618 |
st.metric("Challenges Completed", f"{completed}/{len(subset_df)}")
|
| 619 |
+
|
| 620 |
+
if completed > 0:
|
| 621 |
+
accuracy = "๐ฏ Perfect!" if completed == st.session_state.question_index else "๐ Great!"
|
| 622 |
+
st.metric("Accuracy", accuracy)
|
| 623 |
|
| 624 |
+
st.markdown("### ๐ซ Pro Tip")
|
| 625 |
+
st.info("""
|
| 626 |
+
โจ **Math Superpower:**
|
| 627 |
+
Use scrap paper to work out
|
| 628 |
+
tricky problems! It's like
|
| 629 |
+
having a math sidekick! ๐ฆธโโ๏ธ
|
| 630 |
+
""")
|
| 631 |
|
| 632 |
# Add periodic invisible updates to prevent sleeping
|
| 633 |
if 'update_counter' not in st.session_state:
|