diff --git a/README.md b/README.md index f87d0f4..5f959cd 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Eine Web-App inspiriert von Heardle, bei der Nutzer täglich einen Song anhand k ## Features - **Tägliches Rätsel:** Jeden Tag ein neuer Song für alle Nutzer. -- **Inkrementelle Hinweise:** Startet mit 2 Sekunden, dann 4s, 7s, 11s, 16s, bis 30s. +- **Inkrementelle Hinweise:** Startet mit 2 Sekunden, dann 4s, 7s, 11s, 16s, 30s, bis 60s (7 Versuche). - **Admin Dashboard:** - Upload von MP3-Dateien. - Automatische Extraktion von ID3-Tags (Titel, Interpret). diff --git a/components/Game.tsx b/components/Game.tsx index 207a794..66fb594 100644 --- a/components/Game.tsx +++ b/components/Game.tsx @@ -17,7 +17,7 @@ interface GameProps { } | null; } -const UNLOCK_STEPS = [2, 4, 7, 11, 16, 30]; +const UNLOCK_STEPS = [2, 4, 7, 11, 16, 30, 60]; export default function Game({ dailyPuzzle }: GameProps) { const { gameState, statistics, addGuess } = useGameState(); @@ -48,17 +48,17 @@ export default function Game({ dailyPuzzle }: GameProps) { setHasWon(true); } else { addGuess(song.title, false); - if (gameState.guesses.length + 1 >= 6) { + if (gameState.guesses.length + 1 >= 7) { setHasLost(true); } } }; - const unlockedSeconds = UNLOCK_STEPS[Math.min(gameState.guesses.length, 5)]; + const unlockedSeconds = UNLOCK_STEPS[Math.min(gameState.guesses.length, 6)]; const handleShare = () => { let emojiGrid = ''; - const totalGuesses = 6; + const totalGuesses = 7; // Build the grid for (let i = 0; i < totalGuesses; i++) { @@ -110,7 +110,7 @@ export default function Game({ dailyPuzzle }: GameProps) {
- Attempt {gameState.guesses.length + 1} / 6 + Attempt {gameState.guesses.length + 1} / 7 {unlockedSeconds}s unlocked
addGuess("SKIPPED", false)} className="skip-button" > - Skip (+{UNLOCK_STEPS[Math.min(gameState.guesses.length + 1, 5)] - unlockedSeconds}s) + Skip (+{UNLOCK_STEPS[Math.min(gameState.guesses.length + 1, 6)] - unlockedSeconds}s) )} diff --git a/components/Statistics.tsx b/components/Statistics.tsx index 8ad2b2e..be3f3be 100644 --- a/components/Statistics.tsx +++ b/components/Statistics.tsx @@ -13,6 +13,7 @@ const BADGES = { 4: '⭐', // Star 5: '✨', // Sparkles 6: '💫', // Dizzy + 7: '🎵', // Musical note failed: '❌', // Cross mark }; @@ -24,6 +25,7 @@ export default function Statistics({ statistics }: StatisticsProps) { statistics.solvedIn4 + statistics.solvedIn5 + statistics.solvedIn6 + + statistics.solvedIn7 + statistics.failed; const stats = [ @@ -33,6 +35,7 @@ export default function Statistics({ statistics }: StatisticsProps) { { attempts: 4, count: statistics.solvedIn4, badge: BADGES[4] }, { attempts: 5, count: statistics.solvedIn5, badge: BADGES[5] }, { attempts: 6, count: statistics.solvedIn6, badge: BADGES[6] }, + { attempts: 7, count: statistics.solvedIn7, badge: BADGES[7] }, { attempts: 'Failed', count: statistics.failed, badge: BADGES.failed }, ]; diff --git a/lib/gameState.ts b/lib/gameState.ts index b705262..0489286 100644 --- a/lib/gameState.ts +++ b/lib/gameState.ts @@ -17,6 +17,7 @@ export interface Statistics { solvedIn4: number; solvedIn5: number; solvedIn6: number; + solvedIn7: number; failed: number; } @@ -64,7 +65,12 @@ export function useGameState() { // Load statistics const storedStats = localStorage.getItem(STATS_KEY); if (storedStats) { - setStatistics(JSON.parse(storedStats)); + const parsedStats = JSON.parse(storedStats); + // Migration for existing stats without solvedIn7 + if (parsedStats.solvedIn7 === undefined) { + parsedStats.solvedIn7 = 0; + } + setStatistics(parsedStats); } else { const newStats: Statistics = { solvedIn1: 0, @@ -73,6 +79,7 @@ export function useGameState() { solvedIn4: 0, solvedIn5: 0, solvedIn6: 0, + solvedIn7: 0, failed: 0, }; setStatistics(newStats); @@ -98,6 +105,7 @@ export function useGameState() { case 4: newStats.solvedIn4++; break; case 5: newStats.solvedIn5++; break; case 6: newStats.solvedIn6++; break; + case 7: newStats.solvedIn7++; break; } } else { newStats.failed++; @@ -112,7 +120,7 @@ export function useGameState() { const newGuesses = [...gameState.guesses, guess]; const isSolved = correct; - const isFailed = !correct && newGuesses.length >= 6; + const isFailed = !correct && newGuesses.length >= 7; const newState = { ...gameState,