Spaces:
Running
Running
| {% extends "base.html" %} | |
| {% block content %} | |
| <div class="max-w-7xl mx-auto px-4 sm:px-6"> | |
| <div class="mb-8"> | |
| <div class="flex flex-col-reverse sm:flex-row sm:items-start sm:justify-between gap-4 mb-4"> | |
| <h1 class="font-display text-4xl sm:text-5xl font-bold tracking-tight"> | |
| <span class="bg-gradient-to-r from-purple-400 to-pink-500 bg-clip-text text-transparent"> | |
| Manage Users | |
| </span> | |
| </h1> | |
| <a href="{{ url_for('admin.dashboard') }}" class="inline-flex items-center gap-2 font-mono text-sm text-gray-400 hover:text-purple-400 transition whitespace-nowrap"> | |
| <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/> | |
| </svg> | |
| Back to Dashboard | |
| </a> | |
| </div> | |
| </div> | |
| <div class="glass rounded-2xl overflow-hidden hidden md:block"> | |
| <div class="overflow-x-auto"> | |
| <table class="w-full"> | |
| <thead class="bg-white/5 border-b border-white/10"> | |
| <tr> | |
| <th class="px-6 py-4 text-left font-mono text-sm text-gray-400 whitespace-nowrap">ID</th> | |
| <th class="px-6 py-4 text-left font-mono text-sm text-gray-400 whitespace-nowrap">Name</th> | |
| <th class="px-6 py-4 text-left font-mono text-sm text-gray-400 whitespace-nowrap">Email</th> | |
| <th class="px-6 py-4 text-left font-mono text-sm text-gray-400 whitespace-nowrap">Admin</th> | |
| <th class="px-6 py-4 text-right font-mono text-sm text-gray-400 whitespace-nowrap">Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| {% for user in users %} | |
| <tr class="border-b border-white/5 hover:bg-white/5 transition"> | |
| <td class="px-6 py-4 font-mono text-sm whitespace-nowrap">{{ user.id }}</td> | |
| <td class="px-6 py-4 font-mono whitespace-nowrap">{{ user.name }}</td> | |
| <td class="px-6 py-4 font-mono text-sm text-gray-400 whitespace-nowrap">{{ user.email }}</td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| {% if user.is_admin %} | |
| <span class="px-3 py-1 bg-purple-500/20 border border-purple-500/50 rounded-lg font-mono text-xs">Admin</span> | |
| {% else %} | |
| <span class="px-3 py-1 bg-gray-500/20 border border-gray-500/50 rounded-lg font-mono text-xs">User</span> | |
| {% endif %} | |
| </td> | |
| <td class="px-6 py-4 text-right whitespace-nowrap"> | |
| <form method="POST" action="{{ url_for('admin.toggle_admin', id=user.id) }}" class="inline"> | |
| <button type="submit" class="px-4 py-2 {% if user.is_admin %}bg-red-500/20 border-red-500/50{% else %}bg-green-500/20 border-green-500/50{% endif %} border rounded-lg font-mono text-sm hover:opacity-80 transition"> | |
| {{ 'Revoke Admin' if user.is_admin else 'Grant Admin' }} | |
| </button> | |
| </form> | |
| </td> | |
| </tr> | |
| {% endfor %} | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| <div class="space-y-3 md:hidden"> | |
| {% for user in users %} | |
| <div class="glass rounded-xl p-4"> | |
| <div class="flex items-center justify-between mb-2"> | |
| <p class="font-mono text-xs text-gray-500">#{{ user.id }}</p> | |
| {% if user.is_admin %} | |
| <span class="px-2 py-1 bg-purple-500/20 border border-purple-500/50 rounded-lg font-mono text-[10px]">Admin</span> | |
| {% else %} | |
| <span class="px-2 py-1 bg-gray-500/20 border border-gray-500/50 rounded-lg font-mono text-[10px]">User</span> | |
| {% endif %} | |
| </div> | |
| <p class="font-mono text-sm mb-1">{{ user.name }}</p> | |
| <p class="font-mono text-xs text-gray-400 break-all mb-3">{{ user.email }}</p> | |
| <form method="POST" action="{{ url_for('admin.toggle_admin', id=user.id) }}"> | |
| <button type="submit" class="w-full px-3 py-2 {% if user.is_admin %}bg-red-500/20 border-red-500/50{% else %}bg-green-500/20 border-green-500/50{% endif %} border rounded-lg font-mono text-xs hover:opacity-80 transition"> | |
| {{ 'Revoke Admin' if user.is_admin else 'Grant Admin' }} | |
| </button> | |
| </form> | |
| </div> | |
| {% endfor %} | |
| </div> | |
| </div> | |
| {% endblock %} | |