Skip to content

fix: volunteer queue-flow regressions, missing translations, and notification handling inconsistencies in the frontend

Lakshy Yarlagadda requested to merge fix/i18n into develop

Merge Request


Overview

This MR fixes volunteer queue-flow regressions, missing translations, and notification handling inconsistencies in the frontend.

It addresses three primary issues:

  • queue filters and labels still contained hardcoded English or missing locale strings
  • verify-medicines flow was updating patients to the wrong next status and redirecting incorrectly
  • consultation waiting queue regression caused in_consultation patients to remain visible in the waiting queue UI
  • notification flow inconsistently used useAlertReplacement instead of standardized toast usage from sonner
  • TypeScript error TS2552 in AppLayout due to undefined addNotification

This change is needed to ensure:

  • correct volunteer queue progression
  • proper localized UI text in English / Hindi / Telugu
  • consistent notification handling
  • removal of queue-flow regressions
  • clean TypeScript compilation

What does this MR do and why?

Motivation

The volunteer queue workflow depends on accurate queue transitions and clear localized labels.

The branch had regressions causing:

  • patients appearing in wrong queues
  • wrong redirection after medicine verification
  • untranslated queue labels
  • TypeScript build failures
  • inconsistent alert / toast patterns

This reduced confidence in volunteer workflows and introduced compilation issues.


Approach Taken

This MR intentionally keeps the scope focused and minimal:

  • fix affected queue transitions only
  • restore intended waiting vs in-consultation split
  • replace hardcoded queue labels with i18n keys
  • standardize toast notifications using sonner
  • remove unnecessary wrapper hook
  • update regression tests

Trade-offs

  • no full app-wide i18n cleanup
  • no global notification architecture refactor
  • existing test warnings remain but tests pass

Changes Made

Files Modified

  • src/components/PatientCard.tsx
  • src/components/QueueDisplay.tsx
  • src/locales/en/translations.json
  • src/locales/hi/translations.json
  • src/locales/te/translations.json
  • src/pages/DashboardPage.tsx
  • src/pages/volunteer/ConsultationQueuePage.tsx
  • src/pages/volunteer/CounselingQueuePage.tsx
  • src/pages/volunteer/KYPQueuePage.tsx
  • src/pages/volunteer/MedicinePickupQueuePage.tsx
  • src/pages/volunteer/PrescriptionsQueuePage.tsx
  • src/pages/volunteer/VerifyMedicinesPage.tsx
  • src/pages/volunteer/VerifyMedicinesQueuePage.tsx
  • src/pages/volunteer/VitalsQueuePage.tsx
  • src/pages/volunteer/VitalsWaitingQueuePage.tsx
  • src/components/AppLayout.tsx
  • tests/PatientCard.test.tsx
  • tests/pages/DashboardPage.test.tsx
  • tests/unit/components/ConsultationQueuePage.test.tsx
  • tests/volunteers/VerifyMedicinesPage.test.tsx
  • CHANGELOG.md

Functional Changes

  • replaced hardcoded queue labels with i18n lookups
  • added missing translations in:
    • English
    • Hindi
    • Telugu
  • fixed leaf-key i18n lookups
  • verify-medicines now updates status to counselling
  • verify flow redirects correctly to verify queue
  • consultation waiting queue now shows only waiting
  • in_consultation patients stay in dedicated page
  • replaced useAlertReplacement with direct toast
  • fixed TS2552 undefined addNotification

New Components / Hooks / Utilities

No new components introduced.

Removed unnecessary wrapper:

  • useAlertReplacement

API Endpoint Changes

No endpoint changes.

Existing queue status update endpoint now uses correct status value:

counselling


Configuration Changes

None


Technical Details

Root Causes

  • object-root i18n keys rendered incorrectly
  • hardcoded queue labels
  • wrong verify queue transition
  • consultation queue mixed waiting + in_consultation
  • inconsistent alert abstraction
  • undefined notification reference in layout

How the Fix Addresses It

  • uses leaf i18n keys
  • restores waiting-only consultation queue
  • updates verify flow to correct next status
  • standardizes toast usage
  • removes wrapper hook complexity
  • resolves TS compile issue

Architecture Decisions

  • standardize notifications using sonner
  • keep existing queue architecture
  • minimal focused regression fix
  • preserve existing routing structure

State Management Approach

  • page-local state preserved
  • TanStack Query unchanged
  • direct toast invocation for notifications

Component Structure and Data Flow

  • queue pages render correct filtered statuses
  • verify flow updates status then redirects
  • shared queue components use i18n-backed labels
  • notifications use direct toast calls

Type of Change

  • 🐛 Bug fix
  • New feature
  • 💥 Breaking change
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • ️ Refactor
  • Performance improvement
  • 🧪 Test update
  • 🔧 Configuration change
  • 🚨 Security fix

Related Issues / References

  • Related to queue progression regressions
  • Related to i18n volunteer flow issues
  • Related to notification handling cleanup

Screenshots or Screen Recordings

Before After
in_consultation visible in waiting queue shown only in dedicated queue
verify flow → wrong queue verify flow → verify queue
hardcoded English labels translated queue labels
wrapper alerts direct toast notifications

How to Set Up and Validate Locally

Setup

bun install
bun dev

Validate Queue Flow

  1. open volunteer dashboard
  2. start consultation
  3. confirm patient leaves waiting queue
  4. open verify medicines queue
  5. complete verification
  6. confirm status → counselling
  7. confirm redirect stays in verify queue

Validate i18n

Switch language:

  • Hindi
  • Telugu

Validate:

  • queue labels
  • filter labels
  • dropdowns

Validate Notifications

Trigger flows that previously used alerts:

  • KYP page
  • AppLayout notifications
  • medicine pickup

Confirm toast notifications render correctly.


Testing Done

  • Manual testing completed
  • Unit tests added/updated

Test Cases Covered

Scenario Expected Result Status
waiting queue filter only waiting patients
verify status update moves to counselling
verify redirect verify queue
i18n labels translated
TypeScript build passes
test suite passes

Code Quality Checklist

  • follows conventions
  • no console/debugger
  • no unused code
  • types correct
  • errors toasted properly
  • i18n fixes added
  • CHANGELOG updated

Known Limitations / Technical Debt

  • no full i18n audit
  • pre-existing warnings remain:
    • React act(...)
    • Radix dialog warnings
    • jsdom navigation warnings

Additional Notes

This MR is intentionally minimal and focused on:

  • queue regressions
  • i18n fixes
  • toast standardization
  • TS error resolution

No backend or config changes required.


MR Acceptance Checklist

  • queue transitions fixed
  • waiting queue restored
  • verify flow corrected
  • i18n labels fixed
  • TS build error resolved
  • tests passing

Merge request reports

Loading