codeflow-typeracer / index.html
ItsJayKee's picture
fix the index.html
3530adb verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CodeFlow Typing Challenge</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen">
<custom-header></custom-header>
<main class="container mx-auto px-4 py-8 max-w-4xl">
<div class="text-center mb-12">
<h1 class="text-4xl font-bold mb-2 text-indigo-400">CodeFlow Typing Challenge</h1>
<p class="text-lg text-gray-400">Test your coding language typing speed & accuracy</p>
</div>
<div class="bg-gray-800 rounded-xl p-6 shadow-lg mb-8">
<div class="flex justify-between items-center mb-6">
<div class="flex space-x-4">
<div class="bg-gray-700 px-4 py-2 rounded-lg">
<span class="text-indigo-300">Language:</span>
<select id="language-select" class="ml-2 bg-gray-800 text-gray-100 border-none focus:ring-2 focus:ring-indigo-500 rounded">
<option value="all">All Languages</option>
<option value="html">HTML</option>
<option value="css">CSS</option>
<option value="javascript">JavaScript</option>
</select>
</div>
<div class="bg-gray-700 px-4 py-2 rounded-lg">
<span class="text-indigo-300">Time:</span>
<select id="time-select" class="ml-2 bg-gray-800 text-gray-100 border-none focus:ring-2 focus:ring-indigo-500 rounded">
<option value="60">1 minute</option>
<option value="120">2 minutes</option>
<option value="300">5 minutes</option>
<option value="600">10 minutes</option>
</select>
<span id="timer" class="ml-2">60s</span>
</div>
<div class="bg-gray-700 px-4 py-2 rounded-lg">
<span class="text-indigo-300">Speed:</span>
<span id="speed" class="ml-2">0 WPM</span>
</div>
</div>
</div>
<div id="typing-area" class="bg-gray-900 rounded-lg p-6 mb-6 h-48 overflow-y-auto">
<div id="code-display" class="font-mono text-lg leading-relaxed"></div>
</div>
<textarea
id="input-field"
class="w-full bg-gray-900 border-2 border-gray-700 rounded-lg p-4 font-mono text-lg focus:border-indigo-500 focus:outline-none"
rows="6"
placeholder="Start typing here..."
></textarea>
</div>
<div id="results" class="hidden bg-gray-800 rounded-xl p-6 shadow-lg">
<h2 class="text-2xl font-bold mb-6 text-center text-indigo-400">Your Results</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-gray-900 p-4 rounded-lg text-center">
<div class="text-4xl font-bold text-indigo-400 mb-2" id="final-wpm">0</div>
<div class="text-gray-400">Words Per Minute</div>
</div>
<div class="bg-gray-900 p-4 rounded-lg text-center">
<div class="text-4xl font-bold text-indigo-400 mb-2" id="final-accuracy">0%</div>
<div class="text-gray-400">Accuracy</div>
</div>
</div>
<div class="mt-8 text-center">
<button id="try-again-btn" class="bg-indigo-600 hover:bg-indigo-700 px-6 py-3 rounded-lg text-lg transition">
<i data-feather="repeat" class="inline mr-2"></i>Try Again
</button>
</div>
</div>
</main>
<custom-footer></custom-footer>
<script src="components/header.js"></script>
<script src="components/footer.js"></script>
<script src="script.js"></script>
<script>
feather.replace();
// Check if user is logged in
document.addEventListener('DOMContentLoaded', () => {
const userInfo = localStorage.getItem('userInfo');
if (!userInfo) {
window.location.href = '/login.html';
}
});
</script>
<!-- Feather Icons -->
<script>
feather.replace();
</script>
</body>
</html>