From 7ac64c57ae21b316ca8dc93ce9769dbcc1d51f28 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Sun, 21 Mar 2021 03:58:13 +0100 Subject: [PATCH] Added extended heart button to actor component, fixed movie stash query. --- assets/components/actors/actor.vue | 58 +++++++++++----------------- assets/components/stashes/button.vue | 8 +++- assets/js/actors/actions.js | 1 + assets/js/releases/actions.js | 1 + 4 files changed, 31 insertions(+), 37 deletions(-) diff --git a/assets/components/actors/actor.vue b/assets/components/actors/actor.vue index c60a1b4b..1a12d406 100644 --- a/assets/components/actors/actor.vue +++ b/assets/components/actors/actor.vue @@ -34,18 +34,11 @@ class="header-social" /> - - - @@ -390,6 +383,7 @@ import Expand from '../expand/expand.vue'; import Scroll from '../scroll/scroll.vue'; import Gender from './gender.vue'; import Social from './social.vue'; +import StashButton from '../stashes/button.vue'; async function fetchActor(scroll = true) { const { actor, releases, totalCount } = await this.$store.dispatch('fetchActorById', { @@ -402,37 +396,25 @@ async function fetchActor(scroll = true) { this.actor = actor; this.releases = releases; this.totalCount = totalCount; - this.stashed = this.actor.isStashed; + this.stashedBy = actor.stashes; if (this.$refs.filter && scroll) { this.$refs.filter.$el.scrollIntoView(); } } -async function stashActor() { - this.stashed = true; - - try { - this.$store.dispatch('stashActor', { - actorId: this.actor.id, - stashId: this.$store.getters.favorites.id, - }); - } catch (error) { - this.stashed = false; - } +async function stashActor(stashId) { + this.stashedBy = await this.$store.dispatch('stashActor', { + actorId: this.actor.id, + stashId, + }); } -async function unstashActor() { - this.stashed = false; - - try { - this.$store.dispatch('unstashActor', { - actorId: this.actor.id, - stashId: this.$store.getters.favorites.id, - }); - } catch (error) { - this.stashed = true; - } +async function unstashActor(stashId) { + this.stashedBy = await this.$store.dispatch('unstashActor', { + actorId: this.actor.id, + stashId, + }); } function me() { @@ -472,6 +454,7 @@ export default { Releases, Gender, Social, + StashButton, }, data() { return { @@ -483,6 +466,7 @@ export default { bioExpanded: false, photosExpanded: false, stashed: false, + stashedBy: [], }; }, computed: { @@ -521,6 +505,10 @@ export default { background: var(--profile); } +.actor-stash { + margin: 0 1rem 0 0; +} + .header-name { padding: .5rem 1rem; margin: 0; diff --git a/assets/components/stashes/button.vue b/assets/components/stashes/button.vue index 6735668e..abe0f1ad 100644 --- a/assets/components/stashes/button.vue +++ b/assets/components/stashes/button.vue @@ -1,5 +1,5 @@