Spaces:
Running
Running
criar uma opcao de as pessoas ver meus projetos feitos e criar uma aba de admin para mim adicionar os projetoa
6683b00 verified Download admin.html from iohidubudi/undefined: direct link, hf CLI and curl.
- Browser
- Download file 8.1 kB
-
https://huggingface.co/spaces/iohidubudi/undefined/resolve/main/admin.html
- Command line
-
hf download hf://spaces/iohidubudi/undefined/admin.html
-
curl -L -o admin.html https://huggingface.co/spaces/iohidubudi/undefined/resolve/main/admin.html
8.1 kB
| <html lang="pt-BR"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Admin - Gerenciar Projetos</title> | |
| <link rel="icon" type="image/x-icon" href="/static/favicon.ico"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| <style> | |
| .glass-effect { | |
| background: rgba(74, 47, 144, 0.15); | |
| backdrop-filter: blur(10px); | |
| border: 1px solid rgba(255, 255, 255, 0.1); | |
| } | |
| .gradient-bg { | |
| background: linear-gradient(135deg, #4a2f90 0%, #1a1a40 100%); | |
| } | |
| </style> | |
| </head> | |
| <body class="min-h-screen gradient-bg text-white font-sans"> | |
| <!-- Check if admin is logged in --> | |
| <div id="loginCheck" class="hidden"></div> | |
| <nav class="glass-effect rounded-full mx-4 mt-4 p-3 mb-8"> | |
| <div class="container mx-auto flex justify-between items-center"> | |
| <div class="flex items-center"> | |
| <i data-feather="settings" class="text-purple-400 mr-2"></i> | |
| <span class="text-xl font-bold">Admin - Gerenciar Projetos</span> | |
| </div> | |
| <div class="flex space-x-4"> | |
| <a href="projetos.html" class="hover:text-purple-300 transition-colors">Ver Projetos</a> | |
| <a href="index.html" class="hover:text-purple-300 transition-colors">Voltar ao Site</a> | |
| <button onclick="logout()" class="bg-red-600 hover:bg-red-700 px-4 py-2 rounded-full transition-colors"> | |
| Sair | |
| </button> | |
| </div> | |
| </div> | |
| </nav> | |
| <main class="container mx-auto px-4"> | |
| <div class="glass-effect rounded-2xl p-8 mb-8"> | |
| <h2 class="text-3xl font-bold mb-6">Adicionar Novo Projeto</h2> | |
| <form id="addProjectForm" class="grid md:grid-cols-2 gap-6"> | |
| <div> | |
| <label class="block mb-2 font-semibold">Título do Projeto</label> | |
| <input type="text" id="projectTitle" required class="w-full p-3 rounded-lg bg-purple-800/30 border border-purple-600"> | |
| </div> | |
| <div> | |
| <label class="block mb-2 font-semibold">Categoria</label> | |
| <select id="projectCategory" required class="w-full p-3 rounded-lg bg-purple-800/30 border border-purple-600"> | |
| <option value="">Selecione a Categoria</option> | |
| <option value="Website">Website</option> | |
| <option value="Aplicativo">Aplicativo</option> | |
| <option value="Cardápio">Cardápio Digital</option> | |
| <option value="Sistema">Sistema Personalizado</option> | |
| <option value="E-commerce">E-commerce</option> | |
| <option value="API">API</option> | |
| </select> | |
| </div> | |
| <div class="md:col-span-2"> | |
| <label class="block mb-2 font-semibold">Descrição</label> | |
| <textarea id="projectDescription" required rows="3" class="w-full p-3 rounded-lg bg-purple-800/30 border border-purple-600"></textarea> | |
| </div> | |
| <div> | |
| <label class="block mb-2 font-semibold">URL da Imagem</label> | |
| <input type="url" id="projectImage" required class="w-full p-3 rounded-lg bg-purple-800/30 border border-purple-600" placeholder="http://static.photos/technology/640x360/1"> | |
| </div> | |
| <div> | |
| <label class="block mb-2 font-semibold">Tecnologias (separadas por vírgula)</label> | |
| <input type="text" id="projectTechnologies" required class="w-full p-3 rounded-lg bg-purple-800/30 border border-purple-600" placeholder="React, Node.js, MongoDB"> | |
| </div> | |
| <div class="md:col-span-2"> | |
| <button type="submit" class="w-full bg-purple-600 hover:bg-purple-700 py-3 rounded-lg font-semibold"> | |
| Adicionar Projeto | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| <div class="glass-effect rounded-2xl p-8"> | |
| <h2 class="text-3xl font-bold mb-6">Projetos Existentes</h2> | |
| <div id="projectsList" class="space-y-4"> | |
| <!-- Projects will be listed here --> | |
| <div class="text-center text-purple-300">Carregando projetos...</div> | |
| </div> | |
| </div> | |
| </main> | |
| <script> | |
| // Check if admin is logged in | |
| function checkAdminLogin() { | |
| const isLoggedIn = localStorage.getItem('adminLoggedIn') === 'true'; | |
| if (!isLoggedIn) { | |
| alert('Acesso não autorizado. Redirecionando...'); | |
| window.location.href = 'index.html'; | |
| } | |
| } | |
| // Logout function | |
| function logout() { | |
| localStorage.removeItem('adminLoggedIn'); | |
| window.location.href = 'index.html'; | |
| } | |
| // Load existing projects | |
| function loadProjects() { | |
| const projectsList = document.getElementById('projectsList'); | |
| const projects = JSON.parse(localStorage.getItem('projects')) || []; | |
| if (projects.length === 0) { | |
| projectsList.innerHTML = '<div class="text-center text-purple-300">Nenhum projeto cadastrado ainda.</div>'; | |
| return; | |
| } | |
| projectsList.innerHTML = ''; | |
| projects.forEach((project, index) => { | |
| projectsList.innerHTML += ` | |
| <div class="glass-effect rounded-xl p-4 flex justify-between items-center"> | |
| <div> | |
| <h3 class="font-semibold">${project.title}</h3> | |
| <span class="text-sm text-purple-300">${project.category}</span> | |
| </div> | |
| <button onclick="deleteProject(${index})" class="bg-red-600 hover:bg-red-700 px-3 py-1 rounded transition-colors"> | |
| <i data-feather="trash-2" class="w-4 h-4"></i> | |
| </button> | |
| </div> | |
| `; | |
| }); | |
| feather.replace(); | |
| } | |
| // Add new project | |
| function addProject(event) { | |
| event.preventDefault(); | |
| const newProject = { | |
| title: document.getElementById('projectTitle').value, | |
| category: document.getElementById('projectCategory').value, | |
| description: document.getElementById('projectDescription').value, | |
| image: document.getElementById('projectImage').value, | |
| technologies: document.getElementById('projectTechnologies').value.split(',').map(tech => tech.trim()) | |
| }; | |
| const projects = JSON.parse(localStorage.getItem('projects')) || []; | |
| projects.push(newProject); | |
| localStorage.setItem('projects', JSON.stringify(projects)); | |
| // Reset form | |
| document.getElementById('addProjectForm').reset(); | |
| // Reload projects list | |
| loadProjects(); | |
| alert('Projeto adicionado com sucesso!'); | |
| } | |
| // Delete project | |
| function deleteProject(index) { | |
| if (confirm('Tem certeza que deseja excluir este projeto?')) { | |
| const projects = JSON.parse(localStorage.getItem('projects')) || []; | |
| projects.splice(index, 1); | |
| localStorage.setItem('projects', JSON.stringify(projects)); | |
| loadProjects(); | |
| } | |
| } | |
| // Initialize | |
| document.addEventListener('DOMContentLoaded', function() { | |
| checkAdminLogin(); | |
| feather.replace(); | |
| loadProjects(); | |
| document.getElementById('addProjectForm').addEventListener('submit', addProject); | |
| }); | |
| </script> | |
| </body> | |
| </html> |