Add navigation and copy functionality to move dialog

- Add breadcrumb navigation to move dialog for folder navigation
- Add 'Copy' button alongside 'Move' button in the dialog
- Implement copyFile and copyFolder functions in fileOps
- Add copy handler for batch operations
- Add CSS styles for btn-outline button (light and dark mode)
- Add translations for new dialog strings

fix: properly show home folder contents in move dialog

- Use effectiveParentId for all checks and rendering
- Show 'Select this folder' option for home folder
- Only show 'go to parent' when breadcrumb has items (navigated into subfolders)
fix: improve move dialog UX

- Hide breadcrumb at home folder level (not needed)
- Only show 'Select this folder' option after navigating into subfolders
- Show 'no subfolders' message when there are no folders to navigate
- Properly display subfolders for navigation
This commit is contained in:
George Wu
2026-02-24 18:08:33 -08:00
parent ca4037da8f
commit 5824b6c4b4
4 changed files with 247 additions and 51 deletions
@@ -766,6 +766,63 @@ const fileOps = {
}
},
/**
* Copy a file to another folder
* @param {string} fileId - File ID
* @param {string} targetFolderId - Target folder ID
* @returns {Promise<boolean>} - Success status
*/
async copyFile(fileId, targetFolderId) {
try {
const response = await fetch('/api/batch/files/copy', {
method: 'POST',
headers: {
...getAuthHeaders(),
'Content-Type': 'application/json'
},
body: JSON.stringify({
file_ids: [fileId],
target_folder_id: targetFolderId === "" ? null : targetFolderId
})
});
if (response.ok) {
const result = await response.json();
// Reload files after copying
await window.loadFiles();
window.ui.showNotification('File copied', 'File copied successfully');
return true;
} else {
let errorMessage = 'Unknown error';
try {
const errorData = await response.json();
errorMessage = errorData.error || 'Unknown error';
} catch (e) {
errorMessage = 'Error processing server response';
}
window.ui.showNotification('Error', `Error copying the file: ${errorMessage}`);
return false;
}
} catch (error) {
console.error('Error copying file:', error);
window.ui.showNotification('Error', 'Error copying the file');
return false;
}
},
/**
* Copy a folder to another folder
* Note: Backend folder copy is not yet implemented, this shows a notification
* @param {string} folderId - Folder ID
* @param {string} targetFolderId - Target folder ID
* @returns {Promise<boolean>} - Success status
*/
async copyFolder(folderId, targetFolderId) {
// Folder copy is not yet implemented in the backend
window.ui.showNotification('Not implemented', 'Folder copy is not yet supported');
return false;
},
/**
* Rename a file
* @param {string} fileId - File ID