feat(history): miniatures des vidéos importées (i.ytimg déterministe)

This commit is contained in:
2026-09-27 12:16:09 -04:00
parent 6c218e8773
commit 201fe979b8
4 changed files with 24 additions and 2 deletions
@@ -193,7 +193,7 @@
<a [routerLink]="['/watch', w.video_id]" [queryParams]="{ p: w.provider }" class="block p-4 pr-24 hover:no-underline">
<div class="flex">
<div class="relative flex-shrink-0 w-24 h-16 bg-slate-700 rounded overflow-hidden flex items-center justify-center">
@if (w.thumbnail) { <img [src]="w.thumbnail" alt="" class="w-full h-full object-cover" /> }
@if (thumbOf(w)) { <img [src]="thumbOf(w)" alt="" loading="lazy" class="w-full h-full object-cover" /> }
<div class="absolute bottom-0 left-0 right-0 h-1 bg-slate-600">
<div class="h-full bg-red-500" [style.width.%]="getProgressPercentage(w)"></div>
</div>
@@ -311,6 +311,16 @@ export class HistoryComponent {
});
// ============ Helpers affichage (conservés) ============
/** Miniature : stockée, sinon déterministe YouTube (imports Takeout sans vignette). */
thumbOf(w: WatchHistoryItem): string {
if (w?.thumbnail) return w.thumbnail;
const id = String(w?.video_id || '');
if ((w?.provider === 'youtube' || w?.provider === 'yt') && /^[A-Za-z0-9_-]{11}$/.test(id)) {
return `https://i.ytimg.com/vi/${id}/hqdefault.jpg`;
}
return '';
}
formatDate(dateString: string | Date): string {
if (!dateString) return '';
const date = new Date(dateString);