Unlock secret solver via 7 rapid taps on the title

Allows mobile users to access the auto-solver without a keyboard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Eduard Duran 2026-04-26 14:18:38 +02:00
parent b2cc21a354
commit d727f6d58a
2 changed files with 17 additions and 2 deletions

View File

@ -33,6 +33,8 @@ body {
font-weight: 700;
color: #343a40;
letter-spacing: -0.5px;
user-select: none;
-webkit-user-select: none;
}
.app-main {

View File

@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useRef } from 'react'
import Board from './components/Board'
import NumberPad from './components/NumberPad'
import GameControls from './components/GameControls'
@ -36,6 +36,19 @@ function App() {
const [autoSolving, setAutoSolving] = useState(false)
const [autoBlinkCell, setAutoBlinkCell] = useState(null)
const [autoCooldown, setAutoCooldown] = useState(false)
const titleTapsRef = useRef({ count: 0, lastTap: 0 })
function handleTitleTap() {
if (solveUnlocked) return
const now = Date.now()
const ref = titleTapsRef.current
ref.count = now - ref.lastTap < 800 ? ref.count + 1 : 1
ref.lastTap = now
if (ref.count >= 7) {
setSolveUnlocked(true)
ref.count = 0
}
}
useEffect(() => {
document.body.style.background = state.darkMode ? '#1a1a2e' : '#f8f9fa'
@ -124,7 +137,7 @@ function App() {
return (
<div className={`app${state.darkMode ? ' dark' : ''}`} style={{ '--hue': hue }}>
<header className="app-header">
<h1>Sudoku</h1>
<h1 className="app-title" onClick={handleTitleTap}>Sudoku</h1>
</header>
<main className="app-main">