Skip to content

feat(dashboard): add link with phone number pairing code UI - #551

Merged
rmyndharis merged 2 commits into
rmyndharis:mainfrom
akash247777:feature/link-with-phone-number-ui
Jun 30, 2026
Merged

feat(dashboard): add link with phone number pairing code UI#551
rmyndharis merged 2 commits into
rmyndharis:mainfrom
akash247777:feature/link-with-phone-number-ui

Conversation

@akash247777

Copy link
Copy Markdown
Contributor

Description

This pull request adds the frontend dashboard UI for the "Link with Phone Number" pairing code feature.

While the NestJS backend API endpoint (POST /api/sessions/:id/pairing-code) was already implemented, there was no way to request or view the pairing code from the dashboard interface.

Key Changes

  1. Interactive Toggle Tabs: Modified the session connection modal on the Sessions page to render a toggle switch between the standard "QR Code" scanning mode and the new "Link with Phone Number" mode.
  2. Phone Number Input & Validation: Added a phone input field that automatically sanitizes inputs (enforces digits-only) and triggers the pairing code request.
  3. Pairing Code Display: Renders the 8-character pairing code in a large, spaced, monospace format (e.g., ABCD - 1234) for high readability.
  4. Step-by-step Instructions: Included clear localization-supported instructions in the modal explaining how to link the device on the WhatsApp mobile app.
  5. Clean State Management: Integrated state cleanup on modal close (resets phone number, generated codes, and errors).

Type of Change

  • New feature

Checklist

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

Screenshots

image image

akash247777 and others added 2 commits June 30, 2026 16:01
… a11y, state)

- i18n: add the 9 missing locale translations for the sessions.pairing block, plus
  invalidPhone and waitingConnection keys (the latter referenced a key that existed in
  no locale) — i18n:check is green again
- CSS: scope every .pairing-* selector under .sessions-page so the styles.scope guard
  passes; remove the duplicate .pairing-instructions and the dead .pairing-step rules
- UX: show a phone-specific validation message instead of the session-name error, and
  reset pairing state whenever the modal (re)opens so a fresh session never shows a
  stale code or number
- a11y: associate the phone label, use type=tel + inputMode=numeric + maxLength, disable
  Generate until the number is valid, add tab/tabpanel roles, and move the error banner
  to a theme-aware class that is readable in dark mode
@rmyndharis

Copy link
Copy Markdown
Owner

Thanks for this, @akash247777 — really nice contribution. The pairing-code endpoint has existed on the backend for a while with no way to reach it from the dashboard, so this fills a genuine gap, and the QR ⇄ phone tab flow reads well.

I've pushed one follow-up commit on top to get it merge-ready against our CI gates and a few UX details:

Required for CI

  • Locale parity (npm run i18n:check blocks the build): the new sessions.pairing.* keys were only in en.json, so the other 9 locales failed parity. Added native translations of the full block across ar, es, fr, he, it, pt-BR, te, zh-CN, zh-HK.
  • CSS scope guard (styles.scope.test.ts): the new .pairing-* selectors were global; scoped them all under .sessions-page to match the rest of the file and avoid cross-route style bleed.

Correctness / UX

  • The "waiting to connect" line referenced sessions.pairing.waitingConnection, which didn't exist in any locale (it rendered the raw key) — added it.
  • Invalid-phone validation reused the session-name error ("only lowercase letters… hyphens"); added a phone-specific invalidPhone message.
  • Reset the pairing sub-state whenever the modal (re)opens, so opening it for a different session can't show a stale code/number.

Accessibility / polish

  • <label htmlFor>/id association, type="tel" + inputMode="numeric" + maxLength, Generate disabled until the number is valid, role="tab"/tabpanel, and the error banner moved to a theme-aware class (the hardcoded #FEE2E2/#DC2626 was unreadable in dark mode).

Full gate is green locally (build, unit tests, eslint, prettier, i18n parity, scope guard); CI is running now. Merging once it's green. Thanks again!

@rmyndharis
rmyndharis merged commit e957700 into rmyndharis:main Jun 30, 2026
5 checks passed
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