feat: photo/video capture-date pipeline + premium UI/UX overhaul
Backend — Photos timeline now groups by real capture date instead of upload time. New MediaMetadataService (FileLifecycleHook) extracts EXIF DateTimeOriginal from images and container creation_time from videos (mov/mp4/mkv) via nom-exif, timezone-correct (OffsetTimeOriginal), persisting captured_at so the existing media_sort_date trigger takes over. Adds POST /admin/photos/metadata/reextract to backfill existing media. Falls back to upload date when no embedded date exists. Frontend — premium grid cards: combined metadata line (relative date · size, owner avatar when shared), custom selection checkbox with a clear checked state, uniform full-width 4:3 thumbnail tiles independent of filename length, centered file-type icons, and a hit-test fix so checkbox/star/kebab clicks reach the controls (the decorative thumbnail no longer captures pointer events). Notification messages internationalised across all 16 locales. Broader polish: design tokens, a11y/focus-visible states, brand + PWA assets. Chore — bump semver-compatible dependencies (cargo upgrade); add nom-exif 3.6.1. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -202,15 +202,15 @@ const batchToolbar = {
|
||||
showBatchResult(action, result) {
|
||||
if (action === 'copy') {
|
||||
if (result.errors > 0) {
|
||||
ui.showNotification('Batch copy', `${result.success} copied, ${result.errors} failed`);
|
||||
ui.showNotification(i18n.t('notif.batchCopy'), i18n.t('notif.batchCopyBody', { success: result.success, errors: result.errors }));
|
||||
} else {
|
||||
ui.showNotification('Items copied', `${result.success} item${result.success !== 1 ? 's' : ''} copied successfully`);
|
||||
ui.showNotification(i18n.t('notif.itemsCopied'), i18n.t('notif.itemsCopiedBody', { count: result.success }));
|
||||
}
|
||||
} else {
|
||||
if (result.errors > 0) {
|
||||
ui.showNotification('Batch move', `${result.success} moved, ${result.errors} failed`);
|
||||
ui.showNotification(i18n.t('notif.batchMove'), i18n.t('notif.batchMoveBody', { success: result.success, errors: result.errors }));
|
||||
} else {
|
||||
ui.showNotification('Items moved', `${result.success} item${result.success !== 1 ? 's' : ''} moved successfully`);
|
||||
ui.showNotification(i18n.t('notif.itemsMoved'), i18n.t('notif.itemsMovedBody', { count: result.success }));
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -421,13 +421,13 @@ const batchToolbar = {
|
||||
loadFiles();
|
||||
|
||||
if (errors > 0) {
|
||||
ui.showNotification('Batch delete', `${success} moved to trash, ${errors} failed`);
|
||||
ui.showNotification(i18n.t('notif.batchDelete'), i18n.t('notif.batchDeleteBody', { success, errors }));
|
||||
} else {
|
||||
ui.showNotification('Moved to trash', `${success} item${success !== 1 ? 's' : ''} moved to trash`);
|
||||
ui.showNotification(i18n.t('notif.movedToTrash'), i18n.t('notif.movedToTrashBody', { count: success }));
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Batch trash error:', e);
|
||||
ui.showNotification('Error', 'Could not move items to trash');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.trashItemsError'));
|
||||
this.clear();
|
||||
loadFiles();
|
||||
}
|
||||
@@ -458,7 +458,7 @@ const batchToolbar = {
|
||||
const items = this.items;
|
||||
if (items.length === 0) return;
|
||||
|
||||
ui.showNotification('Preparing download', 'Creating ZIP archive...');
|
||||
ui.showNotification(i18n.t('notif.preparingDownload'), i18n.t('notif.preparingDownloadBody'));
|
||||
|
||||
const fileIds = items.filter((i) => i.type === 'file').map((i) => i.id);
|
||||
const folderIds = items.filter((i) => i.type === 'folder').map((i) => i.id);
|
||||
@@ -495,7 +495,7 @@ const batchToolbar = {
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
} catch (e) {
|
||||
console.error('Batch download error:', e);
|
||||
ui.showNotification('Error', 'Could not download selected items');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.downloadItemsError'));
|
||||
}
|
||||
},
|
||||
|
||||
@@ -539,7 +539,7 @@ const batchToolbar = {
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Batch favorites error:', e);
|
||||
ui.showNotification('Error', 'Could not add items to favorites');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.favoritesAddError'));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -744,14 +744,14 @@ const contextMenus = {
|
||||
const shareUrl = app.notificationShareUrl;
|
||||
|
||||
if (!email || !shareUrl) {
|
||||
ui.showNotification('Error', 'Please enter a valid email address');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.invalidEmail'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate email format
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
if (!emailRegex.test(email)) {
|
||||
ui.showNotification('Error', 'Please enter a valid email address');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.invalidEmail'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -760,7 +760,7 @@ const contextMenus = {
|
||||
document.getElementById('notification-dialog')?.classList.add('hidden');
|
||||
} catch (error) {
|
||||
console.error('Error sending notification:', error);
|
||||
ui.showNotification('Error', 'Could not send notification');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.notificationSendError'));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -853,7 +853,7 @@ const fileOps = {
|
||||
// — no reload needed since the backend already confirmed creation.
|
||||
filesViewAddItem(folder);
|
||||
|
||||
ui.showNotification('Folder created', `"${name}" created successfully`);
|
||||
ui.showNotification(i18n.t('notif.folderCreated'), i18n.t('notif.folderCreatedBody', { name }));
|
||||
} else {
|
||||
const errorText = await response.text();
|
||||
console.error('Create folder error:', errorText);
|
||||
@@ -894,7 +894,7 @@ const fileOps = {
|
||||
if (response.ok) {
|
||||
// Reload files after moving
|
||||
await loadFiles();
|
||||
ui.showNotification('File moved', 'File moved successfully');
|
||||
ui.showNotification(i18n.t('notif.fileMoved'), i18n.t('notif.fileMovedBody'));
|
||||
return true;
|
||||
} else {
|
||||
let errorMessage = 'Unknown error';
|
||||
@@ -904,12 +904,12 @@ const fileOps = {
|
||||
} catch (_e) {
|
||||
errorMessage = 'Error processing server response';
|
||||
}
|
||||
ui.showNotification('Error', `Error moving the file: ${errorMessage}`);
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.fileMoveError', { error: errorMessage }));
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error moving file:', error);
|
||||
ui.showNotification('Error', 'Error moving the file');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.fileMoveErrorGeneric'));
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -938,7 +938,7 @@ const fileOps = {
|
||||
invalidateFolderMeta(folderId);
|
||||
// Reload files after moving
|
||||
await loadFiles();
|
||||
ui.showNotification('Folder moved', 'Folder moved successfully');
|
||||
ui.showNotification(i18n.t('notif.folderMoved'), i18n.t('notif.folderMovedBody'));
|
||||
return true;
|
||||
} else {
|
||||
let errorMessage = 'Unknown error';
|
||||
@@ -948,12 +948,12 @@ const fileOps = {
|
||||
} catch (_e) {
|
||||
errorMessage = 'Error processing server response';
|
||||
}
|
||||
ui.showNotification('Error', `Error moving the folder: ${errorMessage}`);
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.folderMoveError', { error: errorMessage }));
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error moving folder:', error);
|
||||
ui.showNotification('Error', 'Error moving the folder');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.folderMoveErrorGeneric'));
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -1037,7 +1037,7 @@ const fileOps = {
|
||||
await response.json();
|
||||
// Reload files after copying
|
||||
await loadFiles();
|
||||
ui.showNotification('File copied', 'File copied successfully');
|
||||
ui.showNotification(i18n.t('notif.fileCopied'), i18n.t('notif.fileCopiedBody'));
|
||||
return true;
|
||||
} else {
|
||||
let errorMessage = 'Unknown error';
|
||||
@@ -1047,12 +1047,12 @@ const fileOps = {
|
||||
} catch (_e) {
|
||||
errorMessage = 'Error processing server response';
|
||||
}
|
||||
ui.showNotification('Error', `Error copying the file: ${errorMessage}`);
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.fileCopyError', { error: errorMessage }));
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error copying file:', error);
|
||||
ui.showNotification('Error', 'Error copying the file');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.fileCopyErrorGeneric'));
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -1195,7 +1195,7 @@ const fileOps = {
|
||||
if (response.ok) {
|
||||
// Name changed — drop the cached breadcrumb metadata
|
||||
invalidateFolderMeta(folderId);
|
||||
ui.showNotification('Folder renamed', `Folder renamed to "${newName}"`);
|
||||
ui.showNotification(i18n.t('notif.folderRenamed'), i18n.t('notif.folderRenamedBody', { name: newName }));
|
||||
} else {
|
||||
const errorText = await response.text();
|
||||
console.error('Error response:', errorText);
|
||||
@@ -1239,7 +1239,7 @@ const fileOps = {
|
||||
|
||||
if (response.ok) {
|
||||
loadFiles();
|
||||
ui.showNotification('File moved to trash', `"${fileName}" moved to trash`);
|
||||
ui.showNotification(i18n.t('notif.fileTrashed'), i18n.t('notif.fileTrashedBody', { name: fileName }));
|
||||
return true;
|
||||
} else {
|
||||
// Fallback to direct deletion if trash fails
|
||||
@@ -1250,16 +1250,16 @@ const fileOps = {
|
||||
|
||||
if (fallbackResponse.ok) {
|
||||
loadFiles();
|
||||
ui.showNotification('File deleted', `"${fileName}" deleted successfully`);
|
||||
ui.showNotification(i18n.t('notif.fileDeleted'), i18n.t('notif.fileDeletedBody', { name: fileName }));
|
||||
return true;
|
||||
} else {
|
||||
ui.showNotification('Error', 'Error deleting the file');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.fileDeleteError'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error deleting file:', error);
|
||||
ui.showNotification('Error', 'Error deleting the file');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.fileDeleteError'));
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -1292,7 +1292,7 @@ const fileOps = {
|
||||
ui.updateBreadcrumb();
|
||||
}
|
||||
loadFiles();
|
||||
ui.showNotification('Folder moved to trash', `"${folderName}" moved to trash`);
|
||||
ui.showNotification(i18n.t('notif.folderTrashed'), i18n.t('notif.folderTrashedBody', { name: folderName }));
|
||||
return true;
|
||||
} else {
|
||||
// Fallback to direct deletion if trash fails
|
||||
@@ -1308,16 +1308,16 @@ const fileOps = {
|
||||
ui.updateBreadcrumb();
|
||||
}
|
||||
loadFiles();
|
||||
ui.showNotification('Folder deleted', `"${folderName}" deleted successfully`);
|
||||
ui.showNotification(i18n.t('notif.folderDeleted'), i18n.t('notif.folderDeletedBody', { name: folderName }));
|
||||
return true;
|
||||
} else {
|
||||
ui.showNotification('Error', 'Error deleting the folder');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.folderDeleteError'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error deleting folder:', error);
|
||||
ui.showNotification('Error', 'Error deleting the folder');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.folderDeleteError'));
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -1339,15 +1339,15 @@ const fileOps = {
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
ui.showNotification('Item restored', 'Item restored successfully');
|
||||
ui.showNotification(i18n.t('notif.itemRestored'), i18n.t('notif.itemRestoredBody'));
|
||||
return true;
|
||||
} else {
|
||||
ui.showNotification('Error', 'Error restoring the item');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.itemRestoreError'));
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error restoring item from trash:', error);
|
||||
ui.showNotification('Error', 'Error restoring the item');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.itemRestoreError'));
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -1372,15 +1372,15 @@ const fileOps = {
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
ui.showNotification('Item deleted', 'Item permanently deleted');
|
||||
ui.showNotification(i18n.t('notif.itemDeleted'), i18n.t('notif.itemDeletedBody'));
|
||||
return true;
|
||||
} else {
|
||||
ui.showNotification('Error', 'Error deleting the item');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.itemDeleteError'));
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error deleting item permanently:', error);
|
||||
ui.showNotification('Error', 'Error deleting the item');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.itemDeleteError'));
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -1404,15 +1404,15 @@ const fileOps = {
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
ui.showNotification('Trash emptied', 'The trash has been emptied successfully');
|
||||
ui.showNotification(i18n.t('notif.trashEmptied'), i18n.t('notif.trashEmptiedBody'));
|
||||
return true;
|
||||
} else {
|
||||
ui.showNotification('Error', 'Error emptying the trash');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.trashEmptyError'));
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error emptying trash:', error);
|
||||
ui.showNotification('Error', 'Error emptying the trash');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.trashEmptyError'));
|
||||
return false;
|
||||
}
|
||||
},
|
||||
@@ -1435,7 +1435,7 @@ const fileOps = {
|
||||
async downloadFolder(folderId, folderName) {
|
||||
// Show notification to user (the server still has to assemble the
|
||||
// ZIP before the browser's own download UI takes over).
|
||||
ui.showNotification('Preparing download', 'Preparing the folder for download...');
|
||||
ui.showNotification(i18n.t('notif.preparingDownload'), i18n.t('notif.preparingDownloadBody'));
|
||||
triggerBrowserDownload(`/api/folders/${folderId}/download?format=zip`, `${folderName}.zip`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import { loadFiles, renderItems } from '../../app/filesView.js';
|
||||
import { app } from '../../app/state.js';
|
||||
import { ui } from '../../app/ui.js';
|
||||
import { i18n } from '../../core/i18n.js';
|
||||
import { getAuthHeaders } from './fileOperations.js';
|
||||
|
||||
/**
|
||||
@@ -69,7 +70,7 @@ const search = {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error performing search:', error);
|
||||
ui.showNotification('Error', 'Error performing search');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.searchError'));
|
||||
return {
|
||||
files: [],
|
||||
folders: [],
|
||||
@@ -216,15 +217,15 @@ const search = {
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
ui.showNotification('Cache cleared', 'Search cache cleared successfully');
|
||||
ui.showNotification(i18n.t('notif.cacheCleared'), i18n.t('notif.cacheClearedBody'));
|
||||
return true;
|
||||
} else {
|
||||
ui.showNotification('Error', 'Error clearing search cache');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.cacheClearError'));
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error clearing search cache:', error);
|
||||
ui.showNotification('Error', 'Error clearing search cache');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.cacheClearError'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
import { loadFiles } from '../../app/filesView.js';
|
||||
import { ui } from '../../app/ui.js';
|
||||
import { i18n } from '../../core/i18n.js';
|
||||
|
||||
class WopiEditor {
|
||||
constructor() {
|
||||
@@ -54,7 +55,7 @@ class WopiEditor {
|
||||
window.open(hostUrl, '_blank');
|
||||
} catch (error) {
|
||||
console.error('Failed to open WOPI editor in tab:', error);
|
||||
ui.showNotification('Could not open the document editor.', 'error');
|
||||
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.wopiOpenError'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user