From dbc6ee0c6c430db85b89f408c4b3489e82c73175 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Sun, 7 Jul 2024 21:01:44 +0200 Subject: [PATCH] Added secondary stash menu to stash heart. --- components/stashes/heart.vue | 142 ++++++++++-------- components/stashes/menu.vue | 54 +++++++ pages/_error/+Page.vue | 1 + pages/entities/@entitySlug/+onBeforeRender.js | 1 - pages/scene/+Page.vue | 12 +- pages/scene/+onBeforeRender.js | 17 +++ src/web/graphql.js | 8 +- src/web/scenes.js | 6 + static | 2 +- 9 files changed, 171 insertions(+), 72 deletions(-) create mode 100644 components/stashes/menu.vue diff --git a/components/stashes/heart.vue b/components/stashes/heart.vue index 7433b95..a9b9dd7 100644 --- a/components/stashes/heart.vue +++ b/components/stashes/heart.vue @@ -3,73 +3,91 @@ v-if="user" class="bookmarks" > - + - - + + + diff --git a/components/stashes/menu.vue b/components/stashes/menu.vue new file mode 100644 index 0000000..334ffff --- /dev/null +++ b/components/stashes/menu.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/pages/_error/+Page.vue b/pages/_error/+Page.vue index a5f0687..9e1deb5 100644 --- a/pages/_error/+Page.vue +++ b/pages/_error/+Page.vue @@ -32,5 +32,6 @@ const { abortReason } = pageContext; .page { display: flex; justify-content: center; + flex-grow: 1; } diff --git a/pages/entities/@entitySlug/+onBeforeRender.js b/pages/entities/@entitySlug/+onBeforeRender.js index 0b4b290..224f56a 100644 --- a/pages/entities/@entitySlug/+onBeforeRender.js +++ b/pages/entities/@entitySlug/+onBeforeRender.js @@ -44,7 +44,6 @@ export async function onBeforeRender(pageContext) { }, { entityIds: [entity.id, entity.parent?.id].filter(Boolean), - parentEntityId: entity.parent?.id, minRatio: 1.5, allowRandomFallback: false, }, diff --git a/pages/scene/+Page.vue b/pages/scene/+Page.vue index 5015ea0..c67a6fb 100644 --- a/pages/scene/+Page.vue +++ b/pages/scene/+Page.vue @@ -259,6 +259,15 @@ +
+ +
+

Added

@@ -318,10 +327,11 @@ import MovieTile from '#/components/movies/tile.vue'; import SerieTile from '#/components/series/tile.vue'; import Player from '#/components/video/player.vue'; import Heart from '#/components/stashes/heart.vue'; +import Campaign from '#/components/campaigns/campaign.vue'; import summaryTemplate from '#/assets/summary.yaml'; -const { pageProps } = inject('pageContext'); +const { pageProps, campaigns } = inject('pageContext'); const { scene } = pageProps; const playing = ref(false); diff --git a/pages/scene/+onBeforeRender.js b/pages/scene/+onBeforeRender.js index bde0265..3fa1479 100644 --- a/pages/scene/+onBeforeRender.js +++ b/pages/scene/+onBeforeRender.js @@ -1,4 +1,6 @@ +import { render } from 'vike/abort'; /* eslint-disable-line import/extensions */ import { fetchScenesById } from '#/src/scenes.js'; +import { getRandomCampaigns } from '#/src/campaigns.js'; function getTitle(scene) { if (scene.title) { @@ -20,12 +22,27 @@ export async function onBeforeRender(pageContext) { actorStashes: true, }); + const campaigns = await getRandomCampaigns([ + { + minRatio: 1.5, + entityIds: [scene.channel.id, scene.network?.id].filter(Boolean), + allowRandomFallback: false, + }, + ], { tagFilter: pageContext.tagFilter }); + + if (!scene) { + throw render(404, `Cannot find scene '${pageContext.routeParams.sceneId}'.`); + } + return { pageContext: { title: getTitle(scene), pageProps: { scene, }, + campaigns: { + scene: campaigns[0], + }, }, }; } diff --git a/src/web/graphql.js b/src/web/graphql.js index ccae6b6..df2d7cf 100644 --- a/src/web/graphql.js +++ b/src/web/graphql.js @@ -9,16 +9,14 @@ const schema = buildSchema(` ${scenesSchema} `); -const rootValue = { - scenes: fetchScenesGraphql, -}; - export async function graphqlApi(req, res) { const data = await graphql({ schema, source: req.body.query, variableValues: req.body.variables, - rootValue, + rootValue: { + scenes: async (query) => fetchScenesGraphql(query, req), + }, }); console.log(data); diff --git a/src/web/scenes.js b/src/web/scenes.js index 5b3e22a..d61f35c 100644 --- a/src/web/scenes.js +++ b/src/web/scenes.js @@ -76,16 +76,21 @@ export const scenesSchema = ` export async function fetchScenesGraphql(query, req) { const { scenes, + /* aggActors, aggTags, aggChannels, limit, total, + */ } = await fetchScenes({}, { page: 1, limit: 30, }, req.user); + return scenes; + + /* return { scenes, aggActors, @@ -94,4 +99,5 @@ export async function fetchScenesGraphql(query, req) { limit, total, }; + */ } diff --git a/static b/static index 39f91b9..af96f9b 160000 --- a/static +++ b/static @@ -1 +1 @@ -Subproject commit 39f91b96b2bfa176a02d10c9051dd1d2f9c62b64 +Subproject commit af96f9b932db799ec8d067d4a5c9379f8363d2b0