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:
DioCrafts
2026-06-15 00:17:17 +02:00
parent dac299fea6
commit 81a93a489b
129 changed files with 8194 additions and 2473 deletions
+125
View File
@@ -705,6 +705,9 @@ async function showInitialPanel() {
showPanel(loginPanel);
hidePanel(registerPanel);
hidePanel(adminSetupPanel);
// Cursor ready on the identifier field (panels start hidden, so a static
// `autofocus` attribute wouldn't fire — focus once the panel is shown).
/** @type {HTMLInputElement | null} */ (document.getElementById('login-username'))?.focus();
// Hide the admin setup link if admin already exists
const showAdminSetupLink = document.getElementById('show-admin-setup');
@@ -807,6 +810,7 @@ function initLoginElements() {
showPanel(loginPanel);
hidePanel(registerPanel);
hidePanel(adminSetupPanel);
/** @type {HTMLInputElement | null} */ (document.getElementById('login-username'))?.focus();
});
document.getElementById('show-admin-setup').addEventListener('click', () => {
@@ -821,9 +825,119 @@ function initLoginElements() {
hidePanel(adminSetupPanel);
});
// UX affordances: password reveal, magic-link disclosure, live match feedback,
// Caps-Lock warning on password fields.
initPasswordToggles();
initMagicLinkDisclosure();
initPasswordMatch('register-password', 'register-password-confirm', 'register-match');
initPasswordMatch('admin-password', 'admin-password-confirm', 'admin-match');
['login-password', 'register-password', 'admin-password'].forEach((id) =>
initCapsLockWarning(/** @type {HTMLInputElement | null} */ (document.getElementById(id)))
);
return true;
}
/**
* Wire every password show/hide toggle. Each button sits next to the
* <input> it controls inside an `.auth-input-wrap`.
*/
function initPasswordToggles() {
document.querySelectorAll('[data-pw-toggle]').forEach((btn) => {
const wrap = btn.closest('.auth-input-wrap');
const input = /** @type {HTMLInputElement | null} */ (wrap?.querySelector('input') ?? null);
if (!input) return;
const sync = () => {
const shown = input.type === 'text';
btn.setAttribute('aria-pressed', String(shown));
btn.setAttribute(
'aria-label',
shown ? i18n.t('auth.hidePassword', 'Hide password') : i18n.t('auth.showPassword', 'Show password')
);
};
sync();
btn.addEventListener('click', () => {
input.type = input.type === 'password' ? 'text' : 'password';
sync();
input.focus();
});
});
}
/**
* Show a "Caps Lock is on" hint under a password field while the key is active
* and the field is focused — saves a failed-login round-trip.
* @param {HTMLInputElement | null} input
*/
function initCapsLockWarning(input) {
if (!input) return;
const warn = document.createElement('div');
warn.className = 'auth-caps-warning hidden';
warn.setAttribute('role', 'status');
const icon = document.createElement('i');
icon.className = 'fas fa-arrow-up';
icon.setAttribute('aria-hidden', 'true');
const text = document.createElement('span');
text.textContent = i18n.t('auth.capsLock', 'Caps Lock is on');
warn.append(icon, text);
input.closest('.auth-input-group')?.appendChild(warn);
/** @param {KeyboardEvent} e */
const sync = (e) => {
const on = typeof e.getModifierState === 'function' && e.getModifierState('CapsLock');
warn.classList.toggle('hidden', !(on && document.activeElement === input));
};
input.addEventListener('keydown', sync);
input.addEventListener('keyup', sync);
input.addEventListener('blur', () => warn.classList.add('hidden'));
}
/**
* Progressive disclosure: keep the magic-link form collapsed behind a quiet
* toggle so the login screen leads with a single primary path.
*/
function initMagicLinkDisclosure() {
const toggle = document.getElementById('magic-link-toggle');
const reveal = document.getElementById('magic-link-reveal');
if (!toggle || !reveal) return;
toggle.addEventListener('click', () => {
// classList.toggle returns true when the class is now PRESENT (collapsed).
const open = reveal.classList.toggle('hidden') === false;
toggle.setAttribute('aria-expanded', String(open));
if (open) {
const email = /** @type {HTMLInputElement | null} */ (document.getElementById('magic-link-email'));
email?.focus();
}
});
}
/**
* Live "passwords match" feedback rendered under a confirm field.
* @param {string} passId
* @param {string} confirmId
* @param {string} indicatorId
*/
function initPasswordMatch(passId, confirmId, indicatorId) {
const pass = /** @type {HTMLInputElement | null} */ (document.getElementById(passId));
const confirmEl = /** @type {HTMLInputElement | null} */ (document.getElementById(confirmId));
const out = document.getElementById(indicatorId);
if (!pass || !confirmEl || !out) return;
const update = () => {
if (!confirmEl.value) {
out.className = 'auth-match';
out.textContent = '';
return;
}
const ok = pass.value === confirmEl.value;
out.className = `auth-match show ${ok ? 'auth-match--ok' : 'auth-match--bad'}`;
out.textContent = ok
? i18n.t('auth.passwordsMatch', 'Passwords match')
: i18n.t('auth.passwords_mismatch', "Passwords don't match");
};
pass.addEventListener('input', update);
confirmEl.addEventListener('input', update);
}
// Initialize login elements if on login page
const isLoginPage = initLoginElements();
@@ -993,6 +1107,13 @@ if (isLoginPage && loginForm) {
const username = inputVal('login-username');
const password = inputVal('login-password');
const loginSubmit = /** @type {HTMLButtonElement | null} */ (
document.getElementById('login-submit')
);
loginSubmit?.classList.add('is-loading');
loginSubmit?.setAttribute('aria-busy', 'true');
if (loginSubmit) loginSubmit.disabled = true;
try {
const data = await login(username, password);
@@ -1030,6 +1151,10 @@ if (isLoginPage && loginForm) {
} catch (error) {
loginError.textContent = errMessage(error) || 'Error logging in';
loginError.style.display = 'block';
} finally {
loginSubmit?.classList.remove('is-loading');
loginSubmit?.removeAttribute('aria-busy');
if (loginSubmit) loginSubmit.disabled = false;
}
});
}
+10 -10
View File
@@ -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'));
}
},
+3 -3
View File
@@ -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'));
}
},
+29 -29
View File
@@ -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`);
}
};
+5 -4
View File
@@ -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;
}
}
+2 -1
View File
@@ -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'));
}
}
+23 -1
View File
@@ -181,6 +181,7 @@ const photosView = {
html += '<div class="photos-sentinel"></div>';
this._container.innerHTML = html;
this._container.onclick = (e) => this._handleClick(e);
this._fadeInTiles();
this._renderedCount = this.items.length;
this._observeSentinel();
this._setupVideoThumbnails();
@@ -237,6 +238,7 @@ const photosView = {
this._renderedCount = this.items.length;
this._observeSentinel();
this._setupVideoThumbnails(startIndex);
this._fadeInTiles();
},
/**
@@ -250,12 +252,32 @@ const photosView = {
const thumbUrl = cachedThumb || `/api/files/${file.id}/thumbnail/preview`;
let h = `<div class="photo-tile${selected}" data-id="${this._escAttr(file.id)}" data-mime="${this._escAttr(file.mime_type)}" data-name="${this._escAttr(file.name)}">`;
h += `<div class="photo-check"><i class="fas fa-check"></i></div>`;
h += `<img src="${thumbUrl}" loading="lazy" alt="${this._escAttr(file.name)}">`;
const srcset = cachedThumb
? ''
: ` srcset="/api/files/${file.id}/thumbnail/icon 150w, /api/files/${file.id}/thumbnail/preview 400w, /api/files/${file.id}/thumbnail/large 800w" sizes="(max-width: 768px) 33vw, 200px"`;
h += `<img src="${thumbUrl}"${srcset} loading="lazy" decoding="async" alt="${this._escAttr(file.name)}">`;
if (isVideo) h += `<div class="video-badge"><i class="fas fa-play"></i></div>`;
h += `</div>`;
return h;
},
/**
* Fade tiles in as their thumbnails finish loading (kills the pop-in).
* Idempotent — only wires images not already marked loaded.
*/
_fadeInTiles() {
this._container?.querySelectorAll('.photo-tile img:not(.is-loaded)').forEach((el) => {
const img = /** @type {HTMLImageElement} */ (el);
if (img.complete) {
img.classList.add('is-loaded');
} else {
const done = () => img.classList.add('is-loaded');
img.addEventListener('load', done, { once: true });
img.addEventListener('error', done, { once: true });
}
});
},
/** (Re-)observe the sentinel element for infinite scroll */
_observeSentinel() {
this._destroyObserver();
@@ -157,6 +157,17 @@ export const photosLightbox = {
requestAnimationFrame(() => el.classList.add('active'));
},
/** Preload the immediate prev/next thumbnails so navigation is instant. */
_preloadNeighbors() {
[this.index - 1, this.index + 1].forEach((i) => {
const it = this.items[i];
if (it && !it.mime_type?.startsWith('video/')) {
const pre = new Image();
pre.src = this._thumbUrl(it);
}
});
},
/** Display the current item */
_show() {
if (!this._overlay || this.index < 0) return;
@@ -193,6 +204,9 @@ export const photosLightbox = {
const fullResIcon = fullResBtn.querySelector('i');
if (fullResIcon) fullResIcon.className = 'fas fa-expand';
// Preload neighbours so prev/next is instant.
this._preloadNeighbors();
// Load content
content.innerHTML = '<div class="photos-loading"><i class="fas fa-spinner"></i></div>';
+4 -3
View File
@@ -8,6 +8,7 @@ import { switchToSharedSection } from '../../app/navigation.js';
import { ui } from '../../app/ui.js';
import { getCsrfHeaders } from '../../core/csrf.js';
import { formatDateTime } from '../../core/formatters.js';
import { i18n } from '../../core/i18n.js';
/**
* @import {CreateShare, ShareItem, UpdateShare} from '../../core/types.js'
@@ -169,11 +170,11 @@ const fileSharing = {
async copyLinkToClipboard(url) {
try {
await navigator.clipboard.writeText(url);
ui.showNotification('Link copied', 'Link copied to clipboard');
ui.showNotification(i18n.t('notif.linkCopied'), i18n.t('notif.linkCopiedBody'));
return true;
} catch (error) {
console.error('Error copying to clipboard:', error);
ui.showNotification('Error', 'Could not copy link');
ui.showNotification(i18n.t('notif.errorTitle'), i18n.t('notif.linkCopyError'));
return false;
}
},
@@ -198,7 +199,7 @@ const fileSharing = {
async sendShareNotification(shareUrl, recipientEmail, _message = '') {
// TODO: implement backend endpoint for email notifications
console.log(`Share notification for ${shareUrl} sent to ${recipientEmail}`);
ui.showNotification('Notification sent', `Notification sent to ${recipientEmail}`);
ui.showNotification(i18n.t('notif.notificationSent'), i18n.t('notif.notificationSentBody', { email: recipientEmail }));
return true;
},