feat(navigation): allow dragging a project out from its parent project

This commit is contained in:
kolaente 2023-03-27 13:22:03 +02:00
parent 713edd4dfb
commit b623e739de
Signed by: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -151,13 +151,11 @@ async function saveProjectPosition(e: SortableEvent) {
projectAfter !== null ? projectAfter.position : null, projectAfter !== null ? projectAfter.position : null,
) )
console.log({ if (project.parentProjectId !== parentProjectId) {
position, const parentProject = projectStore.getProjectById(project.parentProjectId)
newIndex, const childProjectIndex = parentProject.childProjects.findIndex(p => p.id === project.id)
project: project.id, parentProject.childProjects.splice(childProjectIndex, 1)
projectBefore: projectBefore?.id, }
projectAfter: projectAfter?.id,
})
try { try {
// create a copy of the project in order to not violate pinia manipulation // create a copy of the project in order to not violate pinia manipulation