Refactor feedback handling across components: Replace alert and confirm calls with centralized feedback functions for improved user experience. Update various components to utilize showError, showSuccess, and confirmAction for consistent messaging and confirmation dialogs. Enhance UI responsiveness and maintainability by streamlining feedback logic.

This commit is contained in:
Torsten Schulz (local)
2026-03-19 16:18:51 +01:00
parent 2c58ef37c4
commit 1774d7df88
35 changed files with 1097 additions and 1017 deletions

View File

@@ -175,24 +175,11 @@
<script>
import { mapGetters, mapActions } from 'vuex';
import { createApp } from 'vue';
import apiClient from '@/utils/axios.js';
import { EventBus } from '@/utils/eventBus.js';
import RandomChatDialog from '../dialogues/chat/RandomChatDialog.vue';
import MultiChatDialog from '../dialogues/chat/MultiChatDialog.vue';
// Wichtig: die zentrale Instanzen importieren
import store from '@/store';
import router from '@/router';
import i18n from '@/i18n';
export default {
name: 'AppNavigation',
components: {
RandomChatDialog,
MultiChatDialog
},
data() {
return {
forumList: [],
@@ -292,7 +279,8 @@ export default {
this.pinnedSubKey = this.pinnedSubKey === key ? null : key;
},
collapseMenus() {
collapseMenus(options = {}) {
const { blurActiveElement = true } = options;
this.expandedMainKey = null;
this.expandedSubKey = null;
this.pinnedMainKey = null;
@@ -305,11 +293,13 @@ export default {
this.suppressHover = false;
this.hoverReleaseTimer = null;
}, 180);
this.$nextTick(() => {
if (document.activeElement && typeof document.activeElement.blur === 'function') {
document.activeElement.blur();
}
});
if (blurActiveElement) {
this.$nextTick(() => {
if (document.activeElement && typeof document.activeElement.blur === 'function') {
document.activeElement.blur();
}
});
}
},
handleDocumentClick(event) {
@@ -317,7 +307,7 @@ export default {
if (!root || root.contains(event.target)) {
return;
}
this.collapseMenus();
this.collapseMenus({ blurActiveElement: false });
},
handleDocumentKeydown(event) {
@@ -435,10 +425,21 @@ export default {
},
openChat(userId) {
console.log('openChat:', userId);
// Datei erstellen und ans body anhängen
const container = document.createElement('div');
document.body.appendChild(container);
const dialogRef = this.$root.$refs.multiChatDialog;
const friend = this.friendsList.find((entry) => entry.id === userId);
if (!dialogRef || typeof dialogRef.open !== 'function') {
this.openProfile(userId);
return;
}
dialogRef.open();
if (!friend?.username) {
return;
}
window.setTimeout(() => {
if (dialogRef.usersInRoom?.some((user) => user.name === friend.username)) {
dialogRef.selectedTargetUser = friend.username;
}
}, 250);
},
/**