corrections des erreurs remarquées par Wilfried

This commit is contained in:
MiharyR 2021-11-27 22:13:46 +01:00
parent d1ac1b77f0
commit 939e5f4df1
33 changed files with 66 additions and 112 deletions

View file

@ -11,6 +11,15 @@ import {Router} from "@angular/router";
interface VideoHistory {
imageUrl: string,
title: string,
date: Date,
source: string,
}
@Component({
selector: 'app-page-history-user',
templateUrl: './page-history-user.component.html',
@ -37,8 +46,10 @@ export class PageHistoryUserComponent implements AfterViewInit
this.userHistoryService.clearTabVideoUrlClicked();
// --- FAUX CODE ---
const tabVideo: VideoAll[] = this.fictitiousVideosService.getTabVideoAll(8);
this.dataSource = new MatTableDataSource(tabVideo);
const tabVideoAll: VideoAll[] = this.fictitiousVideosService.getTabVideoAll(8);
let tabVideoHistory: VideoHistory[] = [];
for(let videoAll of tabVideoAll) tabVideoHistory.push(this.videoAllToVideoHistory(videoAll));
this.dataSource = new MatTableDataSource(tabVideoHistory);
this.dataSource.sort = this.sort;
this.dataSource.paginator = this.paginator;
this.dataSource = this.dataSource;
@ -67,15 +78,6 @@ export class PageHistoryUserComponent implements AfterViewInit
}
// Retourne la source de la video en fonction de l'url
getSourceByUrl(url: string): string
{
if(url.includes("youtu")) return "Youtube" ;
else if(url.includes("daily")) return "Dailymotion" ;
else return "???" ;
}
// Supprime la video
onDelete(video: VideoAll): void
{
@ -109,4 +111,15 @@ export class PageHistoryUserComponent implements AfterViewInit
this.router.navigateByUrl(url);
}
videoAllToVideoHistory(videoAll: VideoAll): VideoHistory
{
return {
imageUrl: videoAll.imageUrl,
title: videoAll.title,
date: videoAll.watchedDates[videoAll.watchedDates.length-1],
source: videoAll.source,
}
}
}