feat: add duplicate button to task detail view

This commit is contained in:
kolaente 2026-03-04 16:05:30 +01:00
parent 2014d50b95
commit 6c9407c58f
2 changed files with 22 additions and 2 deletions

View File

@ -851,6 +851,7 @@
"doneAt": "Done {0}",
"updateSuccess": "The task was saved successfully.",
"deleteSuccess": "The task has been deleted successfully.",
"duplicateSuccess": "The task was duplicated successfully.",
"belongsToProject": "This task belongs to project '{project}'",
"back": "Back to project",
"due": "Due {at}",
@ -877,6 +878,7 @@
"attachments": "Add Attachments",
"relatedTasks": "Add Relation",
"moveProject": "Move",
"duplicate": "Duplicate",
"color": "Set Color",
"delete": "Delete",
"favorite": "Add to Favorites",

View File

@ -519,9 +519,16 @@
>
{{ $t('task.detail.actions.moveProject') }}
</XButton>
<XButton
variant="secondary"
icon="copy"
@click="duplicateCurrentTask"
>
{{ $t('task.detail.actions.duplicate') }}
</XButton>
<span class="action-heading">{{ $t('task.detail.dateAndTime') }}</span>
<XButton
v-shortcut="'KeyD'"
variant="secondary"
@ -1094,6 +1101,17 @@ async function toggleFavorite() {
Object.assign(task.value, newTask)
}
async function duplicateCurrentTask() {
const duplicatedTask = await taskStore.duplicateTask(task.value.id)
if (duplicatedTask) {
success({message: t('task.detail.duplicateSuccess')})
router.push({
name: 'task.detail',
params: {id: duplicatedTask.id},
})
}
}
async function setPriority(priority: Priority) {
const newTask: ITask = {
...task.value,