milwright Claude commited on
Commit
f1bb203
Β·
1 Parent(s): 20b30b6

clean: remove perfect rounds metric and update leaderboard styling

Browse files

- Remove perfectRounds tracking from stats system
- Add session reset on initialization for fresh starts
- Move leaderboard button to footer for better mobile UX
- Update player stats color scheme from purple to gold

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

Files changed (3) hide show
  1. index.html +7 -14
  2. src/leaderboardService.js +15 -8
  3. src/styles.css +5 -5
index.html CHANGED
@@ -12,21 +12,11 @@
12
  <body class="min-h-screen">
13
  <div id="app" class="container mx-auto px-4 py-8 max-w-4xl">
14
  <header class="text-center mb-8">
15
- <div class="flex items-start justify-between mb-4 gap-4">
16
- <div class="flex-1 min-w-0"></div>
17
- <div class="flex flex-col items-center gap-3">
18
- <div class="flex items-center gap-3">
19
- <img src="./icon.png" alt="Cloze Reader" class="w-12 h-12">
20
- <h1 class="text-4xl font-bold typewriter-text">Cloze Reader</h1>
21
- </div>
22
- <p class="typewriter-subtitle">Fill in the blanks to practice reading comprehension</p>
23
- </div>
24
- <div class="flex-1 min-w-0 flex justify-end items-end">
25
- <button id="leaderboard-btn" class="typewriter-button-small" title="View leaderboard">
26
- Leaderboard
27
- </button>
28
- </div>
29
  </div>
 
30
  </header>
31
 
32
  <main id="game-container" class="space-y-6">
@@ -68,6 +58,9 @@
68
  <button type="button" id="hint-btn" class="typewriter-button">
69
  Show Hints
70
  </button>
 
 
 
71
  </div>
72
  </div>
73
 
 
12
  <body class="min-h-screen">
13
  <div id="app" class="container mx-auto px-4 py-8 max-w-4xl">
14
  <header class="text-center mb-8">
15
+ <div class="flex items-center justify-center mb-4 gap-3">
16
+ <img src="./icon.png" alt="Cloze Reader" class="w-12 h-12">
17
+ <h1 class="text-4xl font-bold typewriter-text">Cloze Reader</h1>
 
 
 
 
 
 
 
 
 
 
 
18
  </div>
19
+ <p class="typewriter-subtitle text-center">Fill in the blanks to practice reading comprehension</p>
20
  </header>
21
 
22
  <main id="game-container" class="space-y-6">
 
58
  <button type="button" id="hint-btn" class="typewriter-button">
59
  Show Hints
60
  </button>
61
+ <button id="leaderboard-btn" class="leaderboard-footer-btn" title="View leaderboard">
62
+ πŸ…
63
+ </button>
64
  </div>
65
  </div>
66
 
src/leaderboardService.js CHANGED
@@ -13,6 +13,9 @@ export class LeaderboardService {
13
  };
14
 
15
  this.maxEntries = 10;
 
 
 
16
  this.initializeStorage();
17
  }
18
 
