Added stash menu to release page, returning stashes from stash API to avoid reloading or local interpolation.
This commit is contained in:
74
assets/components/stashes/menu.vue
Normal file
74
assets/components/stashes/menu.vue
Normal file
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<ul class="menu nolist">
|
||||
<li
|
||||
v-for="stash in stashes"
|
||||
:key="`stash-${stash.id}`"
|
||||
class="menu-item"
|
||||
>
|
||||
<label class="menu-stash noselect">
|
||||
<Checkbox
|
||||
:checked="stashedByIds.has(stash.id)"
|
||||
class="menu-check"
|
||||
@change="(checked) => checked ? $emit('stash', stash) : $emit('unstash', stash)"
|
||||
/>{{ stash.name }}
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Checkbox from '../form/checkbox.vue';
|
||||
|
||||
function stashes() {
|
||||
return this.$store.state.auth.user?.stashes || [];
|
||||
}
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Checkbox,
|
||||
},
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
stashedBy: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
emits: ['stash', 'unstash'],
|
||||
data() {
|
||||
const stashedByIds = new Set(this.stashedBy.map(stash => stash.id));
|
||||
|
||||
return {
|
||||
stashedByIds,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
stashes,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.menu-item {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.menu-stash {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: .5rem 1rem .5rem .5rem;
|
||||
|
||||
&:hover {
|
||||
color: var(--primary);
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-check {
|
||||
display: inline-block;
|
||||
margin: 0 .75rem 0 0;
|
||||
}
|
||||
</style>
|
||||
@@ -40,7 +40,7 @@
|
||||
</label>
|
||||
|
||||
<Icon
|
||||
v-if="isMine && stash.deletable"
|
||||
v-if="isMine && !stash.primary"
|
||||
icon="bin"
|
||||
class="stash-remove"
|
||||
@click.native="showRemoveStash = true"
|
||||
|
||||
Reference in New Issue
Block a user