contest / index.html
Design-28's picture
Add 3 files
74c3733 verified
Raw History Blame Contribute Delete
31 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Classroom - Contest Prizes Setup</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<style>
@import url('https://fonts.googleapis.com/css2?family=Helvetica:wght@700&display=swap');
body {
font-family: 'Inter', sans-serif;
color: #1E293B;
}
h1, h2, h3 {
font-family: 'Helvetica', sans-serif;
}
.gradient-btn {
background: linear-gradient(90deg, #CABDFF 0%, #A6C8FF 100%);
transition: all 0.3s ease;
}
.gradient-btn:hover {
background: linear-gradient(90deg, #B8A8FF 0%, #95B8FF 100%);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.modal-overlay {
background-color: rgba(0, 0, 0, 0.5);
transition: opacity 0.3s ease;
}
.modal-content {
transition: all 0.3s ease;
transform: translateY(20px);
}
.modal-enter {
opacity: 0;
}
.modal-enter-active {
opacity: 1;
}
.modal-exit {
opacity: 1;
}
.modal-exit-active {
opacity: 0;
}
.prize-card {
transition: all 0.3s ease;
}
.prize-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.fade-in {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.slide-up {
animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
</style>
</head>
<body class="bg-white min-h-screen">
<div class="container mx-auto px-[72px] py-[48px]">
<!-- Header -->
<header class="mb-12">
<h1 class="text-[32px] font-bold mb-2">Contest Prizes Setup</h1>
<p class="text-[20px] text-gray-600">Upload and manage prizes for your upcoming contest</p>
</header>
<!-- Main Content Area -->
<main>
<!-- Step Indicator -->
<div class="flex items-center mb-12">
<div class="flex-1 h-1 bg-gray-200">
<div id="progress-bar" class="h-1 bg-gradient-to-r from-[#CABDFF] to-[#A6C8FF] transition-all duration-500" style="width: 50%"></div>
</div>
<div class="flex justify-between w-full absolute px-[72px]">
<div class="flex flex-col items-center">
<div class="w-8 h-8 rounded-full bg-[#CABDFF] flex items-center justify-center text-white font-medium">1</div>
<span class="mt-2 text-[18px]">Upload Prizes</span>
</div>
<div class="flex flex-col items-center">
<div class="w-8 h-8 rounded-full bg-gray-200 flex items-center justify-center text-gray-500 font-medium">2</div>
<span class="mt-2 text-[18px] text-gray-500">Preview & Publish</span>
</div>
</div>
</div>
<!-- Prize Upload Section -->
<section id="prize-upload-section" class="fade-in">
<h2 class="text-[24px] font-bold mb-6">Upload Contest Prizes</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8">
<!-- Prize Cards will be added here dynamically -->
<div id="prize-card-1" class="prize-card bg-white rounded-xl shadow-md overflow-hidden cursor-pointer border-2 border-dashed border-gray-300 hover:border-[#CABDFF] transition-all" onclick="openPrizeModal(1)">
<div class="h-40 bg-gray-100 flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
</svg>
</div>
<div class="p-4">
<h3 class="text-[20px] font-semibold mb-1">First Prize</h3>
<p class="text-[18px] text-gray-600">Click to add prize details</p>
</div>
</div>
<div id="prize-card-2" class="prize-card bg-white rounded-xl shadow-md overflow-hidden cursor-pointer border-2 border-dashed border-gray-300 hover:border-[#CABDFF] transition-all" onclick="openPrizeModal(2)">
<div class="h-40 bg-gray-100 flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
</svg>
</div>
<div class="p-4">
<h3 class="text-[20px] font-semibold mb-1">Second Prize</h3>
<p class="text-[18px] text-gray-600">Click to add prize details</p>
</div>
</div>
<div id="prize-card-3" class="prize-card bg-white rounded-xl shadow-md overflow-hidden cursor-pointer border-2 border-dashed border-gray-300 hover:border-[#CABDFF] transition-all" onclick="openPrizeModal(3)">
<div class="h-40 bg-gray-100 flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
</svg>
</div>
<div class="p-4">
<h3 class="text-[20px] font-semibold mb-1">Third Prize</h3>
<p class="text-[18px] text-gray-600">Click to add prize details</p>
</div>
</div>
<!-- Additional prize cards can be added here -->
</div>
<div class="flex justify-between items-center">
<button class="flex items-center text-[#1E293B] text-[18px] font-medium" onclick="addMorePrizes()">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
</svg>
Add More Prizes
</button>
<button id="next-btn" class="gradient-btn text-white px-6 py-3 rounded-lg text-[18px] font-medium" onclick="showPreviewSection()">
Next: Preview & Publish
</button>
</div>
</section>
<!-- Preview & Publish Section (Hidden by default) -->
<section id="preview-section" class="hidden slide-up">
<h2 class="text-[24px] font-bold mb-6">Contest Preview</h2>
<div class="bg-white rounded-xl shadow-md p-6 mb-8">
<h3 class="text-[20px] font-semibold mb-4">Prize List</h3>
<div id="preview-prizes-container" class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
<!-- Prize previews will be added here dynamically -->
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
<div class="bg-gray-50 p-4 rounded-lg">
<h4 class="text-[18px] font-medium mb-2">Contest Timing</h4>
<p class="text-[18px] text-gray-600">Not specified</p>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<h4 class="text-[18px] font-medium mb-2">Questions Summary</h4>
<p class="text-[18px] text-gray-600">No questions added yet</p>
</div>
</div>
</div>
<div class="flex justify-between items-center sticky bottom-0 bg-white py-4 border-t">
<button class="text-[#1E293B] text-[18px] font-medium px-6 py-3 rounded-lg border border-gray-300" onclick="backToPrizeUpload()">
Back to Prize Upload
</button>
<div class="flex space-x-4">
<button class="text-[#1E293B] text-[18px] font-medium px-6 py-3 rounded-lg border border-gray-300" onclick="saveAsDraft()">
Save as Draft
</button>
<button class="gradient-btn text-white px-6 py-3 rounded-lg text-[18px] font-medium" onclick="confirmPublish()">
Publish Contest
</button>
</div>
</div>
</section>
</main>
</div>
<!-- Prize Upload Modal -->
<div id="prize-modal" class="fixed inset-0 z-50 flex items-center justify-center modal-overlay opacity-0 pointer-events-none transition-opacity">
<div class="modal-content bg-white rounded-xl w-full max-w-md mx-4 overflow-hidden shadow-xl transform">
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-[24px] font-bold" id="modal-title">Add Prize Details</h3>
<button onclick="closePrizeModal()" class="text-gray-500 hover:text-gray-700">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<div class="mb-4">
<label class="block text-[18px] font-medium mb-2">Prize Image</label>
<div class="border-2 border-dashed border-gray-300 rounded-lg p-4 text-center cursor-pointer hover:border-[#CABDFF] transition-colors" onclick="document.getElementById('prize-image-upload').click()">
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 mx-auto text-gray-400 mb-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
<p class="text-[18px] text-gray-600">Click to upload an image</p>
<input type="file" id="prize-image-upload" class="hidden" accept="image/*" onchange="previewImage(this)">
</div>
<div id="image-preview" class="mt-2 hidden">
<img id="preview-image" src="" alt="Preview" class="max-h-40 mx-auto">
</div>
</div>
<div class="mb-4">
<label for="prize-title" class="block text-[18px] font-medium mb-2">Prize Title</label>
<input type="text" id="prize-title" class="w-full px-4 py-2 border border-gray-300 rounded-lg text-[18px] focus:outline-none focus:ring-2 focus:ring-[#CABDFF] focus:border-transparent" placeholder="Enter prize title">
</div>
<div class="mb-6">
<label for="prize-description" class="block text-[18px] font-medium mb-2">Prize Description</label>
<textarea id="prize-description" rows="3" class="w-full px-4 py-2 border border-gray-300 rounded-lg text-[18px] focus:outline-none focus:ring-2 focus:ring-[#CABDFF] focus:border-transparent" placeholder="Enter detailed description of the prize"></textarea>
</div>
<div class="flex justify-end space-x-3">
<button onclick="closePrizeModal()" class="px-4 py-2 border border-gray-300 rounded-lg text-[18px] font-medium text-gray-700 hover:bg-gray-50">
Cancel
</button>
<button onclick="savePrizeDetails()" class="gradient-btn text-white px-6 py-3 rounded-lg text-[18px] font-medium">
Save Prize
</button>
</div>
</div>
</div>
</div>
<!-- Publish Confirmation Modal -->
<div id="publish-modal" class="fixed inset-0 z-50 flex items-center justify-center modal-overlay opacity-0 pointer-events-none transition-opacity">
<div class="modal-content bg-white rounded-xl w-full max-w-md mx-4 overflow-hidden shadow-xl transform">
<div class="p-6">
<div class="flex justify-center mb-4">
<div class="bg-[#CABDFF] bg-opacity-20 p-3 rounded-full">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-[#1E293B]" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
</div>
</div>
<h3 class="text-[24px] font-bold text-center mb-2">Confirm Publish</h3>
<p class="text-[18px] text-gray-600 text-center mb-6">Are you sure you want to publish this contest? You won't be able to edit after publishing.</p>
<div class="flex justify-center space-x-4">
<button onclick="closePublishModal()" class="px-6 py-2 border border-gray-300 rounded-lg text-[18px] font-medium text-gray-700 hover:bg-gray-50">
Cancel
</button>
<button onclick="publishContest()" class="gradient-btn text-white px-6 py-3 rounded-lg text-[18px] font-medium">
Yes, Publish
</button>
</div>
</div>
</div>
</div>
<script>
// Global variables
let currentPrizeId = null;
let prizes = {
1: { title: "First Prize", description: "", image: null },
2: { title: "Second Prize", description: "", image: null },
3: { title: "Third Prize", description: "", image: null }
};
let additionalPrizes = [];
// Modal functions
function openPrizeModal(prizeId) {
currentPrizeId = prizeId;
const modal = document.getElementById('prize-modal');
const modalTitle = document.getElementById('modal-title');
const prizeTitleInput = document.getElementById('prize-title');
const prizeDescInput = document.getElementById('prize-description');
const imagePreview = document.getElementById('image-preview');
const previewImage = document.getElementById('preview-image');
// Set modal title
modalTitle.textContent = prizeId <= 3 ? `Edit ${prizes[prizeId].title}` : "Add Prize Details";
// Set current values if they exist
const prize = prizeId <= 3 ? prizes[prizeId] : additionalPrizes.find(p => p.id === prizeId);
prizeTitleInput.value = prize ? prize.title : "";
prizeDescInput.value = prize ? prize.description : "";
// Handle image preview
if (prize && prize.image) {
previewImage.src = prize.image;
imagePreview.classList.remove('hidden');
} else {
imagePreview.classList.add('hidden');
}
// Show modal
modal.classList.remove('opacity-0', 'pointer-events-none');
setTimeout(() => {
document.querySelector('.modal-content').classList.remove('transform', 'translate-y-20');
}, 10);
}
function closePrizeModal() {
const modal = document.getElementById('prize-modal');
document.querySelector('.modal-content').classList.add('transform', 'translate-y-20');
modal.classList.add('opacity-0', 'pointer-events-none');
setTimeout(() => {
modal.classList.add('pointer-events-none');
}, 300);
// Reset file input
document.getElementById('prize-image-upload').value = '';
}
function previewImage(input) {
const file = input.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
const previewImage = document.getElementById('preview-image');
previewImage.src = e.target.result;
document.getElementById('image-preview').classList.remove('hidden');
}
reader.readAsDataURL(file);
}
}
function savePrizeDetails() {
const prizeTitle = document.getElementById('prize-title').value;
const prizeDesc = document.getElementById('prize-description').value;
const previewImage = document.getElementById('preview-image');
if (!prizeTitle) {
alert("Please enter a prize title");
return;
}
// Save prize details
if (currentPrizeId <= 3) {
prizes[currentPrizeId] = {
title: prizeTitle,
description: prizeDesc,
image: previewImage.src || null
};
} else {
// Handle additional prizes
const existingIndex = additionalPrizes.findIndex(p => p.id === currentPrizeId);
if (existingIndex >= 0) {
additionalPrizes[existingIndex] = {
id: currentPrizeId,
title: prizeTitle,
description: prizeDesc,
image: previewImage.src || null
};
} else {
additionalPrizes.push({
id: currentPrizeId,
title: prizeTitle,
description: prizeDesc,
image: previewImage.src || null
});
}
}
// Update prize card display
updatePrizeCard(currentPrizeId);
// Close modal
closePrizeModal();
}
function updatePrizeCard(prizeId) {
const prizeCard = document.getElementById(`prize-card-${prizeId}`);
const prize = prizeId <= 3 ? prizes[prizeId] : additionalPrizes.find(p => p.id === prizeId);
if (!prize) return;
prizeCard.innerHTML = `
<div class="h-40 bg-gray-100 flex items-center justify-center overflow-hidden">
${prize.image ?
`<img src="${prize.image}" alt="${prize.title}" class="w-full h-full object-cover">` :
`<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>`
}
</div>
<div class="p-4">
<h3 class="text-[20px] font-semibold mb-1">${prize.title}</h3>
<p class="text-[18px] text-gray-600 truncate">${prize.description || "No description provided"}</p>
<button class="mt-2 text-[#CABDFF] text-[16px] font-medium" onclick="event.stopPropagation(); openPrizeModal(${prizeId})">
Edit
</button>
</div>
`;
prizeCard.classList.remove('border-2', 'border-dashed', 'border-gray-300');
prizeCard.classList.add('border', 'border-transparent');
}
function addMorePrizes() {
const newPrizeId = additionalPrizes.length > 0 ?
Math.max(...additionalPrizes.map(p => p.id)) + 1 : 4;
const prizeContainer = document.querySelector('#prize-upload-section .grid');
const newPrizeCard = document.createElement('div');
newPrizeCard.id = `prize-card-${newPrizeId}`;
newPrizeCard.className = 'prize-card bg-white rounded-xl shadow-md overflow-hidden cursor-pointer border-2 border-dashed border-gray-300 hover:border-[#CABDFF] transition-all';
newPrizeCard.onclick = () => openPrizeModal(newPrizeId);
newPrizeCard.innerHTML = `
<div class="h-40 bg-gray-100 flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
</svg>
</div>
<div class="p-4">
<h3 class="text-[20px] font-semibold mb-1">Additional Prize</h3>
<p class="text-[18px] text-gray-600">Click to add prize details</p>
</div>
`;
prizeContainer.appendChild(newPrizeCard);
// Add to additional prizes array
additionalPrizes.push({
id: newPrizeId,
title: "",
description: "",
image: null
});
}
// Section navigation functions
function showPreviewSection() {
// Validate that at least one prize has details
const hasPrizeDetails = Object.values(prizes).some(p => p.title && p.title !== "First Prize" && p.title !== "Second Prize" && p.title !== "Third Prize") ||
additionalPrizes.some(p => p.title);
if (!hasPrizeDetails) {
alert("Please add details for at least one prize before proceeding");
return;
}
// Update progress bar
document.getElementById('progress-bar').style.width = '100%';
// Hide prize upload section
document.getElementById('prize-upload-section').classList.add('hidden');
// Show preview section
document.getElementById('preview-section').classList.remove('hidden');
document.getElementById('preview-section').classList.add('slide-up');
// Populate preview prizes
const previewContainer = document.getElementById('preview-prizes-container');
previewContainer.innerHTML = '';
// Add main prizes
for (const [id, prize] of Object.entries(prizes)) {
if (prize.title && prize.title !== "First Prize" && prize.title !== "Second Prize" && prize.title !== "Third Prize") {
previewContainer.innerHTML += `
<div class="bg-gray-50 p-4 rounded-lg">
<div class="flex items-start">
${prize.image ?
`<img src="${prize.image}" alt="${prize.title}" class="w-16 h-16 object-cover rounded-lg mr-4">` :
`<div class="w-16 h-16 bg-gray-200 rounded-lg mr-4 flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
</div>`
}
<div>
<h4 class="text-[18px] font-medium">${prize.title}</h4>
<p class="text-[16px] text-gray-600">${prize.description || "No description provided"}</p>
</div>
</div>
</div>
`;
}
}
// Add additional prizes
additionalPrizes.forEach(prize => {
if (prize.title) {
previewContainer.innerHTML += `
<div class="bg-gray-50 p-4 rounded-lg">
<div class="flex items-start">
${prize.image ?
`<img src="${prize.image}" alt="${prize.title}" class="w-16 h-16 object-cover rounded-lg mr-4">` :
`<div class="w-16 h-16 bg-gray-200 rounded-lg mr-4 flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
</div>`
}
<div>
<h4 class="text-[18px] font-medium">${prize.title}</h4>
<p class="text-[16px] text-gray-600">${prize.description || "No description provided"}</p>
</div>
</div>
</div>
`;
}
});
}
function backToPrizeUpload() {
// Update progress bar
document.getElementById('progress-bar').style.width = '50%';
// Hide preview section
document.getElementById('preview-section').classList.add('hidden');
document.getElementById('preview-section').classList.remove('slide-up');
// Show prize upload section
document.getElementById('prize-upload-section').classList.remove('hidden');
document.getElementById('prize-upload-section').classList.add('fade-in');
}
function saveAsDraft() {
// In a real app, this would save to a database
alert("Contest saved as draft successfully!");
}
function confirmPublish() {
const modal = document.getElementById('publish-modal');
modal.classList.remove('opacity-0', 'pointer-events-none');
setTimeout(() => {
document.querySelector('#publish-modal .modal-content').classList.remove('transform', 'translate-y-20');
}, 10);
}
function closePublishModal() {
const modal = document.getElementById('publish-modal');
document.querySelector('#publish-modal .modal-content').classList.add('transform', 'translate-y-20');
modal.classList.add('opacity-0', 'pointer-events-none');
setTimeout(() => {
modal.classList.add('pointer-events-none');
}, 300);
}
function publishContest() {
closePublishModal();
// In a real app, this would publish to a database
alert("Contest published successfully!");
// Reset form for demo purposes
setTimeout(() => {
window.location.reload();
}, 1500);
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Design-28/contest" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>