rrr257 commited on
Commit
af083a3
·
1 Parent(s): c097dfd

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +18 -8
index.html CHANGED
@@ -61,6 +61,11 @@ background: #ede9fe;
61
  border-color: #a78bfa;
62
  transform: translateY(-2px);
63
  }
 
 
 
 
 
64
  .topics-container {
65
  display: none;
66
  }
@@ -359,7 +364,8 @@ line-height: 1.5;
359
  </div>
360
 
361
  <script>
362
- const themes = {
 
363
  'if-you-could': {
364
  name: 'If You Could... (Fun/Imaginative)',
365
  topics: [
@@ -460,7 +466,8 @@ topics: [
460
  }
461
  };
462
 
463
- let currentCategory = null;
 
464
  let usedTopics = [];
465
  let timerInterval = null;
466
  let timeElapsed = 0;
@@ -478,11 +485,14 @@ const nextSpeakerBtn = document.getElementById('nextSpeakerBtn');
478
  const backBtn = document.getElementById('backBtn');
479
  const backToTopicsBtn = document.getElementById('backToTopicsBtn');
480
  const resetUsedBtn = document.getElementById('resetUsedBtn');
 
481
 
482
- // Category selection - SAME PATTERN AS ROLE PLAY/DEBATES
483
- document.querySelectorAll('.category-btn').forEach(btn => {
484
  btn.addEventListener('click', () => {
485
- currentCategory = btn.dataset.category;
 
 
486
  usedTopics = [];
487
  showTopics();
488
  });
@@ -491,13 +501,13 @@ showTopics();
491
  function showTopics() {
492
  categorySelection.style.display = 'none';
493
  topicsContainer.classList.add('active');
494
- currentThemeName.textContent = themes[currentCategory].name;
495
  renderTopics();
496
  }
497
 
498
  function renderTopics() {
499
  topicsGrid.innerHTML = '';
500
- themes[currentCategory].topics.forEach((topic, index) => {
501
  const card = document.createElement('div');
502
  card.className = 'topic-card';
503
  if (usedTopics.includes(index)) {
@@ -516,7 +526,7 @@ topicsGrid.appendChild(card);
516
  }
517
 
518
  function selectTopic(index) {
519
- selectedTopicText.textContent = themes[currentCategory].topics[index];
520
  usedTopics.push(index);
521
  topicsContainer.classList.remove('active');
522
  speakingSection.classList.add('active');
 
61
  border-color: #a78bfa;
62
  transform: translateY(-2px);
63
  }
64
+ .category-btn.active {
65
+ background: #7c3aed;
66
+ color: white;
67
+ border-color: #6d28d9;
68
+ }
69
  .topics-container {
70
  display: none;
71
  }
 
364
  </div>
365
 
366
  <script>
367
+ // Using EXACT variable naming from working Role Play app
368
+ const categories = {
369
  'if-you-could': {
370
  name: 'If You Could... (Fun/Imaginative)',
371
  topics: [
 
466
  }
467
  };
468
 
469
+ // EXACT variable names from working app
470
+ let selectedCategory = null;
471
  let usedTopics = [];
472
  let timerInterval = null;
473
  let timeElapsed = 0;
 
485
  const backBtn = document.getElementById('backBtn');
486
  const backToTopicsBtn = document.getElementById('backToTopicsBtn');
487
  const resetUsedBtn = document.getElementById('resetUsedBtn');
488
+ const categoryBtns = document.querySelectorAll('.category-btn');
489
 
490
+ // EXACT event listener pattern from working app
491
+ categoryBtns.forEach(btn => {
492
  btn.addEventListener('click', () => {
493
+ categoryBtns.forEach(b => b.classList.remove('active'));
494
+ btn.classList.add('active');
495
+ selectedCategory = btn.dataset.category;
496
  usedTopics = [];
497
  showTopics();
498
  });
 
501
  function showTopics() {
502
  categorySelection.style.display = 'none';
503
  topicsContainer.classList.add('active');
504
+ currentThemeName.textContent = categories[selectedCategory].name;
505
  renderTopics();
506
  }
507
 
508
  function renderTopics() {
509
  topicsGrid.innerHTML = '';
510
+ categories[selectedCategory].topics.forEach((topic, index) => {
511
  const card = document.createElement('div');
512
  card.className = 'topic-card';
513
  if (usedTopics.includes(index)) {
 
526
  }
527
 
528
  function selectTopic(index) {
529
+ selectedTopicText.textContent = categories[selectedCategory].topics[index];
530
  usedTopics.push(index);
531
  topicsContainer.classList.remove('active');
532
  speakingSection.classList.add('active');