fix: pagination value divisible by 2 and 3

This commit is contained in:
Cory Dransfeldt 2024-11-28 16:57:52 -08:00
parent 643aa242ff
commit 984773793d
No known key found for this signature in database
7 changed files with 18 additions and 13 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"version": "1.5.0", "version": "1.5.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "coryd.dev", "name": "coryd.dev",
"version": "1.5.0", "version": "1.5.1",
"dependencies": { "dependencies": {
"@astrojs/check": "0.9.4", "@astrojs/check": "0.9.4",
"@astrojs/cloudflare": "^11.2.0", "@astrojs/cloudflare": "^11.2.0",

View file

@ -1,7 +1,7 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"type": "module", "type": "module",
"version": "1.5.0", "version": "1.5.1",
"scripts": { "scripts": {
"dev": "astro dev", "dev": "astro dev",
"start": "astro dev", "start": "astro dev",

View file

@ -4,6 +4,7 @@ import Grid from "@components/media/Grid.astro";
import { fetchMovies } from "@utils/data/movies.js"; import { fetchMovies } from "@utils/data/movies.js";
import { shuffleArray } from "@utils/helpers/general.js"; import { shuffleArray } from "@utils/helpers/general.js";
import icons from "@cdransf/astro-tabler-icons"; import icons from "@cdransf/astro-tabler-icons";
import { WATCHING_PAGE_SIZE } from "@utils/constants/index.js"
export const prerender = true; export const prerender = true;
@ -11,7 +12,7 @@ export const getStaticPaths = async ({ paginate }) => {
const movies = await fetchMovies(); const movies = await fetchMovies();
const favoriteMovies = movies.favorites; const favoriteMovies = movies.favorites;
return paginate(favoriteMovies, { return paginate(favoriteMovies, {
pageSize: 15, pageSize: WATCHING_PAGE_SIZE,
}); });
}; };
@ -54,7 +55,7 @@ const description = "These are my favorite movies. There are many like them, but
data={paginatedMovies} data={paginatedMovies}
pagination={pagination} pagination={pagination}
shape="poster" shape="poster"
count={15} count={WATCHING_PAGE_SIZE}
loading="eager" loading="eager"
/> />
</Layout> </Layout>

View file

@ -4,6 +4,7 @@ import Grid from "@components/media/Grid.astro";
import { fetchShows } from "@utils/data/tv.js"; import { fetchShows } from "@utils/data/tv.js";
import { shuffleArray } from "@utils/helpers/general.js"; import { shuffleArray } from "@utils/helpers/general.js";
import icons from "@cdransf/astro-tabler-icons"; import icons from "@cdransf/astro-tabler-icons";
import { WATCHING_PAGE_SIZE } from "@utils/constants/index.js"
export const prerender = true; export const prerender = true;
@ -11,7 +12,7 @@ export const getStaticPaths = async ({ paginate }) => {
const shows = await fetchShows(); const shows = await fetchShows();
const favoriteShows = shows.favorites; const favoriteShows = shows.favorites;
return paginate(favoriteShows, { return paginate(favoriteShows, {
pageSize: 15, pageSize: WATCHING_PAGE_SIZE,
}); });
}; };
@ -54,7 +55,7 @@ const description = "These are my favorite TV shows. There are many like them, b
data={paginatedShows} data={paginatedShows}
pagination={pagination} pagination={pagination}
shape="poster" shape="poster"
count={15} count={WATCHING_PAGE_SIZE}
loading="eager" loading="eager"
/> />
</Layout> </Layout>

View file

@ -4,6 +4,7 @@ import Grid from "@components/media/Grid.astro";
import { fetchMovies } from "@utils/data/movies.js"; import { fetchMovies } from "@utils/data/movies.js";
import { shuffleArray } from "@utils/helpers/general.js"; import { shuffleArray } from "@utils/helpers/general.js";
import icons from "@cdransf/astro-tabler-icons"; import icons from "@cdransf/astro-tabler-icons";
import { WATCHING_PAGE_SIZE } from "@utils/constants/index.js"
export const prerender = true; export const prerender = true;
@ -11,7 +12,7 @@ export const getStaticPaths = async ({ paginate }) => {
const movies = await fetchMovies(); const movies = await fetchMovies();
const recentlyWatchedMovies = movies.recentlyWatched; const recentlyWatchedMovies = movies.recentlyWatched;
return paginate(recentlyWatchedMovies, { return paginate(recentlyWatchedMovies, {
pageSize: 15, pageSize: WATCHING_PAGE_SIZE,
}); });
}; };
@ -60,7 +61,7 @@ const description =
data={paginatedMovies} data={paginatedMovies}
pagination={pagination} pagination={pagination}
shape="poster" shape="poster"
count={15} count={WATCHING_PAGE_SIZE}
loading="eager" loading="eager"
/> />
</Layout> </Layout>

View file

@ -4,6 +4,7 @@ import Grid from "@components/media/Grid.astro";
import { fetchShows } from "@utils/data/tv.js"; import { fetchShows } from "@utils/data/tv.js";
import { shuffleArray } from "@utils/helpers/general.js"; import { shuffleArray } from "@utils/helpers/general.js";
import icons from "@cdransf/astro-tabler-icons"; import icons from "@cdransf/astro-tabler-icons";
import { WATCHING_PAGE_SIZE } from "@utils/constants/index.js"
export const prerender = true; export const prerender = true;
@ -12,7 +13,7 @@ export const getStaticPaths = async ({ paginate }) => {
const recentlyWatchedShows = shows.recentlyWatched || []; const recentlyWatchedShows = shows.recentlyWatched || [];
return paginate(recentlyWatchedShows, { return paginate(recentlyWatchedShows, {
pageSize: 15, pageSize: WATCHING_PAGE_SIZE,
}); });
}; };
@ -61,7 +62,7 @@ const description = "All of the shows I've watched recently.";
data={paginatedShows} data={paginatedShows}
pagination={pagination} pagination={pagination}
shape="poster" shape="poster"
count={15} count={WATCHING_PAGE_SIZE}
loading="eager" loading="eager"
/> />
</Layout> </Layout>

View file

@ -1 +1,2 @@
export const CACHE_DURATION = 120 * 1000; export const CACHE_DURATION = 120 * 1000;
export const WATCHING_PAGE_SIZE = 12;