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,
},
},
};
}

View File

@@ -36,12 +36,12 @@
</div>
<div
v-if="scene.photos.length > 0"
v-if="scene.photos.length > 0 || scene.caps.length > 0"
class="album"
:class="{ single: scene.photos.length === 1 }"
:class="{ single: (scene.photos.length + scene.caps.length) === 1 }"
>
<div
v-for="photo in scene.photos"
v-for="photo in [...scene.photos, ...scene.caps]"
:key="`photo-${photo.id}`"
class="photo-container"
>
@@ -444,6 +444,11 @@ function copySummary() {
margin-right: .5rem;
}
.poster-link {
height: 100%;
width: calc(21/9 * 16rem);
}
.poster {
height: 100%;
width: 100%;
@@ -638,7 +643,7 @@ function copySummary() {
overflow-x: auto;
.actor {
width: 8rem;
width: 10rem;
flex-shrink: 0;
}
}
@@ -786,6 +791,10 @@ function copySummary() {
flex-shrink: 1;
}
.poster-link {
width: 100%;
}
.trailer {
margin: 0;
flex-shrink: 1;
@@ -812,7 +821,9 @@ function copySummary() {
}
.actors {
grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
.actor {
width: 9rem;
}
}
.series {
@@ -833,10 +844,4 @@ function copySummary() {
font-size: .9rem;
}
}
@media(--small-60) {
.actors {
grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
}
}
</style>

View File

@@ -15,6 +15,8 @@ function getTitle(scene) {
export async function onBeforeRender(pageContext) {
const [scene] = await fetchScenesById([Number(pageContext.routeParams.sceneId)], {
reqUser: pageContext.user,
includeAssets: true,
includePartOf: true,
actorStashes: true,
});

View File

@@ -1,5 +1,5 @@
<template>
<div>
<div class="updates">
<Scenes
:show-filters="!!query"
:show-meta="!!query"
@@ -16,3 +16,10 @@ import Scenes from '#/components/scenes/scenes.vue';
const pageContext = inject('pageContext');
const query = Object.hasOwn(pageContext.urlParsed.search, 'q');
</script>
<style scoped>
.updates {
display: flex;
flex-grow: 1;
}
</style>

View File

@@ -1,10 +1,31 @@
import { fetchScenes } from '#/src/scenes.js';
import { curateScenesQuery } from '#/src/web/scenes.js';
import { getRandomCampaign } from '#/src/campaigns.js';
import { getRandomCampaigns } from '#/src/campaigns.js';
export async function onBeforeRender(pageContext) {
const withQuery = Object.hasOwn(pageContext.urlParsed.search, 'q');
const [
sceneResults,
campaigns,
] = await Promise.all([
fetchScenes(await curateScenesQuery({
...pageContext.urlQuery,
scope: pageContext.routeParams.scope || 'latest',
isShowcased: withQuery ? null : true,
tagFilter: pageContext.tagFilter,
}), {
page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 29,
aggregate: withQuery,
}, pageContext.user),
getRandomCampaigns([
{ minRatio: 1.5 },
{ minRatio: 0.75, maxRatio: 1.25 },
{ minRatio: 1.5 },
]),
]);
const {
scenes,
aggTags,
@@ -12,20 +33,10 @@ export async function onBeforeRender(pageContext) {
aggActors,
limit,
total,
} = await fetchScenes(await curateScenesQuery({
...pageContext.urlQuery,
scope: pageContext.routeParams.scope || 'latest',
isShowcased: withQuery ? null : true,
tagFilter: pageContext.tagFilter,
}), {
page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 29,
aggregate: withQuery,
}, pageContext.user);
} = sceneResults;
// const campaignIndex = Math.floor(Math.random() * (scenes.length - 5)) + 5;
const campaignIndex = Math.floor((Math.random() * (0.5 - 0.2) + 0.2) * scenes.length);
const sceneCampaign = await getRandomCampaign({ minRatio: 0.75, maxRatio: 1.25 });
const [scopeCampaign, sceneCampaign, paginationCampaign] = campaigns;
return {
pageContext: {
@@ -37,10 +48,12 @@ export async function onBeforeRender(pageContext) {
aggActors,
limit,
total,
campaigns: {
index: campaignIndex,
scenes: sceneCampaign,
},
},
campaigns: {
index: campaignIndex,
scope: scopeCampaign,
scenes: scenes.length > 5 && sceneCampaign,
pagination: paginationCampaign,
},
},
};