Skip to content

fix(manager): drawer mobile + acoes visiveis no touch - #184

Open
douglasanpa wants to merge 3 commits into
evolution-foundation:mainfrom
douglasanpa:fix/manager-mobile-drawer
Open

fix(manager): drawer mobile + acoes visiveis no touch#184
douglasanpa wants to merge 3 commits into
evolution-foundation:mainfrom
douglasanpa:fix/manager-mobile-drawer

Conversation

@douglasanpa

@douglasanpa douglasanpa commented Aug 27, 2026

Copy link
Copy Markdown

Problema

No celular (< 768px) o manager quebra em 2 pontos (só no manager/dist pré-buildado):

  1. Menu lateral someclass="hidden md:flex" esconde a sidebar sem nenhum botão hambúrguer. No celular o usuário fica sem navegação.
  2. Ações da instância invisíveis mas clicáveis — barra de ações é opacity-0 group-hover:opacity-100. Sem hover no touch ela fica invisível, mas continua recebendo clique. Resultado: usuário toca no “escuro” e desconecta a instância sem querer.

Relato real: no desktop aparecem os botões Conectar / Configurar / Labs etc, no celular não — e ao tocar no escuro já aconteceu desconexão acidental.

Por que fizemos assim

O repo evolution-go só versiona manager/dist pré-buildado, não tem manager/src para corrigir Layout.tsx / InstanceCard.tsx direto. Então optamos por uma injeção mínima via Dockerfile, sem precisar do source do manager nem rebuild do front — 2 assets pequenos que são copiados para manager/dist/assets e referenciados no index.html com sed.

No desktop o comportamento fica idêntico ao original.

O que foi feito

  • manager-mobile-fix.css (~1.5KB)

    • Sidebar vira drawer off-canvas em < 768px (position: fixed, translateX(-100%).open desliza) + backdrop escuro.
    • Força a barra de ações para opacity: 1 só onde era opacity-0 no hover (.group .flex.border-t.opacity-0), sem afetar outros opacity-0 do app.
    • Esconde backdrop/hambúrguer em >= 768px e ajusta header/main no mobile.
  • manager-mobile-fix.js (~2.5KB, vanilla)

    • Injeta botão hambúrguer no header (SVG simples, aria-label="Abrir menu").
    • Controla drawer: abre/fecha, backdrop clicável, ESC fecha, clique em qualquer link da sidebar fecha.
    • SPA-aware: re-injeta após history.pushState / popstate porque o manager é React SPA.
  • Dockerfile (stage final)

    COPY manager-mobile-fix.css manager-mobile-fix.js ./manager/dist/assets/
    RUN sed -i 's|</head>|<link rel="stylesheet" href="/assets/manager-mobile-fix.css"></head>|' ./manager/dist/index.html && \
        sed -i 's|</body>|<script src="/assets/manager-mobile-fix.js"></script></body>|' ./manager/dist/index.html

Como testar

docker build -t evolution-go:mobile-test .  # na raiz do repo
docker run --rm --entrypoint sh evolution-go:mobile-test -c 'cat /app/manager/dist/index.html | grep manager-mobile'
docker run --rm --entrypoint sh evolution-go:mobile-test -c 'ls -la /app/manager/dist/assets/manager-mobile*'

Manual: abrir /manager no celular — hambúrguer aparece, sidebar desliza com backdrop, todos os botões (Conectar, Configurar, Labs, Desconectar) visíveis; no desktop nada muda.

Validado em produção em evogo.iascent.com.br após o build do fork.

Próximo passo ideal

Quando o source do manager for versionado (ou num repo dedicado como evolution-manager-v2), o fix definitivo é corrigir Layout.tsx (drawer responsivo) e InstanceCard.tsx (ações sempre visíveis no touch) direto no source. Enquanto o evolution-go só entrega dist, essa injeção é a forma menos invasiva.

Summary by Sourcery

Build a Solar Teles Evolution GO fork that combines critical upstream bug fixes with a responsive mobile manager experience.

New Features:

  • Add responsive mobile navigation to the prebuilt manager, including a drawer, hamburger control, backdrop, and touch-friendly instance actions.

Bug Fixes:

  • Apply upstream fixes for webhook configuration loss, PostgreSQL connection-pool leaks, QR requests disconnecting active sessions, and canonical JID handling for avatar and message operations.

Enhancements:

  • Rework the container build to clone a pinned upstream release and apply maintained patches before producing the runtime image.
  • Improve the runtime image with non-root execution support, metadata, exposed port configuration, and a health check.

Build:

  • Replace the local-source build with a multi-stage Docker build based on a pinned upstream tag and patch set.

Deployment:

  • Document and package the Solar Teles fork image for registry-based deployment.

Documentation:

  • Replace the upstream project README with fork-specific build, deployment, validation, and retirement guidance.

Chores:

  • Add the manager mobile CSS and JavaScript assets injected into the prebuilt manager during the image build.

Sidebar was hidden md:flex with no hamburger on <768px — users on
phone could not navigate (no menu) and the instance action bar was
opacity-0 group-hover:opacity-100 so it was invisible but still
clickable (accidental disconnects tapping the dark area).

