From 41b13babffb9ed9fdc16fc6718614c8b8d911600 Mon Sep 17 00:00:00 2001 From: Guilherme Cruz <100307080+https-shini@users.noreply.github.com> Date: Mon, 9 Nov 2026 13:48:49 -0300 Subject: [PATCH 1/4] Improve connection status copy for slow server startup --- frontend/src/i18n/strings.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/i18n/strings.js b/frontend/src/i18n/strings.js index 28bb5ef..7cb6a3c 100644 --- a/frontend/src/i18n/strings.js +++ b/frontend/src/i18n/strings.js @@ -17,9 +17,12 @@ export const strings = { usernameDots: "Não comece nem termine com ponto, nem use dois pontos seguidos.", usernameTooShort: "Use pelo menos 3 caracteres.", usernameTooLong: "Use no máximo 20 caracteres.", - slowTitle: "Conectando ao servidor…", - slowBody: - "Se ele estava parado, acordar pode levar até um minuto. Você entra assim que ele responder.", + slowTitle: "Verificando a conexão…", + slowBody: "Estamos aguardando a resposta do servidor. Você entrará automaticamente quando ele estiver disponível.", + wakingTitle: "Preparando sua conexão…", + wakingBody: "O servidor pode estar iniciando após um período de inatividade. Isso pode levar alguns instantes.", + longWaitTitle: "A conexão está demorando mais que o normal", + longWaitBody: "Ainda estamos tentando conectar. Confira sua internet; você pode cancelar e tentar novamente.", failedTitle: "Não foi possível conectar.", failedBody: "Verifique sua internet ou tente de novo em instantes.", }, From aeccfb20a5a4788f1ec9ec8180b81e7c18696c82 Mon Sep 17 00:00:00 2001 From: Guilherme Cruz <100307080+https-shini@users.noreply.github.com> Date: Mon, 9 Nov 2026 13:48:59 -0300 Subject: [PATCH 2/4] Show progressive connection feedback during cold starts --- frontend/src/ui/entry.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/frontend/src/ui/entry.js b/frontend/src/ui/entry.js index 8aa190d..8cd4189 100644 --- a/frontend/src/ui/entry.js +++ b/frontend/src/ui/entry.js @@ -105,7 +105,9 @@ export const describeUsername = (raw, { suggested = false, touched = false } = { }; /** Depois de quanto tempo sem confirmação a espera ganha explicação. */ -const SLOW_AFTER_MS = 3000; +const SLOW_AFTER_MS = 5000; +const WAKE_AFTER_MS = 15000; +const LONG_WAIT_AFTER_MS = 45000; /** * @param {{ @@ -138,6 +140,8 @@ export const createEntry = ({ onSubmit, onCancel, onRetry }) => { let startedAt = 0; /** @type {ReturnType | null} */ let slowTimer = null; + /** @type {ReturnType | null} */ + let longWaitTimer = null; /** Último estado do enlace recebido, para o aviso de lentidão. */ let lastProgress = { link: "idle", attempt: 0 }; @@ -186,6 +190,8 @@ export const createEntry = ({ onSubmit, onCancel, onRetry }) => { const stopSlowTimer = () => { if (slowTimer !== null) clearTimeout(slowTimer); slowTimer = null; + if (longWaitTimer !== null) clearTimeout(longWaitTimer); + longWaitTimer = null; }; /** Botão no estado normal (sem carregamento). */ @@ -225,14 +231,17 @@ export const createEntry = ({ onSubmit, onCancel, onRetry }) => { }); return; } - if (link === "retrying" && attempt > 0) { + const elapsed = Date.now() - startedAt; + if (elapsed >= LONG_WAIT_AFTER_MS) { + showStatus({ title: strings.entry.longWaitTitle, body: strings.entry.longWaitBody }); + } else if (elapsed >= WAKE_AFTER_MS) { showStatus({ - title: format(strings.conn.retryingNth, { n: attempt }), - body: strings.entry.slowBody, + title: link === "retrying" && attempt > 0 + ? format(strings.conn.retryingNth, { n: attempt }) + : strings.entry.wakingTitle, + body: strings.entry.wakingBody, }); - return; - } - if (Date.now() - startedAt >= SLOW_AFTER_MS) { + } else if (elapsed >= SLOW_AFTER_MS) { showStatus({ title: strings.entry.slowTitle, body: strings.entry.slowBody }); } }; @@ -249,6 +258,10 @@ export const createEntry = ({ onSubmit, onCancel, onRetry }) => { hideStatus(); stopSlowTimer(); slowTimer = setTimeout(paintProgress, SLOW_AFTER_MS); + longWaitTimer = setTimeout(() => { + paintProgress(); + longWaitTimer = setTimeout(paintProgress, LONG_WAIT_AFTER_MS - WAKE_AFTER_MS); + }, WAKE_AFTER_MS); }; form.addEventListener("submit", (event) => { From d15cc4cee175a0eadb39d3cfb4dcf381f37c6117 Mon Sep 17 00:00:00 2001 From: Guilherme Cruz <100307080+https-shini@users.noreply.github.com> Date: Mon, 9 Nov 2026 13:57:55 -0300 Subject: [PATCH 3/4] Format connection feedback changes --- frontend/src/i18n/strings.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/i18n/strings.js b/frontend/src/i18n/strings.js index 7cb6a3c..f3f84d5 100644 --- a/frontend/src/i18n/strings.js +++ b/frontend/src/i18n/strings.js @@ -18,11 +18,14 @@ export const strings = { usernameTooShort: "Use pelo menos 3 caracteres.", usernameTooLong: "Use no máximo 20 caracteres.", slowTitle: "Verificando a conexão…", - slowBody: "Estamos aguardando a resposta do servidor. Você entrará automaticamente quando ele estiver disponível.", + slowBody: + "Estamos aguardando a resposta do servidor. Você entrará automaticamente quando ele estiver disponível.", wakingTitle: "Preparando sua conexão…", - wakingBody: "O servidor pode estar iniciando após um período de inatividade. Isso pode levar alguns instantes.", + wakingBody: + "O servidor pode estar iniciando após um período de inatividade. Isso pode levar alguns instantes.", longWaitTitle: "A conexão está demorando mais que o normal", - longWaitBody: "Ainda estamos tentando conectar. Confira sua internet; você pode cancelar e tentar novamente.", + longWaitBody: + "Ainda estamos tentando conectar. Confira sua internet; você pode cancelar e tentar novamente.", failedTitle: "Não foi possível conectar.", failedBody: "Verifique sua internet ou tente de novo em instantes.", }, From a8c891caddd8cb76c120853ce12a9066ee994ff3 Mon Sep 17 00:00:00 2001 From: Guilherme Cruz <100307080+https-shini@users.noreply.github.com> Date: Mon, 9 Nov 2026 13:57:59 -0300 Subject: [PATCH 4/4] Format connection feedback changes --- frontend/src/ui/entry.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/ui/entry.js b/frontend/src/ui/entry.js index 8cd4189..494255a 100644 --- a/frontend/src/ui/entry.js +++ b/frontend/src/ui/entry.js @@ -236,9 +236,10 @@ export const createEntry = ({ onSubmit, onCancel, onRetry }) => { showStatus({ title: strings.entry.longWaitTitle, body: strings.entry.longWaitBody }); } else if (elapsed >= WAKE_AFTER_MS) { showStatus({ - title: link === "retrying" && attempt > 0 - ? format(strings.conn.retryingNth, { n: attempt }) - : strings.entry.wakingTitle, + title: + link === "retrying" && attempt > 0 + ? format(strings.conn.retryingNth, { n: attempt }) + : strings.entry.wakingTitle, body: strings.entry.wakingBody, }); } else if (elapsed >= SLOW_AFTER_MS) {