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 ebfc2d8508
commit 78eba6b1fb
35 changed files with 1097 additions and 1017 deletions

View File

@@ -239,6 +239,7 @@ import DialogWidget from '@/components/DialogWidget.vue';
import { fetchPublicRooms, fetchRoomCreateOptions, fetchOwnRooms } from '@/api/chatApi.js';
import { mapGetters } from 'vuex';
import { getChatWsUrl, getChatWsCandidates, getChatWsProtocols } from '@/services/chatWs.js';
import { confirmAction } from '@/utils/feedback.js';
export default {
name: 'MultiChat',
@@ -561,7 +562,10 @@ export default {
},
async deleteOwnedRoom(room) {
const title = room?.title || '';
const confirmed = window.confirm(this.$t('chat.multichat.createRoom.ownedRooms.confirmDelete', { room: title }));
const confirmed = await confirmAction(this, {
title: this.$t('chat.multichat.createRoom.ownedRooms.title'),
message: this.$t('chat.multichat.createRoom.ownedRooms.confirmDelete', { room: title })
});
if (!confirmed) return;
if (!this.transportConnected) {
this.messages.push({

View File

@@ -41,6 +41,7 @@ import DialogWidget from '@/components/DialogWidget.vue';
import { mapGetters } from 'vuex';
import apiClient from '@/utils/axios.js';
import { EventBus } from '@/utils/eventBus.js';
import { showError } from '@/utils/feedback.js';
export default {
name: 'CreateFolderDialog',
@@ -93,7 +94,7 @@ export default {
},
async createFolder() {
if (!this.folderTitle || !this.selectedVisibility.length) {
alert(this.$t('socialnetwork.gallery.errors.missing_fields'));
showError(this, this.$t('socialnetwork.gallery.errors.missing_fields'));
return;
}
const payload = {

View File

@@ -97,6 +97,7 @@ import FolderItem from '../../components/FolderItem.vue';
import { Editor, EditorContent } from '@tiptap/vue-3'
import StarterKit from '@tiptap/starter-kit'
import DOMPurify from 'dompurify';
import { showError } from '@/utils/feedback.js';
export default {
name: 'UserProfileDialog',
@@ -265,7 +266,10 @@ export default {
}
},
async submitGuestbookEntry() {
if (!this.newEntryContent) return alert(this.$t('socialnetwork.guestbook.emptyContent'));
if (!this.newEntryContent) {
showError(this, this.$t('socialnetwork.guestbook.emptyContent'));
return;
}
const formData = new FormData();
formData.append('htmlContent', this.newEntryContent);
formData.append('recipientName', this.userProfile.username);

View File

@@ -42,12 +42,10 @@ export default {
this.$refs.dialog.close();
},
confirmYes() {
console.log('ja');
this.resolve(true);
this.close();
},
confirmNo() {
console.log('nein');
this.resolve(false);
this.close();
},