fix: resolve remaining trash UI issues and permanent delete backend logic
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m20s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m20s
This commit is contained in:
parent
db946461d7
commit
854da9a50d
2 changed files with 46 additions and 34 deletions
|
|
@ -772,7 +772,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
|||
}
|
||||
|
||||
function handleDragOver(e: React.DragEvent) {
|
||||
if (draggedFile) return;
|
||||
if (draggedFile || activeSection === 'trash') return;
|
||||
if (!e.dataTransfer.types.includes('Files')) return;
|
||||
e.preventDefault();
|
||||
setDragOver(true);
|
||||
|
|
@ -1754,31 +1754,33 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
|||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
className="p-2 hover:bg-white/5 rounded-lg transition-colors flex items-center gap-2 text-sm"
|
||||
style={{ color: 'var(--color-text-primary)' }}
|
||||
title="Download Selected"
|
||||
onClick={() => {
|
||||
if (!downloadToken) return;
|
||||
const form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.action = api.getBulkDownloadUrl(downloadToken);
|
||||
form.target = '_blank';
|
||||
|
||||
const input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = 'paths';
|
||||
input.value = JSON.stringify(Array.from(selectedFiles));
|
||||
form.appendChild(input);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
document.body.removeChild(form);
|
||||
setSelectedFiles(new Set());
|
||||
}}
|
||||
>
|
||||
<Download className="w-4 h-4" />
|
||||
</button>
|
||||
{activeSection !== 'trash' && (
|
||||
<button
|
||||
className="p-2 hover:bg-white/5 rounded-lg transition-colors flex items-center gap-2 text-sm"
|
||||
style={{ color: 'var(--color-text-primary)' }}
|
||||
title="Download Selected"
|
||||
onClick={() => {
|
||||
if (!downloadToken) return;
|
||||
const form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.action = api.getBulkDownloadUrl(downloadToken);
|
||||
form.target = '_blank';
|
||||
|
||||
const input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = 'paths';
|
||||
input.value = JSON.stringify(Array.from(selectedFiles));
|
||||
form.appendChild(input);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
document.body.removeChild(form);
|
||||
setSelectedFiles(new Set());
|
||||
}}
|
||||
>
|
||||
<Download className="w-4 h-4" />
|
||||
</button>
|
||||
)}
|
||||
{activeSection !== 'trash' && (
|
||||
<button
|
||||
className="p-2 hover:bg-white/5 rounded-lg transition-colors flex items-center gap-2 text-sm"
|
||||
|
|
@ -2094,11 +2096,13 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
|||
style={{ backgroundColor: 'var(--color-bg-primary)', border: '1px solid var(--color-border)' }}
|
||||
>
|
||||
<div className="p-6">
|
||||
<h2 className="text-xl font-bold mb-2" style={{ color: 'var(--color-text-primary)' }}>Move to Trash?</h2>
|
||||
<h2 className="text-xl font-bold mb-2" style={{ color: 'var(--color-text-primary)' }}>
|
||||
{activeSection === 'trash' ? 'Delete Permanently?' : 'Move to Trash?'}
|
||||
</h2>
|
||||
<p className="mb-6" style={{ color: 'var(--color-text-secondary)' }}>
|
||||
{deleteConfirm.type === 'multiple'
|
||||
? `Are you sure you want to move ${deleteConfirm.count} items to the trash?`
|
||||
: `Are you sure you want to move ${deleteConfirm.file?.name} to the trash?`}
|
||||
? (activeSection === 'trash' ? `Are you sure you want to permanently delete ${deleteConfirm.count} items?` : `Are you sure you want to move ${deleteConfirm.count} items to the trash?`)
|
||||
: (activeSection === 'trash' ? `Are you sure you want to permanently delete ${deleteConfirm.file?.name}?` : `Are you sure you want to move ${deleteConfirm.file?.name} to the trash?`)}
|
||||
</p>
|
||||
<div className="flex justify-end gap-3">
|
||||
<button
|
||||
|
|
@ -2115,7 +2119,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
|||
}}
|
||||
className="px-4 py-2 rounded-lg text-sm font-medium transition-colors hover:opacity-90 bg-red-500 text-white"
|
||||
>
|
||||
Move to Trash
|
||||
{activeSection === 'trash' ? 'Delete Permanently' : 'Move to Trash'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Reference in a new issue