Added filterable stash pages.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user