Compare commits

...

2 Commits

4 changed files with 27 additions and 10 deletions

4
package-lock.json generated
View File

@ -1,11 +1,11 @@
{ {
"name": "traxxx-web", "name": "traxxx-web",
"version": "0.41.5", "version": "0.41.6",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "0.41.5", "version": "0.41.6",
"dependencies": { "dependencies": {
"@brillout/json-serializer": "^0.5.8", "@brillout/json-serializer": "^0.5.8",
"@dicebear/collection": "^7.0.5", "@dicebear/collection": "^7.0.5",

View File

@ -87,7 +87,7 @@
"overrides": { "overrides": {
"vite": "$vite" "vite": "$vite"
}, },
"version": "0.41.5", "version": "0.41.6",
"imports": { "imports": {
"#/*": "./*.js" "#/*": "./*.js"
} }

View File

@ -6,6 +6,7 @@ import { fetchMovies } from '#/src/movies.js';
import { curateScenesQuery } from '#/src/web/scenes.js'; import { curateScenesQuery } from '#/src/web/scenes.js';
import { curateMoviesQuery } from '#/src/web/movies.js'; import { curateMoviesQuery } from '#/src/web/movies.js';
import { fetchCountries } from '#/src/countries.js'; import { fetchCountries } from '#/src/countries.js';
import { getRandomCampaigns, getCampaignIndex } from '#/src/campaigns.js';
async function fetchReleases(pageContext) { async function fetchReleases(pageContext) {
if (pageContext.routeParams.domain === 'movies') { if (pageContext.routeParams.domain === 'movies') {
@ -40,16 +41,27 @@ export async function onBeforeRender(pageContext) {
throw redirect(`/login?r=${encodeURIComponent(pageContext.urlOriginal)}`); throw redirect(`/login?r=${encodeURIComponent(pageContext.urlOriginal)}`);
} }
const [[actor], actorReleases, countries] = await Promise.all([ const [actor] = await fetchActorsById([Number(pageContext.routeParams.actorId)], {}, pageContext.user);
fetchActorsById([Number(pageContext.routeParams.actorId)], {}, pageContext.user),
fetchReleases(pageContext),
isEditing && fetchCountries(),
]);
if (!actor) { if (!actor) {
throw render(404, `Cannot find actor '${pageContext.routeParams.actorId}'.`); throw render(404, `Cannot find actor '${pageContext.routeParams.actorId}'.`);
} }
const [actorReleases, campaigns, countries] = await Promise.all([
fetchReleases(pageContext),
getRandomCampaigns([
// don't show meta campaign, too intrusive under actor bio
{ minRatio: 3 },
pageContext.routeParams.domain === 'scenes'
? { minRatio: 0.75, maxRatio: 1.25 }
: null,
].filter(Boolean), { tagFilter: pageContext.tagFilter }),
isEditing && fetchCountries(),
]);
const campaignIndex = getCampaignIndex(actorReleases.limit);
const [paginationCampaign, sceneCampaign] = campaigns;
return { return {
pageContext: { pageContext: {
title: isEditing title: isEditing
@ -60,6 +72,11 @@ export async function onBeforeRender(pageContext) {
countries, countries,
...actorReleases, ...actorReleases,
}, },
campaigns: {
index: campaignIndex,
scenes: actorReleases.limit > 5 && sceneCampaign,
pagination: paginationCampaign,
},
}, },
}; };
} }

View File

@ -43,8 +43,8 @@ export async function onBeforeRender(pageContext) {
fetchTagsById([tagSlug], {}, pageContext.user), fetchTagsById([tagSlug], {}, pageContext.user),
fetchReleases(pageContext), fetchReleases(pageContext),
getRandomCampaigns([ getRandomCampaigns([
{ tagSlugs: [tagSlug], minRatio: 1.5 }, { tagSlugs: [tagSlug], minRatio: 3 },
{ tagSlugs: [tagSlug], minRatio: 1.5 }, { tagSlugs: [tagSlug], minRatio: 3 },
pageContext.routeParams.domain === 'scenes' pageContext.routeParams.domain === 'scenes'
? { tagSlugs: [tagSlug], minRatio: 0.75, maxRatio: 1.25 } ? { tagSlugs: [tagSlug], minRatio: 0.75, maxRatio: 1.25 }
: null, : null,