Prevent adding duplicate stash triggers to alert.

This commit is contained in:
DebaucheryLibrarian 2024-05-28 06:01:28 +02:00
parent f48afaeffa
commit 419a0c9362
1 changed files with 34 additions and 30 deletions

View File

@ -329,37 +329,39 @@
/> />
</li> </li>
<li class="field-add"> <template v-if="stashes.length < user.stashes.length">
<button <li class="field-add">
v-if="stashes.length === 0"
type="button"
class="button favorites"
@click="selectStash(user.primaryStash)"
><Icon icon="heart7" />Add to favorites</button>
</li>
<li class="field-add">
<VDropdown>
<button <button
v-if="stashes.length === 0"
type="button" type="button"
class="button field-add" class="button favorites"
><Icon icon="folder-heart" />Add to stash</button> @click="selectStash(user.primaryStash)"
><Icon icon="heart7" />Add to favorites</button>
</li>
<template #popper> <li class="field-add">
<ul class="nolist"> <VDropdown>
<li <button
v-for="stash in user.stashes" type="button"
:key="`stash-result-${stash.id}`" class="button field-add"
v-close-popper ><Icon icon="folder-heart" />Add to stash</button>
class="result-item result-stash result-label"
@click="selectStash(stash)" <template #popper>
> <ul class="nolist">
{{ stash.name }} <li
</li> v-for="stash in user.stashes.filter((stash) => !stashes.some((selectedStash) => selectedStash.id === stash.id))"
</ul> :key="`stash-result-${stash.id}`"
</template> v-close-popper
</VDropdown> class="result-item result-stash result-label"
</li> @click="selectStash(stash)"
>
{{ stash.name }}
</li>
</ul>
</template>
</VDropdown>
</li>
</template>
</ul> </ul>
</div> </div>
</div> </div>
@ -497,8 +499,10 @@ function addMatch() {
matchExpression.value = ''; matchExpression.value = '';
} }
function selectStash(stash) { function selectStash(selectedStash) {
stashes.value.push(stash); if (!stashes.value.some((stash) => stash.id === selectedStash.id)) {
stashes.value.push(selectedStash);
}
} }
</script> </script>