Added filterable stash pages.

This commit is contained in:
2024-03-15 00:08:24 +01:00
parent 7f00e31fc4
commit a1b45cb721
39 changed files with 649218 additions and 80 deletions

View File

@@ -147,6 +147,7 @@ const {
actor: pageActor,
tag: pageTag,
entity: pageEntity,
stash: pageStash,
} = pageProps;
const scenes = ref(pageProps.scenes);
@@ -229,6 +230,7 @@ async function search(options = {}) {
...query,
actors: [pageActor, ...filters.value.actors].filter(Boolean).map((filterActor) => getActorIdentifier(filterActor)).join(','), // if we're on an actor page, that actor ID needs to be included
tags: [pageTag?.slug, ...filters.value.tags].filter(Boolean).join(','),
stashId: pageStash?.id,
e: entitySlug,
scope: scope.value,
page: currentPage.value, // client uses param rather than query pagination

View File

@@ -1,5 +1,10 @@
<template>
<div class="tile">
<div
class="tile"
:class="{
unstashed: !favorited && pageStash && user && pageStash.id === user.primaryStash?.id
}"
>
<div class="poster-container">
<Link
:href="`/scene/${scene.id}/${scene.slug}`"
@@ -112,6 +117,7 @@ const props = defineProps({
const pageContext = inject('pageContext');
const user = pageContext.user;
const pageStash = pageContext.pageProps.stash;
const favorited = ref(props.scene.stashes.some((sceneStash) => sceneStash.primary));
@@ -125,10 +131,13 @@ async function stash() {
}
async function unstash() {
console.log('unstash!', user);
try {
favorited.value = false;
await del(`/stashes/${user.primaryStash.id}/scenes/${props.scene.id}`);
} catch (error) {
console.error(error);
favorited.value = true;
}
}
@@ -149,6 +158,10 @@ async function unstash() {
fill: var(--text-light);
}
}
&.unstashed {
opacity: .5;
}
}
.poster-container {