quizmaster-pro / index.html
Dembo's picture
Create a Quiz App, with a quiz section, and a history section.
fa3a866 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QuizMaster Pro - Test Your Knowledge</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.net.min.js"></script>
<style>
.vanta-bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
.card-hover {
transition: all 0.3s ease;
}
.card-hover:hover {
transform: translateY(-5px);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.progress-ring {
transition: stroke-dashoffset 0.5s ease;
}
</style>
</head>
<body class="min-h-screen bg-gray-50">
<div id="vanta-bg" class="vanta-bg"></div>
<nav class="bg-white shadow-lg fixed w-full z-10">
<div class="container mx-auto px-4">
<div class="flex justify-between items-center py-4">
<a href="index.html" class="flex items-center text-xl font-bold text-gray-800">
<i data-feather="brain" class="mr-2 text-red-500"></i>
QuizMaster Pro
</a>
<div class="flex space-x-4">
<a href="index.html" class="px-3 py-2 rounded-md text-sm font-medium bg-red-100 text-red-700">Quiz</a>
<a href="history.html" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-100">History</a>
</div>
</div>
</div>
</nav>
<main class="pt-20 pb-10 px-4">
<div class="container mx-auto max-w-4xl">
<div class="text-center mb-10">
<h1 class="text-4xl font-bold text-gray-800 mb-4">Challenge Your Knowledge</h1>
<p class="text-xl text-gray-600">Select a quiz category and test your expertise!</p>
</div>
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12">
<div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
<div class="h-40 bg-red-100 flex items-center justify-center">
<i data-feather="globe" class="h-16 w-16 text-red-500"></i>
</div>
<div class="p-6">
<h3 class="text-xl font-semibold text-gray-800 mb-2">Geography</h3>
<p class="text-gray-600 mb-4">Test your knowledge of countries, capitals, and landmarks.</p>
<button onclick="startQuiz('geography')" class="w-full bg-red-500 hover:bg-red-600 text-white font-medium py-2 px-4 rounded-lg transition">Start Quiz</button>
</div>
</div>
<div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
<div class="h-40 bg-red-100 flex items-center justify-center">
<i data-feather="code" class="h-16 w-16 text-red-500"></i>
</div>
<div class="p-6">
<h3 class="text-xl font-semibold text-gray-800 mb-2">Programming</h3>
<p class="text-gray-600 mb-4">Challenge your coding knowledge across multiple languages.</p>
<button onclick="startQuiz('programming')" class="w-full bg-red-500 hover:bg-red-600 text-white font-medium py-2 px-4 rounded-lg transition">Start Quiz</button>
</div>
</div>
<div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
<div class="h-40 bg-red-100 flex items-center justify-center">
<i data-feather="film" class="h-16 w-16 text-red-500"></i>
</div>
<div class="p-6">
<h3 class="text-xl font-semibold text-gray-800 mb-2">Movies</h3>
<p class="text-gray-600 mb-4">How well do you know classic and modern cinema?</p>
<button onclick="startQuiz('movies')" class="w-full bg-red-500 hover:bg-red-600 text-white font-medium py-2 px-4 rounded-lg transition">Start Quiz</button>
</div>
</div>
</div>
<div class="bg-white rounded-xl shadow-md p-6">
<h2 class="text-2xl font-bold text-gray-800 mb-4">Recent Results</h2>
<div id="recent-results" class="space-y-4">
<!-- Recent results will be loaded here -->
</div>
</div>
</div>
</main>
<footer class="bg-white border-t border-gray-200 py-6">
<div class="container mx-auto px-4 text-center text-gray-600">
<p>© 2023 QuizMaster Pro. Test your knowledge, expand your mind.</p>
</div>
</footer>
<script>
// Initialize Vanta.js background
VANTA.NET({
el: "#vanta-bg",
mouseControls: true,
touchControls: true,
gyroControls: false,
minHeight: 200.00,
minWidth: 200.00,
scale: 1.00,
scaleMobile: 1.00,
color: 0xff5555,
backgroundColor: 0xf8fafc,
points: 12.00,
maxDistance: 22.00,
spacing: 18.00
});
// Load recent results
function loadRecentResults() {
const results = JSON.parse(localStorage.getItem('quizResults') || '[]').slice(0, 3);
const container = document.getElementById('recent-results');
if (results.length === 0) {
container.innerHTML = '<p class="text-gray-500 text-center py-4">No quiz history yet. Take a quiz to see your results here!</p>';
return;
}
container.innerHTML = results.map(result => `
<div class="flex justify-between items-center p-4 bg-gray-50 rounded-lg">
<div>
<h3 class="font-semibold capitalize">${result.category}</h3>
<p class="text-sm text-gray-600">${new Date(result.date).toLocaleDateString()}</p>
</div>
<div class="text-right">
<p class="text-lg font-bold text-red-500">${result.score}/${result.total}</p>
<p class="text-sm text-gray-600">${Math.round((result.score/result.total)*100)}%</p>
</div>
</div>
`).join('');
}
function startQuiz(category) {
localStorage.setItem('selectedCategory', category);
window.location.href = 'quiz.html';
}
// Initialize
feather.replace();
loadRecentResults();
</script>
</body>
</html>