Using different icon and fixed unstash fade in secondary stashes.

This commit is contained in:
DebaucheryLibrarian 2024-03-27 03:05:32 +01:00
parent 23a6a60f79
commit 105972b3d4
4 changed files with 24 additions and 18 deletions

View File

@ -2,7 +2,7 @@
<div <div
class="tile" class="tile"
:class="{ :class="{
unstashed: !favorited && pageStash && user && pageStash.id === user.primaryStash?.id unstashed: !favorited && pageStash && user && pageStash.user.id === user.id,
}" }"
> >
<span class="name">{{ actor.name }}</span> <span class="name">{{ actor.name }}</span>
@ -33,8 +33,8 @@
:item="actor" :item="actor"
:show-secondary="false" :show-secondary="false"
class="light tiled" class="light tiled"
@stashed="(stash) => { favorited = stash.isPrimary ? true : favorited; }" @stashed="(stash) => { favorited = stash.id === currentStash.id ? true : favorited; }"
@unstashed="(stash) => { favorited = stash.isPrimary ? false : favorited; }" @unstashed="(stash) => { favorited = stash.id === currentStash.id ? false : favorited; }"
/> />
</div> </div>
@ -88,8 +88,9 @@ const props = defineProps({
const pageContext = inject('pageContext'); const pageContext = inject('pageContext');
const { user } = pageContext; const { user } = pageContext;
const pageStash = pageContext.pageProps.stash; const pageStash = pageContext.pageProps.stash;
const currentStash = pageStash || user.primaryStash;
const favorited = ref(props.actor.stashes?.some((sceneStash) => sceneStash.isPrimary) || false); const favorited = ref(props.actor.stashes.some((actorStash) => actorStash.id === currentStash.id));
</script> </script>
<style scoped> <style scoped>

View File

@ -1,7 +1,9 @@
<template> <template>
<div <div
class="movie-tile" class="movie-tile"
:class="{ unstashed: !favorited && pageStash && user && pageStash.id === user.primaryStash?.id }" :class="{
unstashed: !favorited && pageStash && user && pageStash.user.id === user.id,
}"
> >
<div <div
class="cover-container" class="cover-container"
@ -31,8 +33,8 @@
:item="movie" :item="movie"
:show-secondary="false" :show-secondary="false"
class="light tiled" class="light tiled"
@stashed="(stash) => { favorited = stash.isPrimary ? true : favorited; }" @stashed="(stash) => { favorited = stash.id === currentStash.id ? true : favorited; }"
@unstashed="(stash) => { favorited = stash.isPrimary ? false : favorited; }" @unstashed="(stash) => { favorited = stash.id === currentStash.id ? false : favorited; }"
/> />
</div> </div>
@ -118,10 +120,11 @@ const props = defineProps({
const pageContext = inject('pageContext'); const pageContext = inject('pageContext');
const user = pageContext.user; const user = pageContext.user;
const pageStash = pageContext.pageProps.stash; const pageStash = pageContext.pageProps.stash;
const currentStash = pageStash || user.primaryStash;
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const favorited = ref(props.movie.stashes.some((sceneStash) => sceneStash.isPrimary)); const favorited = ref(props.movie.stashes.some((movieStash) => movieStash.id === currentStash.id));
</script> </script>
<style scoped> <style scoped>

View File

@ -2,7 +2,7 @@
<div <div
class="tile" class="tile"
:class="{ :class="{
unstashed: !favorited && pageStash && user && pageStash.id === user.primaryStash?.id, unstashed: !favorited && pageStash && user && pageStash.user.id === user.id,
'is-new': scene.isNew, 'is-new': scene.isNew,
}" }"
> >
@ -32,8 +32,8 @@
:item="scene" :item="scene"
:show-secondary="false" :show-secondary="false"
class="light tiled" class="light tiled"
@stashed="(stash) => { favorited = stash.isPrimary ? true : favorited; }" @stashed="(stash) => { favorited = stash.id === currentStash.id ? true : favorited; }"
@unstashed="(stash) => { favorited = stash.isPrimary ? false : favorited; }" @unstashed="(stash) => { favorited = stash.id === currentStash.id ? false : favorited; }"
/> />
<span <span
@ -126,8 +126,9 @@ const props = defineProps({
const pageContext = inject('pageContext'); const pageContext = inject('pageContext');
const user = pageContext.user; const user = pageContext.user;
const pageStash = pageContext.pageProps.stash; const pageStash = pageContext.pageProps.stash;
const currentStash = pageStash || user.primaryStash;
const favorited = ref(props.scene.stashes.some((sceneStash) => sceneStash.isPrimary)); const favorited = ref(props.scene.stashes.some((sceneStash) => sceneStash.id === currentStash.id));
</script> </script>
<style scoped> <style scoped>

View File

@ -29,17 +29,17 @@
</VDropdown> </VDropdown>
<Icon <Icon
v-if="itemStashes.some((itemStash) => itemStash.isPrimary)" v-if="itemStashes.some((itemStash) => itemStash.id === currentStash.id)"
icon="heart7" :icon="currentStash.isPrimary ? 'heart7' : 'folder-heart'"
class="heart favorited noselect" class="heart favorited noselect"
@click.native.stop="unstashItem(user.primaryStash)" @click.native.stop="unstashItem(currentStash)"
/> />
<Icon <Icon
v-else v-else
icon="heart8" :icon="currentStash.isPrimary ? 'heart8' : 'folder-heart'"
class="heart noselect" class="heart noselect"
@click.native.stop="stashItem(user.primaryStash)" @click.native.stop="stashItem(currentStash)"
/> />
</div> </div>
</template> </template>
@ -70,7 +70,8 @@ const props = defineProps({
const emit = defineEmits(['stashed', 'unstashed']); const emit = defineEmits(['stashed', 'unstashed']);
const { user } = inject('pageContext'); const { user, pageProps } = inject('pageContext');
const currentStash = pageProps.stash || user.primaryStash;
const itemStashes = ref(props.item.stashes); const itemStashes = ref(props.item.stashes);