Added delete stash icons and dialog.

This commit is contained in:
DebaucheryLibrarian
2021-03-20 23:03:13 +01:00
parent 07643870cd
commit eee47111a6
14 changed files with 204 additions and 33 deletions

View File

@@ -7,6 +7,12 @@
<h2 class="stash-name">{{ stash.name }}</h2>
<span class="header-section">
<router-link
v-if="stash.user"
:to="{ name: 'user', params: { username: stash.user.username } }"
class="header-item stash-username nolink"
><Icon icon="user3" />{{ stash.user.username }}</router-link>
<label
v-if="isMine"
v-tooltip="'Public'"
@@ -30,11 +36,18 @@
/>
</label>
<router-link
v-if="stash.user"
:to="{ name: 'user', params: { username: stash.user.username } }"
class="header-item stash-username nolink"
><Icon icon="user3" />{{ stash.user.username }}</router-link>
<Icon
v-if="stash.deletable"
icon="bin"
class="stash-remove"
@click.native="showRemoveStash = true"
/>
<RemoveStash
v-if="showRemoveStash"
:stash="stash"
@close="removeStash"
/>
</span>
</div>
@@ -62,6 +75,7 @@
<script>
import Actor from '../actors/tile.vue';
import Releases from '../releases/releases.vue';
import RemoveStash from './remove-stash.vue';
import Toggle from '../form/toggle.vue';
async function fetchStash() {
@@ -78,6 +92,19 @@ async function publishStash(isPublic) {
this.fetchStash();
}
async function removeStash(removed) {
this.showRemoveStash = false;
if (removed && this.stash.user) {
this.$router.replace({ name: 'user', params: { username: this.stash.user.username } });
return;
}
if (removed) {
this.$router.replace({ name: 'home' });
}
}
async function mounted() {
this.fetchStash();
}
@@ -86,11 +113,13 @@ export default {
components: {
Actor,
Releases,
RemoveStash,
Toggle,
},
data() {
return {
stash: null,
showRemoveStash: false,
isMine: false,
};
},
@@ -98,6 +127,7 @@ export default {
methods: {
fetchStash,
publishStash,
removeStash,
},
};
</script>
@@ -136,6 +166,17 @@ export default {
}
}
.stash-remove.icon {
height: 100%;
padding: 0 1rem;
fill: var(--lighten-strong);
&:hover {
fill: var(--text-light);
cursor: pointer;
}
}
.stash-name,
.stash-username {
display: inline-flex;