Spaces:
Running
Running
Download admin.html from InacioFlor/storycraft-studio: direct link, hf CLI and curl.
- Browser
- Download file 6.54 kB
-
https://huggingface.co/spaces/InacioFlor/storycraft-studio/resolve/main/admin.html
- Command line
-
hf download hf://spaces/InacioFlor/storycraft-studio/admin.html
-
curl -L -o admin.html https://huggingface.co/spaces/InacioFlor/storycraft-studio/resolve/main/admin.html
6.54 kB
| <html lang="pt-BR"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Administração - Meu Primeiro Livro</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| </head> | |
| <body class="bg-gray-100"> | |
| <div class="min-h-screen"> | |
| <header class="bg-indigo-600 text-white shadow-lg"> | |
| <div class="container mx-auto px-4 py-4 flex justify-between items-center"> | |
| <div class="flex items-center space-x-2"> | |
| <i data-feather="shield" class="w-8 h-8"></i> | |
| <h1 class="text-2xl font-bold">Painel de Administração</h1> | |
| </div> | |
| <nav> | |
| <ul class="flex space-x-6"> | |
| <li><a href="index.html" class="hover:underline">Voltar ao Site</a></li> | |
| </ul> | |
| </nav> | |
| </div> | |
| </header> | |
| <main class="container mx-auto px-4 py-8"> | |
| <div class="grid md:grid-cols-3 gap-8"> | |
| <!-- Estatísticas --> | |
| <div class="bg-white p-6 rounded-lg shadow-md"> | |
| <h3 class="text-xl font-semibold mb-4">Estatísticas</h3> | |
| <div class="space-y-4"> | |
| <div class="flex justify-between items-center"> | |
| <span>Alunos Cadastrados:</span> | |
| <span class="font-bold" id="total-students">0</span> | |
| </div> | |
| <div class="flex justify-between items-center"> | |
| <span>Testes Realizados:</span> | |
| <span class="font-bold" id="total-tests">0</span> | |
| </div> | |
| <div class="flex justify-between items-center"> | |
| <span>Livros Criados:</span> | |
| <span class="font-bold" id="total-books">0</span> | |
| </div> | |
| <div class="flex justify-between items-center"> | |
| <span>Desenhos Salvos:</span> | |
| <span class="font-bold" id="total-drawings">0</span> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Configurações Avançadas --> | |
| <div class="bg-white p-6 rounded-lg shadow-md md:col-span-2"> | |
| <h3 class="text-xl font-semibold mb-4">Configurações Avançadas</h3> | |
| <form> | |
| <div class="grid md:grid-cols-2 gap-4 mb-4"> | |
| <div> | |
| <label class="block text-gray-700 mb-2">Limite de Páginas</label> | |
| <input type="number" id="page-limit" class="w-full px-4 py-2 border rounded-lg"> | |
| </div> | |
| <div> | |
| <label class="block text-gray-700 mb-2">Tamanho Máximo PDF (MB)</label> | |
| <input type="number" id="pdf-size-limit" class="w-full px-4 py-2 border rounded-lg"> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-gray-700 mb-2">Mensagem de Boas-Vindas</label> | |
| <textarea id="welcome-message" class="w-full px-4 py-2 border rounded-lg" rows="3"></textarea> | |
| </div> | |
| <button type="button" class="w-full bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-2 px-4 rounded-lg"> | |
| Salvar Configurações | |
| </button> | |
| </form> | |
| </div> | |
| </div> | |
| <!-- Exportar Dados --> | |
| <div class="mt-8 bg-white p-6 rounded-lg shadow-md"> | |
| <h3 class="text-xl font-semibold mb-4">Exportar Dados</h3> | |
| <div class="grid md:grid-cols-3 gap-4"> | |
| <button class="bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded-lg flex items-center justify-center"> | |
| <i data-feather="download" class="mr-2"></i> Exportar Alunos | |
| </button> | |
| <button class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg flex items-center justify-center"> | |
| <i data-feather="download" class="mr-2"></i> Exportar Livros | |
| </button> | |
| <button class="bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded-lg flex items-center justify-center"> | |
| <i data-feather="download" class="mr-2"></i> Exportar Tudo | |
| </button> | |
| </div> | |
| </div> | |
| </main> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', async function() { | |
| feather.replace(); | |
| const token = localStorage.getItem('token'); | |
| try { | |
| // Load users | |
| const usersResponse = await fetch('/api/users', { | |
| headers: { | |
| 'Authorization': `Bearer ${token}` | |
| } | |
| }); | |
| if (usersResponse.ok) { | |
| const users = await usersResponse.json(); | |
| document.getElementById('total-students').textContent = users.length; | |
| } else { | |
| throw new Error('Failed to load users'); | |
| } | |
| // Load books count | |
| const booksResponse = await fetch('/api/books'); | |
| if (booksResponse.ok) { | |
| const books = await booksResponse.json(); | |
| document.getElementById('total-books').textContent = books.length; | |
| } else { | |
| throw new Error('Failed to load books'); | |
| } | |
| } catch (err) { | |
| console.error('Admin error:', err); | |
| alert('Você precisa estar logado como administrador para acessar esta página'); | |
| window.location.href = 'index.html'; | |
| } | |
| }); | |
| </script> | |
| </div> | |
| </body> | |
| </html> |