Skip to content

feat(dashboard): add an Unlink action to session cards - #1002

Merged
rmyndharis merged 1 commit into
mainfrom
feat/dashboard-unlink-button
Jul 29, 2026
Merged

feat(dashboard): add an Unlink action to session cards#1002
rmyndharis merged 1 commit into
mainfrom
feat/dashboard-unlink-button

Conversation

@rmyndharis

Copy link
Copy Markdown
Owner

Description

Completes the logout work from #984 on the dashboard side: the Sessions page had no way to reach POST /sessions/:id/logout, the only lifecycle operation that tells WhatsApp anything — stop and delete release the session locally but leave the device listed under the account holder's Linked Devices on the phone.

  • Button — labelled Unlink (not Logout) so it cannot be confused with the sidebar's own authentication logout, with a matching Unlink lucide icon, styled as a danger action. It renders for exactly the states that have a live engine (ready, initializing, connecting, qr_ready) — the same visibility as Stop, since the API rejects a logout for a session that is not started.
  • Confirmation dialog — mirrors the force-kill modal, and spells out both consequences: reconnecting requires a fresh QR scan or pairing code, and local data only goes away with a separate Delete (unlink first, delete after, for a full removal).
  • 502 handling — a session that stopped locally but whose unlink WhatsApp did not confirm surfaces as a warning toast with retry guidance (start the session, try again) instead of a plain error, since the end state is not a pure failure.
  • Testability — the visibility predicate (canUnlinkSession) and error classification (classifyUnlinkError) live in a pure util (dashboard/src/utils/sessionUnlink.ts) with colocated unit tests, following the dashboard's utils-only test convention.
  • i18n — all twelve locales gain sessions.actions.unlink and the sessions.unlink dialog/toast copy.
  • Docs — the docs/17 session-card mock-up (which sketched this button as [Logout]) is updated, plus a CHANGELOG entry.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • Tests added/updated
  • Documentation updated
  • Lint passes
  • Self-reviewed

Related Issues

Relates to #984

The Sessions page had no way to reach POST /sessions/:id/logout, the
only lifecycle operation that tells WhatsApp anything: stop and delete
release the session locally but leave the device listed under the
account holder's Linked Devices on the phone.

The button is labelled Unlink rather than Logout so it cannot be
confused with the sidebar's own authentication logout, and it appears
for exactly the states that have a live engine — the same visibility
as Stop. The confirmation dialog spells out both consequences: a fresh
QR scan or pairing code is needed to reconnect, and local data only
goes away with a separate Delete. A 502 — session stopped locally but
the unlink unconfirmed by WhatsApp — surfaces as a warning toast with
retry guidance instead of a plain error.

Visibility and error classification live in a pure util so they are
unit-testable under the dashboard's test conventions; labels and
dialog copy are localized across all twelve locales.
@rmyndharis
rmyndharis force-pushed the feat/dashboard-unlink-button branch from f86a430 to f21ed55 Compare July 29, 2026 11:12
@rmyndharis
rmyndharis merged commit f8d1d93 into main Jul 29, 2026
8 checks passed
@rmyndharis
rmyndharis deleted the feat/dashboard-unlink-button branch July 29, 2026 11:33
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