Download index.html from caic1995/trabalho: direct link, hf CLI and curl.
- Browser
- Download file 44.4 kB
-
https://huggingface.co/spaces/caic1995/trabalho/resolve/main/index.html
- Command line
-
hf download hf://spaces/caic1995/trabalho/index.html
-
curl -L -o index.html https://huggingface.co/spaces/caic1995/trabalho/resolve/main/index.html
44.4 kB
| <html lang="pt-BR"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Matriz Eisenhower de Tarefas</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> | |
| body { | |
| width: 100%; | |
| height: 100%; | |
| margin: 0; | |
| padding: 0; | |
| overflow: hidden; | |
| -webkit-app-region: drag; | |
| } | |
| .quadrante { | |
| min-height: 200px; | |
| transition: all 0.3s ease; | |
| } | |
| .quadrante:hover { | |
| transform: translateY(-5px); | |
| box-shadow: 0 10px 20px rgba(0,0,0,0.1); | |
| } | |
| .item-tarefa { | |
| transition: all 0.2s ease; | |
| cursor: pointer; | |
| -webkit-app-region: no-drag; | |
| } | |
| .item-tarefa:hover { | |
| background-color: rgba(255,255,255,0.2); | |
| } | |
| .concluida { | |
| text-decoration: line-through; | |
| opacity: 0.7; | |
| } | |
| .badge-data { | |
| font-size: 0.75rem; | |
| padding: 0.15rem 0.4rem; | |
| border-radius: 9999px; | |
| } | |
| .modal { | |
| transition: all 0.3s ease; | |
| } | |
| .modal-aberto { | |
| opacity: 1; | |
| pointer-events: auto; | |
| } | |
| .item-subtarefa { | |
| transition: all 0.2s ease; | |
| -webkit-app-region: no-drag; | |
| } | |
| .item-subtarefa:hover { | |
| background-color: rgba(0,0,0,0.05); | |
| } | |
| .area-descricao { | |
| min-height: 100px; | |
| resize: none; | |
| -webkit-app-region: no-drag; | |
| } | |
| .cartao-tarefa { | |
| max-height: 80vh; | |
| overflow-y: auto; | |
| } | |
| .entrada-data-editar { | |
| width: 120px; | |
| } | |
| .window-controls { | |
| -webkit-app-region: no-drag; | |
| } | |
| input, textarea, button, select { | |
| -webkit-app-region: no-drag; | |
| } | |
| .app-container { | |
| width: 100vw; | |
| height: 100vh; | |
| overflow: hidden; | |
| } | |
| .tray-icon { | |
| position: absolute; | |
| right: 10px; | |
| top: 50%; | |
| transform: translateY(-50%); | |
| -webkit-app-region: no-drag; | |
| } | |
| .settings-menu { | |
| display: none; | |
| position: absolute; | |
| right: 10px; | |
| top: 40px; | |
| background: white; | |
| border-radius: 8px; | |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
| z-index: 100; | |
| width: 200px; | |
| padding: 8px 0; | |
| -webkit-app-region: no-drag; | |
| } | |
| .settings-menu.show { | |
| display: block; | |
| } | |
| .settings-item { | |
| padding: 8px 16px; | |
| cursor: pointer; | |
| font-size: 14px; | |
| } | |
| .settings-item:hover { | |
| background-color: #f3f4f6; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100"> | |
| <div class="app-container"> | |
| <div class="bg-gray-800 text-white p-2 flex justify-between items-center"> | |
| <div class="flex items-center"> | |
| <i class="fas fa-tasks mr-2"></i> | |
| <span class="font-semibold">Matriz Eisenhower</span> | |
| </div> | |
| <div class="flex items-center"> | |
| <div class="relative"> | |
| <button id="settings-btn" class="text-gray-300 hover:text-white mr-2"> | |
| <i class="fas fa-cog"></i> | |
| </button> | |
| <div id="settings-menu" class="settings-menu"> | |
| <div class="settings-item" onclick="toggleStartup()"> | |
| <i class="fas fa-power-off mr-2"></i> | |
| <span id="startup-text">Iniciar com Windows</span> | |
| </div> | |
| <div class="settings-item" onclick="changeDataLocation()"> | |
| <i class="fas fa-folder-open mr-2"></i> | |
| Alterar local dos dados | |
| </div> | |
| <div class="settings-item" onclick="minimizeToTray()"> | |
| <i class="fas fa-window-minimize mr-2"></i> | |
| Minimizar para bandeja | |
| </div> | |
| <div class="settings-item" onclick="exportData()"> | |
| <i class="fas fa-file-export mr-2"></i> | |
| Exportar dados | |
| </div> | |
| <div class="settings-item" onclick="importData()"> | |
| <i class="fas fa-file-import mr-2"></i> | |
| Importar dados | |
| </div> | |
| </div> | |
| </div> | |
| <div class="window-controls flex space-x-2"> | |
| <button id="minimize-btn" class="bg-gray-700 hover:bg-gray-600 w-6 h-6 rounded-full flex items-center justify-center"> | |
| <i class="fas fa-minus text-xs"></i> | |
| </button> | |
| <button id="close-btn" class="bg-red-500 hover:bg-red-600 w-6 h-6 rounded-full flex items-center justify-center"> | |
| <i class="fas fa-times text-xs"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="container mx-auto px-4 py-4 overflow-auto" style="max-height: calc(100vh - 40px);"> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4"> | |
| <!-- Quadrante 1: Urgente & Importante --> | |
| <div class="quadrante bg-red-100 rounded-lg shadow-lg p-4"> | |
| <div class="flex justify-between items-center mb-3"> | |
| <h2 class="text-lg font-semibold text-red-800">Urgente & Importante</h2> | |
| <span class="bg-red-200 text-red-800 px-2 py-1 rounded-full text-xs">Faça Primeiro</span> | |
| </div> | |
| <div class="mb-3 flex"> | |
| <input type="text" id="entradaTarefa1" placeholder="Adicionar tarefa..." class="flex-grow px-3 py-1 rounded-l-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-red-500 text-sm"> | |
| <input type="date" id="entradaData1" class="border border-gray-300 px-2 text-sm"> | |
| <button onclick="adicionarTarefa(1)" class="bg-red-500 text-white px-3 py-1 rounded-r-lg hover:bg-red-600 transition text-sm"><i class="fas fa-plus"></i></button> | |
| </div> | |
| <ul id="listaTarefas1" class="space-y-1"></ul> | |
| </div> | |
| <!-- Quadrante 2: Não Urgente & Importante --> | |
| <div class="quadrante bg-blue-100 rounded-lg shadow-lg p-4"> | |
| <div class="flex justify-between items-center mb-3"> | |
| <h2 class="text-lg font-semibold text-blue-800">Não Urgente & Importante</h2> | |
| <span class="bg-blue-200 text-blue-800 px-2 py-1 rounded-full text-xs">Agende</span> | |
| </div> | |
| <div class="mb-3 flex"> | |
| <input type="text" id="entradaTarefa2" placeholder="Adicionar tarefa..." class="flex-grow px-3 py-1 rounded-l-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm"> | |
| <input type="date" id="entradaData2" class="border border-gray-300 px-2 text-sm"> | |
| <button onclick="adicionarTarefa(2)" class="bg-blue-500 text-white px-3 py-1 rounded-r-lg hover:bg-blue-600 transition text-sm"><i class="fas fa-plus"></i></button> | |
| </div> | |
| <ul id="listaTarefas2" class="space-y-1"></ul> | |
| </div> | |
| <!-- Quadrante 3: Urgente & Não Importante --> | |
| <div class="quadrante bg-yellow-100 rounded-lg shadow-lg p-4"> | |
| <div class="flex justify-between items-center mb-3"> | |
| <h2 class="text-lg font-semibold text-yellow-800">Urgente & Não Importante</h2> | |
| <span class="bg-yellow-200 text-yellow-800 px-2 py-1 rounded-full text-xs">Delegue</span> | |
| </div> | |
| <div class="mb-3 flex"> | |
| <input type="text" id="entradaTarefa3" placeholder="Adicionar tarefa..." class="flex-grow px-3 py-1 rounded-l-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-yellow-500 text-sm"> | |
| <input type="date" id="entradaData3" class="border border-gray-300 px-2 text-sm"> | |
| <button onclick="adicionarTarefa(3)" class="bg-yellow-500 text-white px-3 py-1 rounded-r-lg hover:bg-yellow-600 transition text-sm"><i class="fas fa-plus"></i></button> | |
| </div> | |
| <ul id="listaTarefas3" class="space-y-1"></ul> | |
| </div> | |
| <!-- Quadrante 4: Não Urgente & Não Importante --> | |
| <div class="quadrante bg-green-100 rounded-lg shadow-lg p-4"> | |
| <div class="flex justify-between items-center mb-3"> | |
| <h2 class="text-lg font-semibold text-green-800">Não Urgente & Não Importante</h2> | |
| <span class="bg-green-200 text-green-800 px-2 py-1 rounded-full text-xs">Elimine</span> | |
| </div> | |
| <div class="mb-3 flex"> | |
| <input type="text" id="entradaTarefa4" placeholder="Adicionar tarefa..." class="flex-grow px-3 py-1 rounded-l-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-green-500 text-sm"> | |
| <input type="date" id="entradaData4" class="border border-gray-300 px-2 text-sm"> | |
| <button onclick="adicionarTarefa(4)" class="bg-green-500 text-white px-3 py-1 rounded-r-lg hover:bg-green-600 transition text-sm"><i class="fas fa-plus"></i></button> | |
| </div> | |
| <ul id="listaTarefas4" class="space-y-1"></ul> | |
| </div> | |
| </div> | |
| <div class="text-center mt-4"> | |
| <button onclick="alternarModalHistorico()" class="bg-purple-500 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-purple-600 transition flex items-center justify-center mx-auto text-sm"> | |
| <i class="fas fa-history mr-2"></i> Ver Histórico | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Modal de Detalhes da Tarefa --> | |
| <div id="modalTarefa" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 opacity-0 pointer-events-none"> | |
| <div class="bg-white rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] overflow-hidden"> | |
| <div id="cabecalhoModalTarefa" class="p-4 flex justify-between items-center"> | |
| <h2 class="text-xl font-semibold">Detalhes da Tarefa</h2> | |
| <button onclick="fecharModalTarefa()" class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="cartao-tarefa p-6 overflow-y-auto"> | |
| <div class="mb-6"> | |
| <label class="block text-gray-700 font-medium mb-2">Título da Tarefa</label> | |
| <input type="text" id="tituloModalTarefa" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| </div> | |
| <div class="mb-6"> | |
| <label class="block text-gray-700 font-medium mb-2">Data de Vencimento</label> | |
| <div class="flex items-center"> | |
| <input type="date" id="dataModalTarefa" class="px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 entrada-data-editar"> | |
| <button onclick="removerDataTarefa()" class="ml-2 text-red-500 hover:text-red-700 text-sm">Remover Data</button> | |
| </div> | |
| </div> | |
| <div class="mb-6"> | |
| <label class="block text-gray-700 font-medium mb-2">Descrição</label> | |
| <textarea id="descricaoModalTarefa" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 area-descricao" placeholder="Adicione uma descrição detalhada..."></textarea> | |
| </div> | |
| <div class="mb-6"> | |
| <div class="flex justify-between items-center mb-2"> | |
| <label class="block text-gray-700 font-medium">Subtarefas</label> | |
| <button onclick="adicionarSubtarefa()" class="text-blue-500 hover:text-blue-700 text-sm flex items-center"> | |
| <i class="fas fa-plus mr-1"></i> Adicionar Subtarefa | |
| </button> | |
| </div> | |
| <ul id="subtasksModalTarefa" class="space-y-2 mt-2"> | |
| <!-- Subtarefas serão adicionadas aqui --> | |
| </ul> | |
| </div> | |
| </div> | |
| <div class="bg-gray-100 p-4 flex justify-between items-center"> | |
| <button onclick="excluirTarefaAtual()" class="text-red-500 hover:text-red-700 flex items-center"> | |
| <i class="fas fa-trash mr-2"></i> Excluir Tarefa | |
| </button> | |
| <div> | |
| <button onclick="fecharModalTarefa()" class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg mr-2 hover:bg-gray-400">Cancelar</button> | |
| <button onclick="salvarDetalhesTarefa()" class="bg-blue-500 text-white px-4 py-2 rounded-lg hover:bg-blue-600">Salvar Alterações</button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Modal de Histórico --> | |
| <div id="modalHistorico" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 opacity-0 pointer-events-none"> | |
| <div class="bg-white rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] overflow-hidden"> | |
| <div class="bg-purple-500 text-white p-4 flex justify-between items-center"> | |
| <h2 class="text-xl font-semibold">Histórico de Tarefas Concluídas</h2> | |
| <button onclick="alternarModalHistorico()" class="text-white hover:text-gray-200"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="p-4 overflow-y-auto max-h-[60vh]"> | |
| <div id="conteudoHistorico" class="space-y-3"> | |
| <!-- Itens de histórico serão adicionados aqui --> | |
| </div> | |
| </div> | |
| <div class="bg-gray-100 p-4 flex justify-between items-center"> | |
| <button onclick="limparHistorico()" class="text-red-500 hover:text-red-700 flex items-center"> | |
| <i class="fas fa-trash mr-2"></i> Limpar Histórico | |
| </button> | |
| <span id="contadorHistorico" class="text-gray-600">0 tarefas concluídas</span> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Inicializa tarefas e histórico | |
| let tarefas = { | |
| 1: [], | |
| 2: [], | |
| 3: [], | |
| 4: [] | |
| }; | |
| let historico = []; | |
| // Tarefa atual sendo editada | |
| let tarefaAtual = null; | |
| let quadranteAtual = null; | |
| // Configurações do app | |
| let appSettings = { | |
| startupWithWindows: false, | |
| dataLocation: 'local', // 'local' ou caminho personalizado | |
| customDataPath: '' | |
| }; | |
| // Elementos DOM | |
| const listasTarefas = { | |
| 1: document.getElementById('listaTarefas1'), | |
| 2: document.getElementById('listaTarefas2'), | |
| 3: document.getElementById('listaTarefas3'), | |
| 4: document.getElementById('listaTarefas4') | |
| }; | |
| const conteudoHistorico = document.getElementById('conteudoHistorico'); | |
| const contadorHistorico = document.getElementById('contadorHistorico'); | |
| const modalHistorico = document.getElementById('modalHistorico'); | |
| const modalTarefa = document.getElementById('modalTarefa'); | |
| const settingsBtn = document.getElementById('settings-btn'); | |
| const settingsMenu = document.getElementById('settings-menu'); | |
| const startupText = document.getElementById('startup-text'); | |
| // Elementos do modal de tarefa | |
| const tituloModalTarefa = document.getElementById('tituloModalTarefa'); | |
| const dataModalTarefa = document.getElementById('dataModalTarefa'); | |
| const descricaoModalTarefa = document.getElementById('descricaoModalTarefa'); | |
| const subtasksModalTarefa = document.getElementById('subtasksModalTarefa'); | |
| const cabecalhoModalTarefa = document.getElementById('cabecalhoModalTarefa'); | |
| // Carrega dados do localStorage ao iniciar | |
| document.addEventListener('DOMContentLoaded', () => { | |
| carregarConfiguracoes(); | |
| carregarDados(); | |
| // Adiciona eventos para os controles da janela | |
| if (window.electron) { | |
| document.getElementById('minimize-btn').addEventListener('click', () => { | |
| window.electron.minimize(); | |
| }); | |
| document.getElementById('close-btn').addEventListener('click', () => { | |
| window.electron.close(); | |
| }); | |
| } | |
| // Configura menu de configurações | |
| settingsBtn.addEventListener('click', (e) => { | |
| e.stopPropagation(); | |
| settingsMenu.classList.toggle('show'); | |
| }); | |
| // Fecha menu quando clicar fora | |
| document.addEventListener('click', (e) => { | |
| if (!settingsMenu.contains(e.target) && e.target !== settingsBtn) { | |
| settingsMenu.classList.remove('show'); | |
| } | |
| }); | |
| }); | |
| // Funções para salvar/carregar configurações | |
| function carregarConfiguracoes() { | |
| if (window.electron) { | |
| window.electron.getSettings().then(settings => { | |
| if (settings) { | |
| appSettings = settings; | |
| updateStartupText(); | |
| } | |
| }); | |
| } else { | |
| const settings = localStorage.getItem('eisenhowerSettings'); | |
| if (settings) { | |
| appSettings = JSON.parse(settings); | |
| updateStartupText(); | |
| } | |
| } | |
| } | |
| function salvarConfiguracoes() { | |
| if (window.electron) { | |
| window.electron.saveSettings(appSettings); | |
| } else { | |
| localStorage.setItem('eisenhowerSettings', JSON.stringify(appSettings)); | |
| } | |
| } | |
| function updateStartupText() { | |
| startupText.textContent = appSettings.startupWithWindows ? | |
| 'Desativar início com Windows' : 'Iniciar com Windows'; | |
| } | |
| // Funções para salvar/carregar dados | |
| function salvarDados() { | |
| const dados = { | |
| tarefas: tarefas, | |
| historico: historico | |
| }; | |
| if (window.electron) { | |
| window.electron.saveData(dados, appSettings.dataLocation, appSettings.customDataPath); | |
| } else { | |
| localStorage.setItem('matrizEisenhower', JSON.stringify(dados)); | |
| } | |
| } | |
| function carregarDados() { | |
| if (window.electron) { | |
| window.electron.loadData(appSettings.dataLocation, appSettings.customDataPath).then(data => { | |
| if (data) { | |
| tarefas = data.tarefas || {1: [], 2: [], 3: [], 4: []}; | |
| historico = data.historico || []; | |
| renderizarTodasTarefas(); | |
| renderizarHistorico(); | |
| } | |
| }); | |
| } else { | |
| const dadosSalvos = localStorage.getItem('matrizEisenhower'); | |
| if (dadosSalvos) { | |
| const dados = JSON.parse(dadosSalvos); | |
| tarefas = dados.tarefas || {1: [], 2: [], 3: [], 4: []}; | |
| historico = dados.historico || []; | |
| renderizarTodasTarefas(); | |
| renderizarHistorico(); | |
| } | |
| } | |
| } | |
| // Funções de configuração | |
| function toggleStartup() { | |
| appSettings.startupWithWindows = !appSettings.startupWithWindows; | |
| updateStartupText(); | |
| if (window.electron) { | |
| window.electron.toggleStartup(appSettings.startupWithWindows); | |
| } | |
| salvarConfiguracoes(); | |
| settingsMenu.classList.remove('show'); | |
| } | |
| function changeDataLocation() { | |
| if (window.electron) { | |
| window.electron.chooseDataLocation().then(newPath => { | |
| if (newPath) { | |
| appSettings.dataLocation = 'custom'; | |
| appSettings.customDataPath = newPath; | |
| salvarConfiguracoes(); | |
| // Salva os dados no novo local | |
| salvarDados(); | |
| } | |
| }); | |
| } else { | |
| alert('Esta funcionalidade está disponível apenas na versão Electron do aplicativo.'); | |
| } | |
| settingsMenu.classList.remove('show'); | |
| } | |
| function minimizeToTray() { | |
| if (window.electron) { | |
| window.electron.minimizeToTray(); | |
| } else { | |
| alert('Esta funcionalidade está disponível apenas na versão Electron do aplicativo.'); | |
| } | |
| settingsMenu.classList.remove('show'); | |
| } | |
| function exportData() { | |
| const dados = { | |
| tarefas: tarefas, | |
| historico: historico | |
| }; | |
| if (window.electron) { | |
| window.electron.exportData(JSON.stringify(dados)); | |
| } else { | |
| const blob = new Blob([JSON.stringify(dados)], { type: 'application/json' }); | |
| const url = URL.createObjectURL(blob); | |
| const a = document.createElement('a'); | |
| a.href = url; | |
| a.download = 'matriz-eisenhower-backup.json'; | |
| document.body.appendChild(a); | |
| a.click(); | |
| document.body.removeChild(a); | |
| URL.revokeObjectURL(url); | |
| } | |
| settingsMenu.classList.remove('show'); | |
| } | |
| function importData() { | |
| if (window.electron) { | |
| window.electron.importData().then(data => { | |
| if (data) { | |
| try { | |
| const dados = JSON.parse(data); | |
| tarefas = dados.tarefas || {1: [], 2: [], 3: [], 4: []}; | |
| historico = dados.historico || []; | |
| renderizarTodasTarefas(); | |
| renderizarHistorico(); | |
| salvarDados(); | |
| } catch (error) { | |
| console.error('Erro ao importar dados:', error); | |
| } | |
| } | |
| }); | |
| } else { | |
| const input = document.createElement('input'); | |
| input.type = 'file'; | |
| input.accept = '.json'; | |
| input.onchange = e => { | |
| const file = e.target.files[0]; | |
| if (!file) return; | |
| const reader = new FileReader(); | |
| reader.onload = event => { | |
| try { | |
| const dados = JSON.parse(event.target.result); | |
| tarefas = dados.tarefas || {1: [], 2: [], 3: [], 4: []}; | |
| historico = dados.historico || []; | |
| renderizarTodasTarefas(); | |
| renderizarHistorico(); | |
| salvarDados(); | |
| } catch (error) { | |
| console.error('Erro ao importar dados:', error); | |
| } | |
| }; | |
| reader.readAsText(file); | |
| }; | |
| input.click(); | |
| } | |
| settingsMenu.classList.remove('show'); | |
| } | |
| // Funções da aplicação (mantidas as mesmas do código original) | |
| function adicionarTarefa(quadrante) { | |
| const entrada = document.getElementById(`entradaTarefa${quadrante}`); | |
| const entradaData = document.getElementById(`entradaData${quadrante}`); | |
| const textoTarefa = entrada.value.trim(); | |
| if (textoTarefa) { | |
| const novaTarefa = { | |
| id: Date.now(), | |
| texto: textoTarefa, | |
| concluida: false, | |
| data: entradaData.value || null, | |
| quadrante: quadrante, | |
| criadaEm: new Date().toISOString(), | |
| descricao: '', | |
| subtarefas: [] | |
| }; | |
| tarefas[quadrante].push(novaTarefa); | |
| salvarDados(); | |
| renderizarTarefas(quadrante); | |
| // Limpa os campos de entrada | |
| entrada.value = ''; | |
| entradaData.value = ''; | |
| } | |
| } | |
| function alternarTarefa(quadrante, idTarefa) { | |
| const indiceTarefa = tarefas[quadrante].findIndex(tarefa => tarefa.id === idTarefa); | |
| if (indiceTarefa !== -1) { | |
| const tarefa = tarefas[quadrante][indiceTarefa]; | |
| tarefa.concluida = !tarefa.concluida; | |
| if (tarefa.concluida) { | |
| // Adiciona ao histórico | |
| historico.push({ | |
| ...tarefa, | |
| concluidaEm: new Date().toISOString() | |
| }); | |
| salvarDados(); | |
| // Remove das tarefas ativas | |
| tarefas[quadrante].splice(indiceTarefa, 1); | |
| } | |
| salvarDados(); | |
| renderizarTarefas(quadrante); | |
| renderizarHistorico(); | |
| } | |
| } | |
| function excluirTarefa(quadrante, idTarefa) { | |
| tarefas[quadrante] = tarefas[quadrante].filter(tarefa => tarefa.id !== idTarefa); | |
| salvarDados(); | |
| renderizarTarefas(quadrante); | |
| fecharModalTarefa(); | |
| } | |
| function abrirModalTarefa(quadrante, idTarefa) { | |
| const tarefa = tarefas[quadrante].find(t => t.id === idTarefa); | |
| if (!tarefa) return; | |
| tarefaAtual = tarefa; | |
| quadranteAtual = quadrante; | |
| // Define a cor do cabeçalho do modal com base no quadrante | |
| cabecalhoModalTarefa.className = `p-4 flex justify-between items-center ${obterClasseBgQuadrante(quadrante)} text-white`; | |
| // Preenche os campos do modal | |
| tituloModalTarefa.value = tarefa.texto; | |
| dataModalTarefa.value = tarefa.data || ''; | |
| descricaoModalTarefa.value = tarefa.descricao || ''; | |
| // Renderiza as subtarefas | |
| renderizarSubtarefas(); | |
| // Mostra o modal | |
| modalTarefa.classList.remove('opacity-0', 'pointer-events-none'); | |
| } | |
| function fecharModalTarefa() { | |
| modalTarefa.classList.add('opacity-0', 'pointer-events-none'); | |
| tarefaAtual = null; | |
| quadranteAtual = null; | |
| } | |
| function salvarDetalhesTarefa() { | |
| if (!tarefaAtual || !quadranteAtual) return; | |
| // Encontra a tarefa no array | |
| const indiceTarefa = tarefas[quadranteAtual].findIndex(t => t.id === tarefaAtual.id); | |
| if (indiceTarefa === -1) return; | |
| // Atualiza as propriedades da tarefa | |
| tarefas[quadranteAtual][indiceTarefa].texto = tituloModalTarefa.value; | |
| tarefas[quadranteAtual][indiceTarefa].data = dataModalTarefa.value || null; | |
| tarefas[quadranteAtual][indiceTarefa].descricao = descricaoModalTarefa.value; | |
| // Salva e renderiza | |
| salvarDados(); | |
| renderizarTarefas(quadranteAtual); | |
| fecharModalTarefa(); | |
| } | |
| function excluirTarefaAtual() { | |
| if (!tarefaAtual || !quadranteAtual) return; | |
| excluirTarefa(quadranteAtual, tarefaAtual.id); | |
| } | |
| function removerDataTarefa() { | |
| dataModalTarefa.value = ''; | |
| } | |
| function adicionarSubtarefa() { | |
| if (!tarefaAtual || !quadranteAtual) return; | |
| const textoSubtarefa = prompt('Digite a subtarefa:'); | |
| if (textoSubtarefa && textoSubtarefa.trim()) { | |
| const novaSubtarefa = { | |
| id: Date.now(), | |
| texto: textoSubtarefa.trim(), | |
| concluida: false | |
| }; | |
| // Encontra a tarefa no array | |
| const indiceTarefa = tarefas[quadranteAtual].findIndex(t => t.id === tarefaAtual.id); | |
| if (indiceTarefa === -1) return; | |
| // Inicializa o array de subtarefas se não existir | |
| if (!tarefas[quadranteAtual][indiceTarefa].subtarefas) { | |
| tarefas[quadranteAtual][indiceTarefa].subtarefas = []; | |
| } | |
| // Adiciona a subtarefa | |
| tarefas[quadranteAtual][indiceTarefa].subtarefas.push(novaSubtarefa); | |
| // Salva e renderiza | |
| salvarDados(); | |
| renderizarSubtarefas(); | |
| } | |
| } | |
| function alternarSubtarefa(idSubtarefa) { | |
| if (!tarefaAtual || !quadranteAtual) return; | |
| // Encontra a tarefa no array | |
| const indiceTarefa = tarefas[quadranteAtual].findIndex(t => t.id === tarefaAtual.id); | |
| if (indiceTarefa === -1) return; | |
| // Encontra e alterna a subtarefa | |
| const indiceSubtarefa = tarefas[quadranteAtual][indiceTarefa].subtarefas.findIndex(st => st.id === idSubtarefa); | |
| if (indiceSubtarefa !== -1) { | |
| tarefas[quadranteAtual][indiceTarefa].subtarefas[indiceSubtarefa].concluida = | |
| !tarefas[quadranteAtual][indiceTarefa].subtarefas[indiceSubtarefa].concluida; | |
| // Salva e renderiza | |
| salvarDados(); | |
| renderizarSubtarefas(); | |
| } | |
| } | |
| function excluirSubtarefa(idSubtarefa) { | |
| if (!tarefaAtual || !quadranteAtual) return; | |
| // Encontra a tarefa no array | |
| const indiceTarefa = tarefas[quadranteAtual].findIndex(t => t.id === tarefaAtual.id); | |
| if (indiceTarefa === -1) return; | |
| // Filtra a subtarefa | |
| tarefas[quadranteAtual][indiceTarefa].subtarefas = | |
| tarefas[quadranteAtual][indiceTarefa].subtarefas.filter(st => st.id !== idSubtarefa); | |
| // Salva e renderiza | |
| salvarDados(); | |
| renderizarSubtarefas(); | |
| } | |
| // Renderiza todas as tarefas | |
| function renderizarTodasTarefas() { | |
| for (let quadrante = 1; quadrante <= 4; quadrante++) { | |
| renderizarTarefas(quadrante); | |
| } | |
| } | |
| // Renderiza as tarefas de um quadrante específico | |
| function renderizarTarefas(quadrante) { | |
| const lista = listasTarefas[quadrante]; | |
| lista.innerHTML = ''; | |
| if (tarefas[quadrante].length === 0) { | |
| lista.innerHTML = '<li class="text-gray-500 italic text-sm">Nenhuma tarefa ainda.</li>'; | |
| return; | |
| } | |
| tarefas[quadrante].forEach(tarefa => { | |
| const li = document.createElement('li'); | |
| li.className = `item-tarefa ${obterClasseHoverQuadrante(quadrante)} p-2 rounded-lg flex items-center justify-between text-sm`; | |
| li.onclick = () => abrirModalTarefa(quadrante, tarefa.id); | |
| // Checkbox e texto | |
| const divEsquerda = document.createElement('div'); | |
| divEsquerda.className = 'flex items-center'; | |
| const checkbox = document.createElement('input'); | |
| checkbox.type = 'checkbox'; | |
| checkbox.className = 'mr-2 h-4 w-4'; | |
| checkbox.checked = tarefa.concluida; | |
| checkbox.onclick = (e) => { | |
| e.stopPropagation(); | |
| alternarTarefa(quadrante, tarefa.id); | |
| }; | |
| const textoTarefa = document.createElement('span'); | |
| textoTarefa.className = tarefa.concluida ? 'concluida' : ''; | |
| textoTarefa.textContent = tarefa.texto; | |
| divEsquerda.appendChild(checkbox); | |
| divEsquerda.appendChild(textoTarefa); | |
| // Lado direito (data e botão de exclusão) | |
| const divDireita = document.createElement('div'); | |
| divDireita.className = 'flex items-center'; | |
| if (tarefa.data) { | |
| const badgeData = document.createElement('span'); | |
| badgeData.className = `badge-data ${obterClasseCorQuadrante(quadrante, true)} mr-2 text-xs`; | |
| badgeData.textContent = formatarData(tarefa.data); | |
| divDireita.appendChild(badgeData); | |
| } | |
| const botaoExcluir = document.createElement('button'); | |
| botaoExcluir.className = 'text-gray-500 hover:text-gray-700'; | |
| botaoExcluir.innerHTML = '<i class="fas fa-ellipsis-v text-xs"></i>'; | |
| botaoExcluir.onclick = (e) => { | |
| e.stopPropagation(); | |
| abrirModalTarefa(quadrante, tarefa.id); | |
| }; | |
| divDireita.appendChild(botaoExcluir); | |
| li.appendChild(divEsquerda); | |
| li.appendChild(divDireita); | |
| lista.appendChild(li); | |
| }); | |
| } | |
| // Renderiza as subtarefas no modal | |
| function renderizarSubtarefas() { | |
| subtasksModalTarefa.innerHTML = ''; | |
| if (!tarefaAtual || !quadranteAtual) return; | |
| // Encontra a tarefa no array | |
| const indiceTarefa = tarefas[quadranteAtual].findIndex(t => t.id === tarefaAtual.id); | |
| if (indiceTarefa === -1) return; | |
| const tarefa = tarefas[quadranteAtual][indiceTarefa]; | |
| if (!tarefa.subtarefas || tarefa.subtarefas.length === 0) { | |
| subtasksModalTarefa.innerHTML = '<li class="text-gray-500 italic text-sm">Nenhuma subtarefa ainda.</li>'; | |
| return; | |
| } | |
| tarefa.subtarefas.forEach(subtarefa => { | |
| const li = document.createElement('li'); | |
| li.className = 'item-subtarefa bg-gray-50 p-2 rounded flex items-center justify-between'; | |
| // Checkbox e texto | |
| const divEsquerda = document.createElement('div'); | |
| divEsquerda.className = 'flex items-center'; | |
| const checkbox = document.createElement('input'); | |
| checkbox.type = 'checkbox'; | |
| checkbox.className = 'mr-2 h-4 w-4'; | |
| checkbox.checked = subtarefa.concluida; | |
| checkbox.onclick = () => alternarSubtarefa(subtarefa.id); | |
| const textoSubtarefa = document.createElement('span'); | |
| textoSubtarefa.className = subtarefa.concluida ? 'concluida text-sm' : 'text-sm'; | |
| textoSubtarefa.textContent = subtarefa.texto; | |
| divEsquerda.appendChild(checkbox); | |
| divEsquerda.appendChild(textoSubtarefa); | |
| // Botão de exclusão | |
| const botaoExcluir = document.createElement('button'); | |
| botaoExcluir.className = 'text-red-400 hover:text-red-600 text-sm'; | |
| botaoExcluir.innerHTML = '<i class="fas fa-times"></i>'; | |
| botaoExcluir.onclick = (e) => { | |
| e.stopPropagation(); | |
| excluirSubtarefa(subtarefa.id); | |
| }; | |
| li.appendChild(divEsquerda); | |
| li.appendChild(botaoExcluir); | |
| subtasksModalTarefa.appendChild(li); | |
| }); | |
| } | |
| // Renderiza o histórico | |
| function renderizarHistorico() { | |
| conteudoHistorico.innerHTML = ''; | |
| if (historico.length === 0) { | |
| conteudoHistorico.innerHTML = '<p class="text-gray-500 italic text-sm">Nenhuma tarefa concluída ainda.</p>'; | |
| contadorHistorico.textContent = '0 tarefas concluídas'; | |
| return; | |
| } | |
| // Agrupa por data de conclusão | |
| const historicoAgrupado = {}; | |
| historico.forEach(tarefa => { | |
| const data = new Date(tarefa.concluidaEm).toLocaleDateString(); | |
| if (!historicoAgrupado[data]) { | |
| historicoAgrupado[data] = []; | |
| } | |
| historicoAgrupado[data].push(tarefa); | |
| }); | |
| // Ordena datas em ordem decrescente | |
| const datasOrdenadas = Object.keys(historicoAgrupado).sort((a, b) => new Date(b) - new Date(a)); | |
| datasOrdenadas.forEach(data => { | |
| const cabecalhoData = document.createElement('h3'); | |
| cabecalhoData.className = 'font-semibold text-gray-700 mt-4 mb-2 text-sm'; | |
| cabecalhoData.textContent = data; | |
| conteudoHistorico.appendChild(cabecalhoData); | |
| const listaData = document.createElement('div'); | |
| listaData.className = 'space-y-2'; | |
| historicoAgrupado[data].forEach(tarefa => { | |
| const divTarefa = document.createElement('div'); | |
| divTarefa.className = 'bg-gray-50 p-2 rounded-lg flex items-center justify-between text-sm'; | |
| const divEsquerda = document.createElement('div'); | |
| divEsquerda.className = 'flex items-center'; | |
| const badgeQuadrante = document.createElement('span'); | |
| badgeQuadrante.className = `badge-data ${obterClasseCorQuadrante(tarefa.quadrante, true)} mr-2 text-xs`; | |
| badgeQuadrante.textContent = obterNomeQuadrante(tarefa.quadrante); | |
| const textoTarefa = document.createElement('span'); | |
| textoTarefa.className = 'concluida'; | |
| textoTarefa.textContent = tarefa.texto; | |
| divEsquerda.appendChild(badgeQuadrante); | |
| divEsquerda.appendChild(textoTarefa); | |
| const divDireita = document.createElement('div'); | |
| divDireita.className = 'text-xs text-gray-500'; | |
| divDireita.textContent = new Date(tarefa.concluidaEm).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}); | |
| divTarefa.appendChild(divEsquerda); | |
| divTarefa.appendChild(divDireita); | |
| listaData.appendChild(divTarefa); | |
| }); | |
| conteudoHistorico.appendChild(listaData); | |
| }); | |
| contadorHistorico.textContent = `${historico.length} tarefa${historico.length !== 1 ? 's' : ''} concluída${historico.length !== 1 ? 's' : ''}`; | |
| } | |
| // Limpa o histórico | |
| function limparHistorico() { | |
| if (confirm('Tem certeza que deseja limpar todo o histórico?')) { | |
| historico = []; | |
| salvarDados(); | |
| renderizarHistorico(); | |
| } | |
| } | |
| // Alterna o modal de histórico | |
| function alternarModalHistorico() { | |
| modalHistorico.classList.toggle('opacity-0'); | |
| modalHistorico.classList.toggle('pointer-events-none'); | |
| } | |
| // Funções auxiliares | |
| function formatarData(dataString) { | |
| if (!dataString) return ''; | |
| const data = new Date(dataString); | |
| return data.toLocaleDateString([], {month: 'short', day: 'numeric'}); | |
| } | |
| function obterClasseCorQuadrante(quadrante, isBg = false) { | |
| const prefixo = isBg ? 'bg' : 'text'; | |
| switch(quadrante) { | |
| case 1: return `${prefixo}-red-500`; | |
| case 2: return `${prefixo}-blue-500`; | |
| case 3: return `${prefixo}-yellow-500`; | |
| case 4: return `${prefixo}-green-500`; | |
| default: return `${prefixo}-gray-500`; | |
| } | |
| } | |
| function obterClasseBgQuadrante(quadrante) { | |
| switch(quadrante) { | |
| case 1: return 'bg-red-500'; | |
| case 2: return 'bg-blue-500'; | |
| case 3: return 'bg-yellow-500'; | |
| case 4: return 'bg-green-500'; | |
| default: return 'bg-gray-500'; | |
| } | |
| } | |
| function obterClasseHoverQuadrante(quadrante) { | |
| switch(quadrante) { | |
| case 1: return 'bg-red-50 hover:bg-red-200'; | |
| case 2: return 'bg-blue-50 hover:bg-blue-200'; | |
| case 3: return 'bg-yellow-50 hover:bg-yellow-200'; | |
| case 4: return 'bg-green-50 hover:bg-green-200'; | |
| default: return 'bg-gray-50 hover:bg-gray-200'; | |
| } | |
| } | |
| function obterNomeQuadrante(quadrante) { | |
| switch(quadrante) { | |
| case 1: return 'U & I'; | |
| case 2: return 'NU & I'; | |
| case 3: return 'U & NI'; | |
| case 4: return 'NU & NI'; | |
| default: return ''; | |
| } | |
| } | |
| </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=caic1995/trabalho" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |