Add visual feedback for unread messages in the menu. Implement a pulsing animation and color change for the inbox button when there are unread chats. Also, add sound notification for new messages received, enhancing user experience.
This commit is contained in:
@@ -229,6 +229,19 @@ export const useChatStore = defineStore('chat', () => {
|
||||
console.log('[Bild empfangen] Von:', data.from, 'URL:', data.imageUrl || data.message);
|
||||
}
|
||||
|
||||
// Sound abspielen bei neuer Nachricht (nur wenn nicht selbst gesendet)
|
||||
if (!data.self) {
|
||||
try {
|
||||
const audio = new Audio('/static/newmessage.mp3');
|
||||
audio.play().catch(err => {
|
||||
// Ignoriere Fehler (z.B. wenn Browser Auto-Play blockiert)
|
||||
console.log('Sound konnte nicht abgespielt werden:', err);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log('Fehler beim Abspielen des Sounds:', error);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentConversation.value === data.from) {
|
||||
const newMessage = {
|
||||
from: data.from,
|
||||
|
||||
Reference in New Issue
Block a user