Added movie page. Added stash button to movies.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<div class="content">
|
||||
<div
|
||||
class="banner-container"
|
||||
:style="{ 'background-image': scene.poster.isS3 ? `url('https://cdndev.traxxx.me/${scene.poster.thumbnail}')` : `url('/media/${scene.poster.thumbnail}')` }"
|
||||
:style="{ 'background-image': `url(${getPath(scene.poster, 'thumbnail')})` }"
|
||||
>
|
||||
<div class="banner">
|
||||
<div
|
||||
@@ -246,7 +246,9 @@ import { ref, computed, inject } from 'vue';
|
||||
|
||||
import { post, del } from '#/src/api.js';
|
||||
import { formatDate, formatDuration } from '#/utils/format.js';
|
||||
import events from '#/src/events.js';
|
||||
import getPath from '#/src/get-path.js';
|
||||
import ellipsis from '#/utils/ellipsis.js';
|
||||
|
||||
import Icon from '#/components/icon/icon.vue';
|
||||
import ActorTile from '#/components/actors/tile.vue';
|
||||
@@ -260,6 +262,8 @@ const favorited = ref(scene.stashes.some((sceneStash) => sceneStash.primary));
|
||||
const playing = ref(false);
|
||||
const paused = ref(false);
|
||||
|
||||
const fbCutoff = 20;
|
||||
|
||||
const poster = computed(() => {
|
||||
if (scene.poster) {
|
||||
return getPath(scene.poster, 'thumbnail');
|
||||
@@ -279,19 +283,42 @@ const poster = computed(() => {
|
||||
async function stash() {
|
||||
try {
|
||||
favorited.value = true;
|
||||
|
||||
await post(`/stashes/${user.primaryStash.id}/scenes`, { sceneId: scene.id });
|
||||
|
||||
events.emit('feedback', {
|
||||
type: 'success',
|
||||
message: `"${ellipsis(scene.title, fbCutoff)}" stashed to ${user.primaryStash.name}`,
|
||||
});
|
||||
} catch (error) {
|
||||
favorited.value = false;
|
||||
|
||||
events.emit('feedback', {
|
||||
type: 'error',
|
||||
message: `Failed to stash "${ellipsis(scene.title, fbCutoff)}" to ${user.primaryStash.name}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function unstash() {
|
||||
try {
|
||||
favorited.value = false;
|
||||
|
||||
await del(`/stashes/${user.primaryStash.id}/scenes/${scene.id}`);
|
||||
|
||||
events.emit('feedback', {
|
||||
type: 'remove',
|
||||
message: `"${ellipsis(scene.title, fbCutoff)}" unstashed from ${user.primaryStash.name}`,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
favorited.value = true;
|
||||
|
||||
console.error(error);
|
||||
|
||||
events.emit('feedback', {
|
||||
type: 'error',
|
||||
message: `Failed to unstash "${ellipsis(scene.title, fbCutoff)}" from ${user.primaryStash.name}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
import { fetchScenesById } from '#/src/scenes.js';
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
export async function onBeforeRender(pageContext) {
|
||||
const [scene] = await fetchScenesById([Number(pageContext.routeParams.sceneId)], {
|
||||
reqUser: pageContext.user,
|
||||
@@ -8,7 +20,7 @@ export async function onBeforeRender(pageContext) {
|
||||
|
||||
return {
|
||||
pageContext: {
|
||||
title: scene.title,
|
||||
title: getTitle(scene),
|
||||
pageProps: {
|
||||
scene,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user