better display of reconnect timer
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "tinode-webapp",
|
"name": "tinode-webapp",
|
||||||
"description": "Tinode messenger for the web",
|
"description": "Tinode messenger for the web",
|
||||||
"version": "0.15.14-rc1",
|
"version": "0.15.14-rc2",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.3.4",
|
"@babel/core": "^7.3.4",
|
||||||
"@babel/preset-env": "^7.3.4",
|
"@babel/preset-env": "^7.3.4",
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@
|
|||||||
"sidepanel_title_reset": "Reset Password",
|
"sidepanel_title_reset": "Reset Password",
|
||||||
"sidepanel_title_archive": "Archived Chats",
|
"sidepanel_title_archive": "Archived Chats",
|
||||||
"update_available": "Update available. <a href=\"\">Reload</a>.",
|
"update_available": "Update available. <a href=\"\">Reload</a>.",
|
||||||
"reconnect_countdown": "Disconnected. Reconnecting in {seconds}s…",
|
"reconnect_countdown": "Disconnected. Reconnecting in {seconds}…",
|
||||||
"reconnect_now": "Try now",
|
"reconnect_now": "Try now",
|
||||||
"phone_dative": "phone",
|
"phone_dative": "phone",
|
||||||
"email_dative": "email",
|
"email_dative": "email",
|
||||||
|
|||||||
+1
-1
@@ -120,7 +120,7 @@
|
|||||||
"badge_owner": "влад.",
|
"badge_owner": "влад.",
|
||||||
"update_available": "Есть новая версия приложения. <a href=\"\">Обновить</a>.",
|
"update_available": "Есть новая версия приложения. <a href=\"\">Обновить</a>.",
|
||||||
"user_not_found": "Не найден",
|
"user_not_found": "Не найден",
|
||||||
"reconnect_countdown": "Нет связи. Подключение через {seconds}с…",
|
"reconnect_countdown": "Нет связи. Подключение через {seconds}…",
|
||||||
"reconnect_now": "Подключить сейчас.",
|
"reconnect_now": "Подключить сейчас.",
|
||||||
"save_attachment": "сохранить",
|
"save_attachment": "сохранить",
|
||||||
"menu_item_archive_topic": "В архив",
|
"menu_item_archive_topic": "В архив",
|
||||||
|
|||||||
@@ -14,6 +14,14 @@ export function shortDateFormat(then, locale) {
|
|||||||
{hour12: false, year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit'});
|
{hour12: false, year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit'});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert seconds to minutes:seconds, i.e. 156 sec -> 2:36.
|
||||||
|
export function secondsToTime(seconds) {
|
||||||
|
const min = Math.floor(seconds % 3600 / 60);
|
||||||
|
let sec = seconds % 60;
|
||||||
|
sec = sec < 10 ? `0${sec}` : sec;
|
||||||
|
return `${min}:${sec}`;
|
||||||
|
}
|
||||||
|
|
||||||
// Convert a number of bytes to human-readable format.
|
// Convert a number of bytes to human-readable format.
|
||||||
export function bytesToHumanSize(bytes) {
|
export function bytesToHumanSize(bytes) {
|
||||||
if (!bytes || bytes == 0) {
|
if (!bytes || bytes == 0) {
|
||||||
|
|||||||
+2
-2
@@ -69,7 +69,7 @@
|
|||||||
"sidepanel_title_reset": "Reset Password",
|
"sidepanel_title_reset": "Reset Password",
|
||||||
"sidepanel_title_archive": "Archived Chats",
|
"sidepanel_title_archive": "Archived Chats",
|
||||||
"update_available": "Update available. <a href=\"\">Reload</a>.",
|
"update_available": "Update available. <a href=\"\">Reload</a>.",
|
||||||
"reconnect_countdown": "Disconnected. Reconnecting in {seconds}s…",
|
"reconnect_countdown": "Disconnected. Reconnecting in {seconds}…",
|
||||||
"reconnect_now": "Try now",
|
"reconnect_now": "Try now",
|
||||||
"phone_dative": "phone",
|
"phone_dative": "phone",
|
||||||
"email_dative": "email",
|
"email_dative": "email",
|
||||||
@@ -256,7 +256,7 @@
|
|||||||
"badge_owner": "влад.",
|
"badge_owner": "влад.",
|
||||||
"update_available": "Есть новая версия приложения. <a href=\"\">Обновить</a>.",
|
"update_available": "Есть новая версия приложения. <a href=\"\">Обновить</a>.",
|
||||||
"user_not_found": "Не найден",
|
"user_not_found": "Не найден",
|
||||||
"reconnect_countdown": "Нет связи. Подключение через {seconds}с…",
|
"reconnect_countdown": "Нет связи. Подключение через {seconds}…",
|
||||||
"reconnect_now": "Подключить сейчас.",
|
"reconnect_now": "Подключить сейчас.",
|
||||||
"save_attachment": "сохранить",
|
"save_attachment": "сохранить",
|
||||||
"menu_item_archive_topic": "В архив",
|
"menu_item_archive_topic": "В архив",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { base64ReEncode, makeImageUrl } from '../lib/blob-helpers.js';
|
|||||||
import { detectServerAddress, isLocalHost, isSecureConnection } from '../lib/host-name.js';
|
import { detectServerAddress, isLocalHost, isSecureConnection } from '../lib/host-name.js';
|
||||||
import LocalStorageUtil from '../lib/local-storage.js';
|
import LocalStorageUtil from '../lib/local-storage.js';
|
||||||
import HashNavigation from '../lib/navigation.js';
|
import HashNavigation from '../lib/navigation.js';
|
||||||
|
import { secondsToTime } from '../lib/strformat.js'
|
||||||
import { updateFavicon } from '../lib/utils.js';
|
import { updateFavicon } from '../lib/utils.js';
|
||||||
|
|
||||||
// Sound to play on message received.
|
// Sound to play on message received.
|
||||||
@@ -32,7 +33,7 @@ const messages = defineMessages({
|
|||||||
},
|
},
|
||||||
reconnect_countdown: {
|
reconnect_countdown: {
|
||||||
id: 'reconnect_countdown',
|
id: 'reconnect_countdown',
|
||||||
defaultMessage: 'Disconnected. Reconnecting in {seconds}s…',
|
defaultMessage: 'Disconnected. Reconnecting in {seconds}…',
|
||||||
description: 'Message shown when an app update is available.'
|
description: 'Message shown when an app update is available.'
|
||||||
},
|
},
|
||||||
reconnect_now: {
|
reconnect_now: {
|
||||||
@@ -395,8 +396,9 @@ class TinodeWeb extends React.Component {
|
|||||||
let count = sec / 1000;
|
let count = sec / 1000;
|
||||||
count = count | count;
|
count = count | count;
|
||||||
this.reconnectCountdown = setInterval(() => {
|
this.reconnectCountdown = setInterval(() => {
|
||||||
|
const timeLeft = (count > 99) ? secondsToTime(count) : count;
|
||||||
this.handleError(
|
this.handleError(
|
||||||
formatHTMLMessage(messages.reconnect_countdown, {seconds: count}),
|
formatHTMLMessage(messages.reconnect_countdown, {seconds: timeLeft}),
|
||||||
'warn',
|
'warn',
|
||||||
() => {
|
() => {
|
||||||
clearInterval(this.reconnectCountdown);
|
clearInterval(this.reconnectCountdown);
|
||||||
|
|||||||
+17
-6
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user