Removed info channels from overview. Fixed poster gap.

This commit is contained in:
2024-06-12 17:09:53 +02:00
parent bfe6dc866d
commit 41d6324c28
13 changed files with 302 additions and 99 deletions

View File

@@ -253,7 +253,6 @@ const scrollable = computed(() => children.value?.scrollWidth > children.value?.
@media(--small-20) {
.logo {
height: 1rem;
padding: .5rem 1rem;
}

View File

@@ -3,6 +3,7 @@ import { render } from 'vike/abort'; /* eslint-disable-line import/extensions */
import { fetchEntitiesById } from '#/src/entities.js';
import { fetchScenes } from '#/src/scenes.js';
import { curateScenesQuery } from '#/src/web/scenes.js';
import { getRandomCampaigns } from '#/src/campaigns.js';
import redis from '#/src//redis.js';
export async function onBeforeRender(pageContext) {
@@ -12,7 +13,10 @@ export async function onBeforeRender(pageContext) {
throw render(404, `Cannot find ${pageContext.routeParams.entityType} '${pageContext.routeParams.entitySlug}'.`);
}
const [[entity], entityScenes] = await Promise.all([
const [
[entity],
entityScenes,
] = await Promise.all([
fetchEntitiesById([Number(entityId)], { includeChildren: true }),
fetchScenes(await curateScenesQuery({
...pageContext.urlQuery,
@@ -26,6 +30,23 @@ export async function onBeforeRender(pageContext) {
}, pageContext.user),
]);
const campaigns = await getRandomCampaigns([
{
entityIds: [entity.id, entity.parent?.id].filter(Boolean),
minRatio: 1.5,
},
{
entityIds: [entity.id, entity.parent?.id].filter(Boolean),
minRatio: 0.75,
maxRatio: 1.25,
},
{
entityIds: [entity.id, entity.parent?.id].filter(Boolean),
parentEntityId: entity.parent?.id,
minRatio: 1.5,
},
]);
const {
scenes,
aggActors,
@@ -35,6 +56,9 @@ export async function onBeforeRender(pageContext) {
limit,
} = entityScenes;
const campaignIndex = Math.floor((Math.random() * (0.5 - 0.2) + 0.2) * scenes.length);
const [metaCampaign, sceneCampaign, paginationCampaign] = campaigns;
return {
pageContext: {
title: entity.name,
@@ -47,6 +71,12 @@ export async function onBeforeRender(pageContext) {
total,
limit,
},
campaigns: {
index: campaignIndex,
meta: metaCampaign,
scenes: scenes.length > 5 && sceneCampaign,
pagination: paginationCampaign,
},
},
};
}