Injects manager-mobile-fix.css/js into manager/dist via Dockerfile
sed — dist is prebuilt in this repo so no manager/src to patch.
Keeps behavior unchanged on desktop.
@sourcery-ai

sourcery-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR applies a non-invasive mobile UX patch to the prebuilt manager by injecting CSS and JavaScript assets from the final Docker stage. It adds a responsive hamburger-driven sidebar drawer with backdrop and close behavior, while making instance actions continuously visible on touch devices; desktop behavior is explicitly preserved.

Sequence diagram for the mobile sidebar drawer interaction

sequenceDiagram
    actor User
    participant Header
    participant MobileFix as manager-mobile-fix.js
    participant Sidebar
    participant Backdrop

    MobileFix->>Header: insertBefore(hamburger button)
    User->>Header: click hamburger
    Header->>MobileFix: click handler
    MobileFix->>Sidebar: add open class
    MobileFix->>Backdrop: add open class
    MobileFix->>MobileFix: set document.body.style.overflow
    User->>Backdrop: click backdrop
    Backdrop->>MobileFix: closeDrawer()
    MobileFix->>Sidebar: remove open class
    MobileFix->>Backdrop: remove open class
    User->>Sidebar: click nav link
    Sidebar->>MobileFix: closeDrawer()
    User->>MobileFix: press Escape
    MobileFix->>MobileFix: closeDrawer()
Loading

File-Level Changes

Change Details Files
Injects mobile UX assets into the prebuilt manager bundle during the Docker image build.
  • Copies the CSS and JavaScript fixes into the manager assets directory.
  • Uses Dockerfile substitutions to add the assets to the generated HTML entry point.
Dockerfile
Converts the hidden mobile sidebar into an accessible off-canvas navigation drawer.
  • Overrides responsive sidebar styles below 768px and adds slide-in, backdrop, and desktop visibility rules.
  • Injects a hamburger control and drawer backdrop at runtime.
  • Supports closing through navigation clicks, backdrop clicks, Escape, and SPA navigation reinitialization.
manager-mobile-fix.css
manager-mobile-fix.js
Makes instance action controls visible on touch devices.
  • Overrides the hover-dependent zero opacity so action bars remain visible without pointer hover.
manager-mobile-fix.css

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot 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.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="manager-mobile-fix.css" line_range="5" />
<code_context>
+/* Sidebar: hidden md:flex => drawer on <768px; instance actions: always visible (no hover) */
+
+/* Instance action bar — was opacity-0 group-hover:opacity-100, invisible on touch devices */
+.group .flex.border-t.opacity-0 { opacity: 1 !important; }
+
+/* Mobile drawer */
</code_context>
<issue_to_address>
**nitpick (broader_impact):** The global opacity override makes every matching instance action bar permanently visible on desktop, removing the existing hover-only behavior even though the change claims desktop behavior is unchanged.

**Triggers:** On desktop widths where the original `group-hover:opacity-100` behavior should apply.

**Suggested fix:** Scope the opacity override to the mobile media query, or add a desktop rule that restores the original opacity behavior.

```suggestion
@media (max-width: 767px) {
  .group .flex.border-t.opacity-0 { opacity: 1 !important; }
}
```
</issue_to_address>

### Comment 2
<location path="manager-mobile-fix.js" line_range="57-60" />
<code_context>
+
+  // SPA: retry until React mounts
+  var tries = 0;
+  var timer = setInterval(function(){
+    if(init() || ++tries > 60) clearInterval(timer);
+  }, 300);
+  // also re-init on navigation (history changes)
</code_context>
<issue_to_address>
**issue (bug_risk):** The retry loop stops after roughly 18 seconds; if React mounts the sidebar after that window, `init()` is never called again and the mobile hamburger/drawer is permanently absent until a full page reload.

**Triggers:** When the application bundle or initial API-driven render takes longer than approximately 18 seconds.

**Suggested fix:** Retry until the expected DOM appears, or observe the root with a `MutationObserver` instead of using a fixed retry limit.

```suggestion
  var timer = setInterval(function(){
    if(init()) clearInterval(timer);
  }, 300);
```
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: manager-mobile-fix.js:60


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread manager-mobile-fix.css Outdated
Comment thread manager-mobile-fix.js Outdated
@douglasanpa douglasanpa changed the title fix(manager): mobile drawer + visible instance actions fix(manager): drawer mobile + acoes visiveis no touch Aug 27, 2026
@douglasanpa

Copy link
Copy Markdown
Author

Obrigado @sourcery-ai — corrigido em a8c4407:

  • opacity escopado para @media (max-width:767px) (desktop mantém hover)
  • retry sem limite de 18s (rede lenta)
    @sourcery-ai review

sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Aug 27, 2026

@sourcery-ai sourcery-ai Bot 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.

Sourcery assessment

Approved.

@sourcery-ai
sourcery-ai Bot dismissed their stale review August 27, 2026 22:41

Sourcery withdrew this approval because the latest commits introduced blocking findings.

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.

1 participant