diff --git a/src/client/app/ipc/index.js b/src/client/app/ipc/index.js index 8b32e8a0..f1295ce7 100644 --- a/src/client/app/ipc/index.js +++ b/src/client/app/ipc/index.js @@ -1,5 +1,12 @@ var EventEmitter = require('../events/event-emitter'), - uuid = require('nanoid/generate')('0123456789abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ', 10) + uuid = require('nanoid/generate')('0123456789abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ', 10), + notifications, + locales + +setTimeout(()=>{ + notifications = require('../ui/notifications') + locales = require('../locales') +}) var reconnectInterval = 5000, hearbeatInterval = 25000, @@ -120,6 +127,12 @@ class Ipc extends EventEmitter { this.socket.send(packet) } else { this.queue.push(packet) + notifications.add({ + icon: 'wifi', + class: 'error', + message: locales('server_unreachable'), + id: 'server_unreachable' + }) } } diff --git a/src/client/app/locales/en.js b/src/client/app/locales/en.js index d3c1ca49..0fb88864 100644 --- a/src/client/app/locales/en.js +++ b/src/client/app/locales/en.js @@ -31,6 +31,9 @@ module.exports = { fs_unnavailable: 'Fullscreen not available', fs_addtohome: 'You must add this page to your home screen to launch it in fullscreen', + // server + server_unreachable: 'The server is currently unreachable', + // session session_browse: 'Browse...', session_new: 'New session', diff --git a/src/client/app/locales/fr.js b/src/client/app/locales/fr.js index 000c17c9..a7107b48 100644 --- a/src/client/app/locales/fr.js +++ b/src/client/app/locales/fr.js @@ -31,6 +31,9 @@ module.exports = { fs_unnavailable: 'Plein écran indisponible', fs_addtohome: 'Vous devez ajouter cette page à votre écran d\'accueil pour pouvoir l\'ouvrir en plein écran.', + // server + server_unreachable: 'La connexion avec le serveur a été interrompue', + // session session_browse: 'Parcourir...', session_new: 'Nouvelle session', diff --git a/src/client/app/locales/ru.js b/src/client/app/locales/ru.js index d70a1bc5..9ef05488 100644 --- a/src/client/app/locales/ru.js +++ b/src/client/app/locales/ru.js @@ -31,6 +31,9 @@ module.exports = { // @https://github.com/suhr fs_unnavailable: 'Полный экран не доступен', fs_addtohome: 'Необходимо добавить эту страницу на главный экран чтобы запустить её в полноэкранном режиме', + // server + server_unreachable: 'The server is currently unreachable', + // session session_browse: 'Обзор...', session_new: 'Новая сессия', @@ -57,7 +60,7 @@ module.exports = { // @https://github.com/suhr state_storesuccess: 'State saved', state_recallsuccess: 'State recalled', state_sendsuccess: 'State sent', - + // traversing traversing_on: 'Вкл', traversing_smart: 'Умный', diff --git a/src/client/app/ui/notifications.js b/src/client/app/ui/notifications.js index 9c8aa3e9..2e1bdce6 100644 --- a/src/client/app/ui/notifications.js +++ b/src/client/app/ui/notifications.js @@ -15,6 +15,14 @@ class Notifications { add(data) { + if (data.id) { + var match = this.toasts.filter(x => x.id === data.id) + if (match.length) { + match[0].date = Date.now() + return + } + } + var toast = html`
@@ -24,6 +32,7 @@ class Notifications {
` toast.date = Date.now() + if (data.id) toast.id = data.id this.container.appendChild(toast) toast.style.height = toast.offsetHeight + 'px' this.toasts.push(toast)