2021-03-21 02:46:59 +00:00
|
|
|
<template>
|
2021-03-21 02:58:13 +00:00
|
|
|
<span class="stash-container">
|
2021-03-21 02:46:59 +00:00
|
|
|
<Tooltip class="stash-trigger">
|
|
|
|
<Icon
|
|
|
|
v-show="me"
|
|
|
|
icon="menu"
|
|
|
|
class="stash noselect"
|
|
|
|
:class="{ stashed }"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<template v-slot:tooltip>
|
|
|
|
<StashMenu
|
|
|
|
:stashed-by="stashedBy"
|
|
|
|
@stash="(stashId) => $emit('stash', stashId)"
|
|
|
|
@unstash="(stashId) => $emit('unstash', stashId)"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
<Icon
|
|
|
|
v-show="me && favorited"
|
|
|
|
icon="heart7"
|
|
|
|
class="stash stashed noselect"
|
|
|
|
@click.native="() => $emit('unstash', favorites.id)"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Icon
|
|
|
|
v-show="me && !favorited"
|
|
|
|
icon="heart8"
|
|
|
|
class="stash unstashed noselect"
|
|
|
|
@click.native="() => $emit('stash', favorites.id)"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import StashMenu from './menu.vue';
|
|
|
|
|
|
|
|
function favorited() {
|
|
|
|
return this.stashedBy.some(stash => stash.primary);
|
|
|
|
}
|
|
|
|
|
|
|
|
function stashed() {
|
|
|
|
return this.stashedBy.some(stash => !stash.primary);
|
|
|
|
}
|
|
|
|
|
|
|
|
function favorites() {
|
|
|
|
return this.$store.getters.favorites;
|
|
|
|
}
|
|
|
|
|
|
|
|
function me() {
|
|
|
|
return this.$store.state.auth.user;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
StashMenu,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
stashedBy: {
|
|
|
|
type: Array,
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
emits: ['stash', 'unstash'],
|
|
|
|
computed: {
|
|
|
|
me,
|
|
|
|
favorites,
|
|
|
|
favorited,
|
|
|
|
stashed,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-03-21 02:58:13 +00:00
|
|
|
.stash-container.light .icon {
|
|
|
|
fill: var(--lighten);
|
|
|
|
}
|
|
|
|
|
2021-03-21 02:46:59 +00:00
|
|
|
.stash.icon {
|
|
|
|
width: 1.5rem;
|
|
|
|
height: 1.5rem;
|
2021-03-21 02:58:13 +00:00
|
|
|
padding: 0 .5rem;
|
2021-03-21 02:46:59 +00:00
|
|
|
fill: var(--shadow);
|
|
|
|
|
|
|
|
&.stashed {
|
|
|
|
fill: var(--primary);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
fill: var(--primary);
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.stash-trigger {
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
</style>
|