2024-03-19 01:19:23 +00:00
|
|
|
import { fetchScenesById } from '#/src/scenes.js';
|
2023-12-30 05:29:53 +00:00
|
|
|
|
2024-03-25 01:08:09 +00:00
|
|
|
function getTitle(scene) {
|
|
|
|
if (scene.title) {
|
|
|
|
return scene.title;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (scene.actors.length > 0) {
|
|
|
|
return `Scene with ${scene.actors.map((actor) => actor.name).join(', ')}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 'Scene';
|
|
|
|
}
|
|
|
|
|
2023-12-30 05:29:53 +00:00
|
|
|
export async function onBeforeRender(pageContext) {
|
2024-03-21 01:54:05 +00:00
|
|
|
const [scene] = await fetchScenesById([Number(pageContext.routeParams.sceneId)], {
|
|
|
|
reqUser: pageContext.user,
|
|
|
|
actorStashes: true,
|
|
|
|
});
|
2023-12-30 05:29:53 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
pageContext: {
|
2024-03-25 01:08:09 +00:00
|
|
|
title: getTitle(scene),
|
2023-12-30 05:29:53 +00:00
|
|
|
pageProps: {
|
|
|
|
scene,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|