docs: add JSDoc comments to functions in VideoListComponent

This commit is contained in:
Chneemann 2025-05-02 19:58:02 +02:00
parent 81f449296f
commit 5f91d075ca

View file

@ -17,11 +17,21 @@ export class VideoListComponent {
@Input() videoCategory: string = ''; @Input() videoCategory: string = '';
@Output() currentVideoId = new EventEmitter<number>(); @Output() currentVideoId = new EventEmitter<number>();
/**
* Get the URL of the thumbnail image for the given videoId and fileName.
* @param videoId The id of the video.
* @param fileName The name of the video file.
* @returns The URL of the thumbnail image.
*/
getThumbnailUrl(videoId: number | undefined, fileName: string): string { getThumbnailUrl(videoId: number | undefined, fileName: string): string {
const id = videoId ?? 0; const id = videoId ?? 0;
return `${environment.baseUrl}/media/thumbnails/${id}/${fileName}_480p.jpg`; return `${environment.baseUrl}/media/thumbnails/${id}/${fileName}_480p.jpg`;
} }
/**
* Set the current video based on the given videoId and emit the videoId.
* @param videoId The id of the video to set as the current video.
*/
openCurrentVideo(videoId: number | undefined) { openCurrentVideo(videoId: number | undefined) {
if (videoId !== undefined) { if (videoId !== undefined) {
const video = this.videos.find((v) => v.id === videoId); const video = this.videos.find((v) => v.id === videoId);
@ -32,6 +42,10 @@ export class VideoListComponent {
} }
} }
/**
* Scrolls the video container to the left by a fixed amount when the scroll-left button is clicked.
* @param event The mouse event triggered by clicking the scroll-left button.
*/
scrollLeft(event: MouseEvent) { scrollLeft(event: MouseEvent) {
const button = event.target as HTMLElement; const button = event.target as HTMLElement;
const container = button const container = button
@ -42,6 +56,10 @@ export class VideoListComponent {
} }
} }
/**
* Scrolls the video container to the right by a fixed amount when the scroll-right button is clicked.
* @param event The mouse event triggered by clicking the scroll-right button.
*/
scrollRight(event: MouseEvent) { scrollRight(event: MouseEvent) {
const button = event.target as HTMLElement; const button = event.target as HTMLElement;
const container = button const container = button