guliavansh's picture
Admin can add winning coin to player wallet by the ingame name of the result - Initial Deployment
354da6d verified
Raw History Blame Contribute Delete
18.3 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin - Add Winning Coins</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #888;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
/* Animation for notification */
@keyframes slideIn {
from { transform: translateX(100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
from { transform: translateX(0); opacity: 1; }
to { transform: translateX(100%); opacity: 0; }
}
.notification-slide-in {
animation: slideIn 0.3s forwards;
}
.notification-slide-out {
animation: slideOut 0.3s forwards;
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<div class="min-h-screen flex flex-col md:flex-row">
<!-- Sidebar -->
<div class="bg-indigo-800 text-white w-full md:w-64 p-4 md:min-h-screen">
<div class="flex items-center justify-between md:justify-center md:flex-col mb-8">
<div class="flex items-center space-x-2">
<i class="fas fa-coins text-2xl text-yellow-400"></i>
<h1 class="text-xl font-bold">Game Admin</h1>
</div>
<button class="md:hidden text-white focus:outline-none" id="sidebarToggle">
<i class="fas fa-bars"></i>
</button>
</div>
<nav class="space-y-2 hidden md:block" id="sidebarMenu">
<a href="#" class="block py-2 px-4 rounded hover:bg-indigo-700 transition">
<i class="fas fa-tachometer-alt mr-2"></i> Dashboard
</a>
<a href="#" class="block py-2 px-4 rounded bg-indigo-900 hover:bg-indigo-700 transition">
<i class="fas fa-coins mr-2"></i> Add Coins
</a>
<a href="#" class="block py-2 px-4 rounded hover:bg-indigo-700 transition">
<i class="fas fa-users mr-2"></i> Players
</a>
<a href="#" class="block py-2 px-4 rounded hover:bg-indigo-700 transition">
<i class="fas fa-gamepad mr-2"></i> Games
</a>
<a href="#" class="block py-2 px-4 rounded hover:bg-indigo-700 transition">
<i class="fas fa-cog mr-2"></i> Settings
</a>
<a href="#" class="block py-2 px-4 rounded hover:bg-indigo-700 transition">
<i class="fas fa-sign-out-alt mr-2"></i> Logout
</a>
</nav>
</div>
<!-- Main Content -->
<div class="flex-1 p-6">
<div class="max-w-4xl mx-auto">
<div class="flex justify-between items-center mb-8">
<h2 class="text-2xl font-bold text-gray-800">Add Winning Coins to Player</h2>
<div class="flex items-center space-x-2">
<span class="bg-indigo-100 text-indigo-800 text-xs font-medium px-2.5 py-0.5 rounded-full">Admin</span>
<img src="https://randomuser.me/api/portraits/men/1.jpg" alt="Admin" class="w-8 h-8 rounded-full">
</div>
</div>
<!-- Stats Cards -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-8">
<div class="bg-white p-4 rounded-lg shadow">
<div class="flex justify-between items-center">
<div>
<p class="text-gray-500 text-sm">Total Players</p>
<h3 class="text-2xl font-bold">1,248</h3>
</div>
<div class="bg-blue-100 p-3 rounded-full">
<i class="fas fa-users text-blue-500"></i>
</div>
</div>
</div>
<div class="bg-white p-4 rounded-lg shadow">
<div class="flex justify-between items-center">
<div>
<p class="text-gray-500 text-sm">Total Coins</p>
<h3 class="text-2xl font-bold">5.2M</h3>
</div>
<div class="bg-green-100 p-3 rounded-full">
<i class="fas fa-coins text-green-500"></i>
</div>
</div>
</div>
<div class="bg-white p-4 rounded-lg shadow">
<div class="flex justify-between items-center">
<div>
<p class="text-gray-500 text-sm">Today's Transactions</p>
<h3 class="text-2xl font-bold">87</h3>
</div>
<div class="bg-purple-100 p-3 rounded-full">
<i class="fas fa-exchange-alt text-purple-500"></i>
</div>
</div>
</div>
</div>
<!-- Add Coins Form -->
<div class="bg-white p-6 rounded-lg shadow">
<div class="mb-6">
<h3 class="text-lg font-semibold text-gray-800">Add Winning Coins</h3>
<p class="text-gray-600 text-sm">Add coins to player's wallet by their in-game name</p>
</div>
<form id="addCoinsForm" class="space-y-4">
<div>
<label for="gameName" class="block text-sm font-medium text-gray-700 mb-1">Game Name</label>
<select id="gameName" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500">
<option value="">Select a game</option>
<option value="dragon_quest">Dragon Quest</option>
<option value="treasure_hunt">Treasure Hunt</option>
<option value="space_adventure">Space Adventure</option>
<option value="kingdom_rush">Kingdom Rush</option>
<option value="puzzle_challenge">Puzzle Challenge</option>
</select>
<p id="gameNameError" class="mt-1 text-sm text-red-600 hidden">Please select a game</p>
</div>
<div>
<label for="playerName" class="block text-sm font-medium text-gray-700 mb-1">Player In-Game Name</label>
<input type="text" id="playerName" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500" placeholder="Enter player's in-game name">
<p id="playerNameError" class="mt-1 text-sm text-red-600 hidden">Please enter a valid in-game name</p>
</div>
<div>
<label for="coinAmount" class="block text-sm font-medium text-gray-700 mb-1">Coin Amount</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-coins text-gray-400"></i>
</div>
<input type="number" id="coinAmount" class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500" placeholder="Enter coin amount">
</div>
<p id="coinAmountError" class="mt-1 text-sm text-red-600 hidden">Please enter a valid amount (minimum 10 coins)</p>
</div>
<div>
<label for="transactionNote" class="block text-sm font-medium text-gray-700 mb-1">Transaction Note</label>
<textarea id="transactionNote" rows="3" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500" placeholder="Optional note about this transaction"></textarea>
</div>
<div class="pt-2">
<button type="submit" class="w-full bg-indigo-600 text-white py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition flex items-center justify-center">
<i class="fas fa-plus-circle mr-2"></i> Add Coins to Wallet
</button>
</div>
</form>
</div>
<!-- Recent Transactions -->
<div class="mt-8 bg-white p-6 rounded-lg shadow">
<div class="mb-6">
<h3 class="text-lg font-semibold text-gray-800">Recent Coin Transactions</h3>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Player</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Game</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Amount</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-07-15 14:32</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">DragonSlayer42</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Dragon Quest</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 font-medium">+500</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Completed</span>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-07-15 11:45</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">SpaceExplorer</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Space Adventure</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 font-medium">+250</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Completed</span>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-07-14 19:18</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">PuzzleMaster</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Puzzle Challenge</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-green-600 font-medium">+750</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Completed</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- Notification -->
<div id="notification" class="fixed bottom-4 right-4 hidden">
<div class="bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg flex items-center">
<i class="fas fa-check-circle mr-2"></i>
<span id="notificationMessage">Coins added successfully!</span>
<button onclick="hideNotification()" class="ml-4 focus:outline-none">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<script>
// Toggle mobile sidebar
document.getElementById('sidebarToggle').addEventListener('click', function() {
const sidebar = document.getElementById('sidebarMenu');
sidebar.classList.toggle('hidden');
});
// Form validation and submission
document.getElementById('addCoinsForm').addEventListener('submit', function(e) {
e.preventDefault();
// Reset errors
document.getElementById('gameNameError').classList.add('hidden');
document.getElementById('playerNameError').classList.add('hidden');
document.getElementById('coinAmountError').classList.add('hidden');
// Get values
const gameName = document.getElementById('gameName').value;
const playerName = document.getElementById('playerName').value.trim();
const coinAmount = document.getElementById('coinAmount').value;
// Validate
let isValid = true;
if (!gameName) {
document.getElementById('gameNameError').classList.remove('hidden');
isValid = false;
}
if (!playerName || playerName.length < 3) {
document.getElementById('playerNameError').classList.remove('hidden');
isValid = false;
}
if (!coinAmount || isNaN(coinAmount) || parseInt(coinAmount) < 10) {
document.getElementById('coinAmountError').classList.remove('hidden');
isValid = false;
}
if (isValid) {
// In a real app, you would send this data to your backend
console.log('Submitting:', {
gameName,
playerName,
coinAmount,
note: document.getElementById('transactionNote').value
});
// Show success notification
showNotification('Successfully added ' + coinAmount + ' coins to ' + playerName + "'s wallet");
// Reset form
this.reset();
}
});
// Notification functions
function showNotification(message) {
const notification = document.getElementById('notification');
const messageElement = document.getElementById('notificationMessage');
messageElement.textContent = message;
notification.classList.remove('hidden');
notification.classList.add('notification-slide-in');
notification.classList.remove('notification-slide-out');
// Auto-hide after 5 seconds
setTimeout(hideNotification, 5000);
}
function hideNotification() {
const notification = document.getElementById('notification');
notification.classList.add('notification-slide-out');
setTimeout(() => {
notification.classList.add('hidden');
}, 300);
}
</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=guliavansh/https-complete-gaming-tour-jpsy-bolt-host" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>