Initial work on library page

This commit is contained in:
Aleksi Lassila
2023-06-15 02:08:47 +03:00
parent c463bb89e9
commit e41b030d45
15 changed files with 275 additions and 26 deletions

12
src/lib/utils.ts Normal file
View File

@@ -0,0 +1,12 @@
import type { Genre } from '$lib/tmdb-api';
export function getRuntime(minutes: number) {
const hours = Math.floor(minutes / 60);
const mins = Math.floor(minutes % 60);
return `${hours > 0 ? hours + 'h ' : ''}${mins}min`;
}
export function formatGenres(genres: Genre[]) {
return genres.map((genre) => genre.name.charAt(0).toUpperCase() + genre.name.slice(1)).join(', ');
}