feat(tasks): add archive button in list cards
This commit is contained in:
@@ -153,6 +153,7 @@
|
|||||||
"markDone": "Mark {{title}} as done",
|
"markDone": "Mark {{title}} as done",
|
||||||
"markOpen": "Mark {{title}} as open",
|
"markOpen": "Mark {{title}} as open",
|
||||||
"editButton": "Edit task",
|
"editButton": "Edit task",
|
||||||
|
"archiveButton": "Archive task",
|
||||||
"swipeOpen": "Reopen",
|
"swipeOpen": "Reopen",
|
||||||
"swipeDone": "Done",
|
"swipeDone": "Done",
|
||||||
"swipeEdit": "Edit",
|
"swipeEdit": "Edit",
|
||||||
@@ -163,6 +164,7 @@
|
|||||||
"savedToast": "Task saved.",
|
"savedToast": "Task saved.",
|
||||||
"createdToast": "Task created.",
|
"createdToast": "Task created.",
|
||||||
"deletedToast": "Task deleted.",
|
"deletedToast": "Task deleted.",
|
||||||
|
"archivedToast": "Task archived.",
|
||||||
"loadError": "Task could not be loaded.",
|
"loadError": "Task could not be loaded.",
|
||||||
"subtaskPrompt": "Subtask:",
|
"subtaskPrompt": "Subtask:",
|
||||||
"kanbanOpen": "Open",
|
"kanbanOpen": "Open",
|
||||||
@@ -920,4 +922,4 @@
|
|||||||
"birthdays": "Add birthdays — you will receive a reminder in time.",
|
"birthdays": "Add birthdays — you will receive a reminder in time.",
|
||||||
"recipes": "Create recipes and link them to your meal planner."
|
"recipes": "Create recipes and link them to your meal planner."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,6 +153,7 @@
|
|||||||
"markDone": "Marcar {{title}} como concluído",
|
"markDone": "Marcar {{title}} como concluído",
|
||||||
"markOpen": "Marcar {{title}} como pendente",
|
"markOpen": "Marcar {{title}} como pendente",
|
||||||
"editButton": "Editar tarefa",
|
"editButton": "Editar tarefa",
|
||||||
|
"archiveButton": "Arquivar tarefa",
|
||||||
"swipeOpen": "Abrir",
|
"swipeOpen": "Abrir",
|
||||||
"swipeDone": "Concluído",
|
"swipeDone": "Concluído",
|
||||||
"swipeEdit": "Editar",
|
"swipeEdit": "Editar",
|
||||||
@@ -163,6 +164,7 @@
|
|||||||
"savedToast": "Tarefa salva.",
|
"savedToast": "Tarefa salva.",
|
||||||
"createdToast": "Tarefa criada.",
|
"createdToast": "Tarefa criada.",
|
||||||
"deletedToast": "Tarefa excluída.",
|
"deletedToast": "Tarefa excluída.",
|
||||||
|
"archivedToast": "Tarefa arquivada.",
|
||||||
"loadError": "Falha ao carregar a tarefa.",
|
"loadError": "Falha ao carregar a tarefa.",
|
||||||
"subtaskPrompt": "Subtarefa:",
|
"subtaskPrompt": "Subtarefa:",
|
||||||
"kanbanOpen": "Aberto",
|
"kanbanOpen": "Aberto",
|
||||||
@@ -902,4 +904,4 @@
|
|||||||
"emptyHint": {
|
"emptyHint": {
|
||||||
"recipes": "Crie receitas e vincule-as ao seu planejador de refeições."
|
"recipes": "Crie receitas e vincule-as ao seu planejador de refeições."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,6 +209,11 @@ function renderTaskCard(task, opts = {}) {
|
|||||||
aria-label="${t('tasks.editButton')}">
|
aria-label="${t('tasks.editButton')}">
|
||||||
<i data-lucide="pencil" class="icon-base" aria-hidden="true"></i>
|
<i data-lucide="pencil" class="icon-base" aria-hidden="true"></i>
|
||||||
</button>
|
</button>
|
||||||
|
${task.status !== 'archived' ? `
|
||||||
|
<button class="btn btn--ghost btn--icon btn--icon-sm" data-action="archive-task" data-id="${task.id}"
|
||||||
|
aria-label="${t('tasks.archiveButton')}">
|
||||||
|
<i data-lucide="archive" class="icon-base" aria-hidden="true"></i>
|
||||||
|
</button>` : ''}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
${progress !== null ? `
|
${progress !== null ? `
|
||||||
@@ -1511,6 +1516,16 @@ function wireTaskList(container) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (action === 'archive-task') {
|
||||||
|
try {
|
||||||
|
await api.patch(`/tasks/${id}/status`, { status: 'archived' });
|
||||||
|
window.oikos.showToast(t('tasks.archivedToast'), 'success');
|
||||||
|
await loadTasks(container);
|
||||||
|
} catch (err) {
|
||||||
|
window.oikos.showToast(err.message, 'danger');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (action === 'add-subtask') {
|
if (action === 'add-subtask') {
|
||||||
await handleAddSubtask(target.dataset.parent, container);
|
await handleAddSubtask(target.dataset.parent, container);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user