diff --git a/src/lib/Card.svelte b/src/lib/Card.svelte index d628788..930ac8c 100644 --- a/src/lib/Card.svelte +++ b/src/lib/Card.svelte @@ -9,6 +9,8 @@ function validImage(url) { return url.includes('https://'); } + + let starsRatingMaskWidth = !!ratings ? (ratings / 5) * 100 : 0;
@@ -33,7 +35,7 @@ {#each Array.from({ length: 5 }) as star}★{/each} - + {#each Array.from({ length: 5 }) as star}★{/each} diff --git a/src/routes/og/extract-params.js b/src/routes/og/extract-params.js index fd5bca8..f91009f 100644 --- a/src/routes/og/extract-params.js +++ b/src/routes/og/extract-params.js @@ -8,8 +8,8 @@ export function extractSearchParams(searchParams) { title: searchParams.get('title') ?? undefined, image: searchParams.get('image') ?? undefined, variants: searchParams.get('variants') === 'true' ? true : false, - ratings: searchParams.get('ratings') ?? undefined, - ratings_count: searchParams.get('ratings_count') ?? undefined, + ratings: searchParams.get('ratings') && searchParams.get('ratings') !== 'undefined' ? parseFloat(searchParams.get('ratings')) : undefined, + ratings_count: searchParams.get('ratings_count') && searchParams.get('ratings_count') !== 'undefined' ? parseInt(searchParams.get('ratings_count')) : undefined, }; return renderparams; }