feat(admin): Added shoutout to admin panel (#6346)

* Added shoutout

* Added shoutout function

* Fixed test.

* Included feedback from review.

* Removed unnecessary file
This commit is contained in:
SamTV12345 2024-04-21 17:58:51 +02:00 committed by GitHub
parent d64924e9f5
commit e12be96102
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 467 additions and 214 deletions

View file

@ -250,11 +250,27 @@ const handshake = async () => {
socket.on('disconnect', (reason) => {
// The socket.io client will automatically try to reconnect for all reasons other than "io
// server disconnect".
console.log(`Socket disconnected: ${reason}`)
if (reason !== 'io server disconnect') return;
socketReconnecting();
socket.connect();
});
socket.on('shout', (obj) => {
if(obj.type === "COLLABROOM") {
let date = new Date(obj.data.payload.timestamp);
$.gritter.add({
// (string | mandatory) the heading of the notification
title: 'Admin message',
// (string | mandatory) the text inside the notification
text: '[' + date.toLocaleTimeString() + ']: ' + obj.data.payload.message.message,
// (bool | optional) if you want it to fade out on its own or just sit there
sticky: obj.data.payload.message.sticky
});
}
})
socket.on('reconnecting', socketReconnecting);
socket.on('reconnect_failed', (error) => {