Skip to content

fix: simplify user-facing toasts and prevent modal overlap - #11

Merged
ArielAio merged 2 commits into
mainfrom
codex/attendants-pr-auto-merge
Mar 12, 2026
Merged

ArielAio merged 2 commits into
mainfrom
codex/attendants-pr-auto-merge

Conversation

@ArielAio

Copy link
Copy Markdown
Owner
  • remove picker info toasts that blocked attendant selection UI

  • hide toast stack while modal is open and raise picker z-index

  • sanitize technical backend errors into user-friendly admin messages

  • simplify admin wording (no branch/pr/github jargon)

- remove picker info toasts that blocked attendant selection UI

- hide toast stack while modal is open and raise picker z-index

- sanitize technical backend errors into user-friendly admin messages

- simplify admin wording (no branch/pr/github jargon)
@ArielAio ArielAio self-assigned this Mar 12, 2026
Copilot AI review requested due to automatic review settings March 12, 2026 23:13
@vercel

vercel Bot commented Mar 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
li-rilko Ready Ready Preview, Comment Mar 12, 2026 11:13pm

@ArielAio
ArielAio merged commit 131942a into main Mar 12, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ajusta a UX do fluxo de escolha de atendente no WhatsApp (removendo toasts informativos ao abrir o picker e garantindo sobreposição correta) e simplifica/normaliza mensagens de feedback no manager de atendimento do admin.

Changes:

  • Remove toasts “Escolha a atendente” ao abrir o picker (float widget, contato e carrinho).
  • Ajusta CSS para o picker do WhatsApp sobrepor corretamente outros elementos (z-index) e altera o comportamento de visibilidade de toasts quando há modal aberto.
  • Refina mensagens do AdminServiceManager (sucesso/erro) e adiciona normalização/filtragem de mensagens vindas do backend.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
components/whatsapp-float-widget.js Remove toast informativo ao abrir o picker de atendente.
app/contato/page.js Remove toast informativo ao abrir o picker de atendente.
app/carrinho/page.js Remove toast informativo ao abrir o picker de atendente.
app/globals.css Ajusta z-index do backdrop do picker e altera exibição da toast-stack durante modais.
components/admin/managers/admin-service-manager.js Atualiza mensagens de toasts e adiciona normalização/filtragem de erro do payload.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/globals.css
Comment on lines +2194 to +2198
body.modal-open .toast-stack {
opacity: 0;
pointer-events: none;
}

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O CSS novo body.modal-open .toast-stack { opacity: 0; ... } vai esconder todos os toasts sempre que qualquer modal usar a classe modal-open (ex.: AdminModal e o picker). No admin, os managers dependem de showToast para feedback, então os avisos passam a não aparecer enquanto o modal estiver aberto. Sugestão: remover essa regra ou restringi-la a um seletor/classe específica do WhatsApp picker (ou só ajustar z-index, já que o backdrop do picker agora está em 2200).

Suggested change
body.modal-open .toast-stack {
opacity: 0;
pointer-events: none;
}

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +61
const hasTechnicalTerms =
lower.includes("pull request") ||
lower.includes("auto-merge") ||
lower.includes("branch") ||
lower.includes("github") ||
lower.includes("token") ||
lower.includes("resource not accessible") ||
lower.includes("quality-gate") ||
lower.includes("api");

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getErrorMessageFromPayload está filtrando mensagens com termos técnicos (ex.: contém "api"/"github") e devolvendo o fallback. Isso faz com que um erro que hoje vem do backend como "Falha na API do GitHub" (ver testes do route) seja sempre ocultado, perdendo uma informação útil para o admin diagnosticar o motivo do erro. Sugestão: tratar explicitamente mensagens conhecidas (p.ex. mapear para uma versão amigável) em vez de bloquear por substring genérica, ou ao menos não bloquear a mensagem inteira quando ela já é voltada ao usuário.

Copilot uses AI. Check for mistakes.
Comment on lines 119 to 142
if (!response.ok) {
throw new Error(getErrorMessageFromPayload(payload, "Não foi possível carregar atendentes."));
}

if (!isMounted) {
return;
}

const list = Array.isArray(payload?.attendants)
? payload.attendants.map(toDisplayAttendantDraft)
: [];

setAttendantsDraft(list.length > 0 ? list : [createEmptyAttendant()]);
} catch (error) {
if (!isMounted) {
return;
}

setAttendantsDraft((current) => (current.length > 0 ? current : [createEmptyAttendant()]));
showToast({
type: "warning",
title: "Falha ao carregar atendentes",
message: error instanceof Error ? error.message : "Tente novamente em instantes.",
message: "Não foi possível carregar a lista agora. Tente novamente em instantes.",
});

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No loadAttendants, você lança new Error(getErrorMessageFromPayload(...)), mas no catch o toast ignora completamente error.message e sempre mostra uma mensagem genérica. Isso elimina mensagens úteis como 401 "Acesso negado. Faça login..." retornadas pela rota e também torna o processamento de payload/getErrorMessageFromPayload redundante nesse fluxo. Sugestão: usar a mensagem normalizada (error.message) quando ela for segura, ou evitar construir/lançar esse erro se a intenção é sempre mostrar o texto genérico.

Copilot uses AI. Check for mistakes.
Comment on lines 194 to 213
if (!response.ok) {
throw new Error(getErrorMessageFromPayload(payload, "Não foi possível atualizar a lista agora."));
}

const list = Array.isArray(payload?.attendants)
? payload.attendants.map(toDisplayAttendantDraft)
: [];

setAttendantsDraft(list.length > 0 ? list : [createEmptyAttendant()]);
showToast({
type: "success",
title: "Lista atualizada",
message: "Atendentes carregados a partir do JSON do repositório.",
message: "A lista de atendentes foi atualizada com sucesso.",
});
} catch (error) {
showToast({
type: "warning",
title: "Falha ao atualizar",
message: error instanceof Error ? error.message : "Tente novamente em instantes.",
message: "Não foi possível atualizar a lista agora. Tente novamente em instantes.",
});

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No handleRefreshAttendants, a lógica monta uma mensagem de erro via getErrorMessageFromPayload(...), mas no catch o toast também sempre usa um texto fixo. Isso pode esconder erros relevantes (ex.: sessão inválida/401) e deixa o tratamento de erro inconsistente com o restante do componente. Sugestão: reaproveitar error.message (quando presente) ou remover o throw com mensagem se a UI nunca exibirá esse detalhe.

Copilot uses AI. Check for mistakes.

This branch was successfully deployed

1 active deployment
Preview — 11fe20b5 Deployed Mar 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants