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:
@@ -48,6 +48,10 @@ const Modal = {
|
||||
/** @private */
|
||||
_savedBodyHTML: '',
|
||||
|
||||
// Element focused before the modal opened — focus returns here on close.
|
||||
/** @private @type {HTMLElement|null} */
|
||||
_previousFocus: null,
|
||||
|
||||
/**
|
||||
* Initialize modal system
|
||||
*/
|
||||
@@ -80,6 +84,11 @@ const Modal = {
|
||||
}
|
||||
});
|
||||
|
||||
// Trap Tab focus within the dialog while it is open.
|
||||
this.overlay.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Tab') this._trapFocus(e);
|
||||
});
|
||||
|
||||
// Clear inline error as soon as the user starts typing
|
||||
this.input?.addEventListener('input', () => this.clearError());
|
||||
|
||||
@@ -227,12 +236,38 @@ const Modal = {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Keep Tab focus cycling within the dialog container (focus trap).
|
||||
* @private
|
||||
* @param {KeyboardEvent} e
|
||||
*/
|
||||
_trapFocus(e) {
|
||||
const container = this.overlay?.querySelector('.modal-container');
|
||||
if (!container) return;
|
||||
const focusables = /** @type {NodeListOf<HTMLElement>} */ (
|
||||
container.querySelectorAll(
|
||||
'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
||||
)
|
||||
);
|
||||
if (!focusables.length) return;
|
||||
const first = focusables[0];
|
||||
const last = focusables[focusables.length - 1];
|
||||
if (e.shiftKey && document.activeElement === first) {
|
||||
e.preventDefault();
|
||||
last.focus();
|
||||
} else if (!e.shiftKey && document.activeElement === last) {
|
||||
e.preventDefault();
|
||||
first.focus();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the modal
|
||||
*/
|
||||
open() {
|
||||
if (!this.overlay) return;
|
||||
|
||||
this._previousFocus = /** @type {HTMLElement|null} */ (document.activeElement);
|
||||
this.confirmBtn.disabled = false;
|
||||
|
||||
// Show overlay
|
||||
@@ -295,6 +330,10 @@ const Modal = {
|
||||
this._panelMode = false;
|
||||
this._savedBodyHTML = '';
|
||||
}
|
||||
|
||||
// Return focus to whatever was focused before the modal opened.
|
||||
this._previousFocus?.focus?.();
|
||||
this._previousFocus = null;
|
||||
}, 200);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user