@@ -49,7 +52,6 @@ export class LeaderboardService {
49
  totalPassagesAttempted: 0,
50
  longestStreak: 0,
51
  currentStreak: 0,
52
- perfectRounds: 0,
53
  totalCorrectWords: 0,
54
  uniqueWordsCorrect: new Set(),
55
  gamesPlayed: 0,
@@ -253,6 +255,12 @@ export class LeaderboardService {
253
  updateStats(data) {
254
  const stats = this.getStats() || this.createEmptyStats();
255
 
 
 
 
 
 
 
256
  stats.totalPassagesAttempted++;
257
 
258
  if (data.passed) {
@@ -282,13 +290,12 @@ export class LeaderboardService {
282
  });
283
  }
284
 
285
- // Track perfect rounds (if both passages in round were 100%)
286
- if (data.percentage === 100 && data.passagesPassed % 2 === 0) {
287
- stats.perfectRounds++;
288
- }
289
-
290
  stats.lastPlayed = new Date().toISOString();
291
 
 
 
 
 
292
  this.saveStats(stats);
293
  return stats;
294
  }
@@ -321,9 +328,10 @@ export class LeaderboardService {
321
  }
322
 
323
  /**
324
- * Reset all leaderboard data (for testing or user request)
325
  */
326
  resetAll() {
 
327
  this.saveLeaderboard([]);
328
  this.savePlayerProfile({
329
  initials: null,
@@ -352,7 +360,6 @@ export class LeaderboardService {
352
  : 0,
353
  longestStreak: stats.longestStreak,
354
  currentStreak: stats.currentStreak,
355
- perfectRounds: stats.perfectRounds,
356
  totalCorrectWords: stats.totalCorrectWords,
357
  uniqueWords: stats.uniqueWordsCorrect.size,
358
  gamesPlayed: stats.gamesPlayed,
 
13
  };
14
 
15
  this.maxEntries = 10;
16
+
17
+ // Reset all data on initialization (fresh start each session)
18
+ this.resetAll();
19
  this.initializeStorage();
20
  }
21
 
 
52
  totalPassagesAttempted: 0,
53
  longestStreak: 0,
54
  currentStreak: 0,
 
55
  totalCorrectWords: 0,
56
  uniqueWordsCorrect: new Set(),
57
  gamesPlayed: 0,
 
255
  updateStats(data) {
256
  const stats = this.getStats() || this.createEmptyStats();
257
 
258
+ console.log('πŸ“Š LEADERBOARD: Updating stats', {
259
+ before: { attempted: stats.totalPassagesAttempted, passed: stats.totalPassagesPassed, level: stats.highestLevel },
260
+ passResult: data.passed,
261
+ currentLevel: data.currentLevel
262
+ });
263
+
264
  stats.totalPassagesAttempted++;
265
 
266
  if (data.passed) {
 
290
  });
291
  }
292
 
 
 
 
 
 
293
  stats.lastPlayed = new Date().toISOString();
294
 
295
+ console.log('πŸ“Š LEADERBOARD: Stats updated', {
296
+ after: { attempted: stats.totalPassagesAttempted, passed: stats.totalPassagesPassed, level: stats.highestLevel }
297
+ });
298
+
299
  this.saveStats(stats);
300
  return stats;
301
  }
 
328
  }
329
 
330
  /**
331
+ * Reset all leaderboard data (fresh start each session)
332
  */
333
  resetAll() {
334
+ console.log('πŸ”„ LEADERBOARD: Starting fresh session (stats reset on page load)');
335
  this.saveLeaderboard([]);
336
  this.savePlayerProfile({
337
  initials: null,
 
360
  : 0,
361
  longestStreak: stats.longestStreak,
362
  currentStreak: stats.currentStreak,
 
363
  totalCorrectWords: stats.totalCorrectWords,
364
  uniqueWords: stats.uniqueWordsCorrect.size,
365
  gamesPlayed: stats.gamesPlayed,
src/styles.css CHANGED
@@ -760,8 +760,8 @@
760
  }
761
 
762
  .leaderboard-entry.player-entry {
763
- background: linear-gradient(135deg, #f0e6ff 0%, #e0d1f5 100%);
764
- border-color: #8b7aa8;
765
  border-width: 3px;
766
  }
767
 
@@ -814,8 +814,8 @@
814
  .leaderboard-player-stats {
815
  margin-top: 24px;
816
  padding: 18px;
817
- background: rgba(139, 115, 170, 0.08);
818
- border: 2px solid rgba(139, 115, 170, 0.25);
819
  border-radius: 6px;
820
  }
821
 
@@ -827,7 +827,7 @@
827
  }
828
 
829
  .player-best .highlight {
830
- color: #6b4a8e;
831
  font-weight: 700;
832
  }
833
 
 
760
  }
761
 
762
  .leaderboard-entry.player-entry {
763
+ background: linear-gradient(135deg, #fff9f0 0%, #ffecd1 100%);
764
+ border-color: #d4a574;
765
  border-width: 3px;
766
  }
767
 
 
814
  .leaderboard-player-stats {
815
  margin-top: 24px;
816
  padding: 18px;
817
+ background: rgba(212, 165, 116, 0.08);
818
+ border: 2px solid rgba(212, 165, 116, 0.25);
819
  border-radius: 6px;
820
  }
821
 
 
827
  }
828
 
829
  .player-best .highlight {
830
+ color: #8b6914;
831
  font-weight: 700;
832
  }
833