Showing curated campaigns on tags page.

This commit is contained in:
2024-06-17 01:28:20 +02:00
parent 64bf3b65ac
commit f9b7a8731e
7 changed files with 81 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
import { fetchScenes } from '#/src/scenes.js';
import { curateScenesQuery } from '#/src/web/scenes.js';
import { getRandomCampaigns } from '#/src/campaigns.js';
import { getRandomCampaigns, getCampaignIndex } from '#/src/campaigns.js';
export async function onBeforeRender(pageContext) {
const withQuery = Object.hasOwn(pageContext.urlParsed.search, 'q');
@@ -35,7 +35,7 @@ export async function onBeforeRender(pageContext) {
total,
} = sceneResults;
const campaignIndex = Math.floor((Math.random() * (0.5 - 0.2) + 0.2) * scenes.length);
const campaignIndex = getCampaignIndex(scenes.length);
const [scopeCampaign, sceneCampaign, paginationCampaign] = campaigns;
return {