Added extended heart button to actor component, fixed movie stash query.

This commit is contained in:
DebaucheryLibrarian 2021-03-21 03:58:13 +01:00
parent 9ff70e5578
commit 7ac64c57ae
4 changed files with 31 additions and 37 deletions

View File

@ -34,18 +34,11 @@
class="header-social"
/>
<Icon
v-show="me && stashed"
icon="heart7"
class="stash stashed noselect"
@click="unstashActor"
/>
<Icon
v-show="me && !stashed"
icon="heart8"
class="stash unstashed noselect"
@click="stashActor"
<StashButton
:stashed-by="stashedBy"
class="actor-stash light"
@stash="(stash) => stashActor(stash)"
@unstash="(stash) => unstashActor(stash)"
/>
</div>
@ -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;

View File

@ -1,5 +1,5 @@
<template>
<span>
<span class="stash-container">
<Tooltip class="stash-trigger">
<Icon
v-show="me"
@ -73,10 +73,14 @@ export default {
</script>
<style lang="scss" scoped>
.stash-container.light .icon {
fill: var(--lighten);
}
.stash.icon {
width: 1.5rem;
height: 1.5rem;
padding: 0 .75rem;
padding: 0 .5rem;
fill: var(--shadow);
&.stashed {

View File

@ -260,6 +260,7 @@ function initActorActions(store, router) {
id
name
slug
primary
}
}
}

View File

@ -273,6 +273,7 @@ function initReleasesActions(store, router) {
id
name
slug
primary
}
}
}