runtof's picture
create a website's administrator console (website for sudoku players) which give visibility of all users in order to administrate their status, datas, and also to make mailing campaigns, and to look at a dashboard with kpi like number of players per hour, their country with a map
4cc2778 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SudokuSage Admin Console</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: {
500: '#d946ef',
},
secondary: {
500: '#10b981',
}
}
}
}
}
</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/apexcharts"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.8.2/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/3.0.2/topojson.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datamaps/0.5.9/datamaps.world.min.js"></script>
</head>
<body class="bg-gray-100 font-sans">
<!-- Sidebar -->
<div class="flex h-screen">
<div class="w-64 bg-white shadow-lg">
<div class="p-4 border-b border-gray-200">
<h1 class="text-xl font-bold text-primary-500 flex items-center">
<i data-feather="grid" class="mr-2"></i> SudokuSage
</h1>
</div>
<nav class="p-4">
<ul>
<li class="mb-2">
<a href="#" class="flex items-center px-4 py-2 rounded-lg bg-primary-500 text-white">
<i data-feather="home" class="mr-2"></i> Dashboard
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center px-4 py-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i data-feather="users" class="mr-2"></i> Users
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center px-4 py-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i data-feather="mail" class="mr-2"></i> Mailing
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center px-4 py-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i data-feather="settings" class="mr-2"></i> Settings
</a>
</li>
<li class="mb-2">
<a href="#" class="flex items-center px-4 py-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i data-feather="help-circle" class="mr-2"></i> Help
</a>
</li>
</ul>
</nav>
</div>
<!-- Main Content -->
<div class="flex-1 overflow-auto">
<!-- Header -->
<header class="bg-white shadow-sm p-4 flex justify-between items-center">
<h2 class="text-xl font-semibold text-gray-800">Admin Dashboard</h2>
<div class="flex items-center space-x-4">
<div class="relative">
<i data-feather="search" class="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
<input type="text" placeholder="Search..." class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent">
</div>
<div class="flex items-center">
<div class="relative">
<i data-feather="bell" class="text-gray-500"></i>
<span class="absolute -top-1 -right-1 bg-secondary-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center">3</span>
</div>
<div class="ml-4 flex items-center">
<img src="http://static.photos/technology/200x200/1" alt="Admin" class="h-8 w-8 rounded-full">
<span class="ml-2 text-sm font-medium">Admin User</span>
</div>
</div>
</div>
</header>
<!-- Dashboard Content -->
<main class="p-6">
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
<!-- Stats Cards -->
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-500">Total Players</p>
<h3 class="text-2xl font-bold text-gray-800">12,345</h3>
<p class="text-green-500 flex items-center text-sm">
<i data-feather="arrow-up" class="mr-1"></i> 12% from last week
</p>
</div>
<div class="bg-primary-100 p-3 rounded-full">
<i data-feather="users" class="text-primary-500"></i>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-500">Active Now</p>
<h3 class="text-2xl font-bold text-gray-800">1,234</h3>
<p class="text-secondary-500 flex items-center text-sm">
<i data-feather="activity" class="mr-1"></i> 34 in last hour
</p>
</div>
<div class="bg-secondary-100 p-3 rounded-full">
<i data-feather="eye" class="text-secondary-500"></i>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-500">Avg. Session</p>
<h3 class="text-2xl font-bold text-gray-800">18m 45s</h3>
<p class="text-primary-500 flex items-center text-sm">
<i data-feather="clock" class="mr-1"></i> 2m longer than last month
</p>
</div>
<div class="bg-gray-100 p-3 rounded-full">
<i data-feather="watch" class="text-gray-500"></i>
</div>
</div>
</div>
</div>
<!-- Charts and Map -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
<!-- Activity Chart -->
<div class="bg-white rounded-lg shadow p-6">
<h3 class="text-lg font-semibold text-gray-800 mb-4">Player Activity (Last 24 Hours)</h3>
<div id="activityChart" style="height: 300px;"></div>
</div>
<!-- Geographical Distribution -->
<div class="bg-white rounded-lg shadow p-6">
<h3 class="text-lg font-semibold text-gray-800 mb-4">Player Geographical Distribution</h3>
<div id="worldMap" style="height: 300px;"></div>
</div>
</div>
<!-- Recent Users Table -->
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="p-6 border-b border-gray-200 flex justify-between items-center">
<h3 class="text-lg font-semibold text-gray-800">Recent Players</h3>
<button class="text-primary-500 hover:text-primary-700 text-sm font-medium flex items-center">
<i data-feather="download" class="mr-1"></i> Export
</button>
</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">Player</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Level</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Last Active</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Country</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<img class="h-10 w-10 rounded-full" src="http://static.photos/people/200x200/1" alt="">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Jane Cooper</div>
<div class="text-sm text-gray-500">jane@example.com</div>
</div>
</div>
</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">Active</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Expert</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2 minutes ago</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">United States</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-primary-500 hover:text-primary-700 mr-3">Edit</a>
<a href="#" class="text-red-500 hover:text-red-700">Ban</a>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<img class="h-10 w-10 rounded-full" src="http://static.photos/people/200x200/2" alt="">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">John Smith</div>
<div class="text-sm text-gray-500">john@example.com</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">Inactive</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Intermediate</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">1 day ago</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">United Kingdom</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-primary-500 hover:text-primary-700 mr-3">Edit</a>
<a href="#" class="text-red-500 hover:text-red-700">Ban</a>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<img class="h-10 w-10 rounded-full" src="http://static.photos/people/200x200/3" alt="">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Alex Wong</div>
<div class="text-sm text-gray-500">alex@example.com</div>
</div>
</div>
</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">Active</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Beginner</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">15 minutes ago</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Singapore</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-primary-500 hover:text-primary-700 mr-3">Edit</a>
<a href="#" class="text-red-500 hover:text-red-700">Ban</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="bg-gray-50 px-6 py-3 flex items-center justify-between border-t border-gray-200">
<div class="flex-1 flex justify-between sm:hidden">
<a href="#" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">Previous</a>
<a href="#" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">Next</a>
</div>
<div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
<div>
<p class="text-sm text-gray-700">
Showing <span class="font-medium">1</span> to <span class="font-medium">3</span> of <span class="font-medium">12,345</span> results
</p>
</div>
<div>
<nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination">
<a href="#" class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
<span class="sr-only">Previous</span>
<i data-feather="chevron-left" class="h-5 w-5"></i>
</a>
<a href="#" aria-current="page" class="z-10 bg-primary-50 border-primary-500 text-primary-600 relative inline-flex items-center px-4 py-2 border text-sm font-medium">1</a>
<a href="#" class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium">2</a>
<a href="#" class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium">3</a>
<span class="relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-700">...</span>
<a href="#" class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium">8</a>
<a href="#" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
<span class="sr-only">Next</span>
<i data-feather="chevron-right" class="h-5 w-5"></i>
</a>
</nav>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
<script>
// Initialize feather icons
feather.replace();
// Activity Chart
document.addEventListener('DOMContentLoaded', function() {
// Activity Chart (using Chart.js)
const activityCtx = document.createElement('canvas');
document.getElementById('activityChart').appendChild(activityCtx);
const activityChart = new Chart(activityCtx, {
type: 'line',
data: {
labels: Array.from({length: 24}, (_, i) => `${i}:00`),
datasets: [{
label: 'Players Online',
data: [120, 190, 300, 500, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1100, 1000, 900, 800, 700, 600, 500, 400, 300],
backgroundColor: 'rgba(217, 70, 239, 0.1)',
borderColor: 'rgba(217, 70, 239, 1)',
borderWidth: 2,
tension: 0.4,
fill: true
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
grid: {
display: true,
color: 'rgba(0, 0, 0, 0.05)'
}
},
x: {
grid: {
display: false
}
}
}
}
});
// World Map (using DataMaps)
const mapContainer = document.getElementById('worldMap');
const worldMap = new Datamap({
element: mapContainer,
responsive: true,
geographyConfig: {
highlightFillColor: '#10b981',
highlightBorderColor: 'rgba(255, 255, 255, 0.2)',
highlightBorderWidth: 1,
popupOnHover: false
},
fills: {
defaultFill: '#e5e7eb',
active: '#10b981',
gt50: '#a7f3d0'
},
data: {
USA: { fillKey: 'active' },
GBR: { fillKey: 'gt50' },
IND: { fillKey: 'gt50' },
BRA: { fillKey: 'gt50' },
DEU: { fillKey: 'gt50' },
FRA: { fillKey: 'gt50' },
SGP: { fillKey: 'active' }
}
});
// Handle window resize
window.addEventListener('resize', function() {
worldMap.resize();
activityChart.resize();
});
});
</script>
</body>
</html>