Added alert dialog context trigger to quick alert bell.

This commit is contained in:
2025-03-13 00:12:29 +01:00
parent 45ba0b8ebc
commit 04d98a61f6
4 changed files with 86 additions and 15 deletions

View File

@@ -12,6 +12,7 @@
:title="`Remove uncombined alerts for '${item.title || item.name}'`"
class="alert active noselect"
@click="removeAlert"
@contextmenu.prevent="showAlertDialog = true"
/>
<Icon
@@ -20,6 +21,7 @@
:title="`Set alert for '${item.title || item.name}', ${itemAlerts.multi.length} combined alert${itemAlerts.multi.length > 1 ? 's' : ''} active`"
class="alert partial noselect"
@click="alertItem"
@contextmenu.prevent="showAlertDialog = true"
/>
<Icon
@@ -28,6 +30,7 @@
:title="`Set alert for '${item.title || item.name}' releases`"
class="alert noselect"
@click="alertItem"
@contextmenu.prevent="showAlertDialog = true"
/>
</div>
@@ -113,6 +116,13 @@
@created="(newStash) => { showStashDialog = false; reloadStashes(newStash); }"
@close="showStashDialog = false;"
/>
<AlertDialog
v-if="showAlertDialog"
v-bind="{ [`preset-${domain}`]: [item] }"
@close="showAlertDialog = false;"
@alert="(alert) => setAlerted(alert)"
/>
</div>
</template>
@@ -125,6 +135,7 @@ import ellipsis from '#/utils/ellipsis.js';
import Icon from '#/components/icon/icon.vue';
import StashMenu from '#/components/stashes/menu.vue';
import StashDialog from '#/components/stashes/create.vue';
import AlertDialog from '#/components/alerts/create.vue';
const props = defineProps({
domain: {
@@ -157,6 +168,7 @@ const hasSecondaryStash = computed(() => itemStashes.value.some((itemStash) => !
const done = ref(true);
const showStashes = ref(false);
const showStashDialog = ref(false);
const showAlertDialog = ref(false);
const feedbackCutoff = 20;
const itemKeys = {
@@ -272,6 +284,18 @@ async function removeAlert() {
}
}
function setAlerted(alert) {
// only set alerted status if the current item is the only one in the new stash
const items = [...alert.actors, ...alert.tags, ...alert.entities, ...alert.matches];
if (items.length === 1 && alert[props.domain][0]?.id === props.item.id) {
itemAlerted.value = true;
itemAlerts.value.only = itemAlerts.value.only.concat(alert.id);
} else {
itemAlerts.value.multi = itemAlerts.value.multi.concat(alert.id);
}
}
function toggleShowStashes(state) {
if (props.showSecondary) {
return;