directory back up (parent) button + drag entry into parent to move

This commit is contained in:
2025-07-30 17:25:10 +02:00
parent 2c834eb42b
commit 3b141cc7cd
18 changed files with 243 additions and 95 deletions

View File

@@ -89,28 +89,7 @@ function onDragStart(e: DragEvent) {
e.dataTransfer.dropEffect = 'move';
}
async function onDrop(e: DragEvent) {
if (e.dataTransfer == null || warrenStore.current == null) {
return;
}
if (entry.fileType !== 'directory') {
return;
}
const fileName = e.dataTransfer.getData('application/warren');
if (entry.name === fileName) {
return;
}
await moveFile(
warrenStore.current.warrenId,
warrenStore.current.path,
fileName,
`${warrenStore.current.path}/${entry.name}`
);
}
const onDrop = onDirectoryEntryDrop(entry);
</script>
<template>
@@ -118,7 +97,7 @@ async function onDrop(e: DragEvent) {
<ContextMenuTrigger>
<button
:disabled="warrenStore.loading || disabled"
class="bg-accent/30 border-border select-none, flex w-52 translate-0 flex-row gap-4 overflow-hidden rounded-md border-1 px-4 py-2"
class="bg-accent/30 border-border flex w-52 translate-0 flex-row gap-4 overflow-hidden rounded-md border-1 px-4 py-2 select-none"
draggable="true"
@dragstart="onDragStart"
@drop="onDrop"