Skip to content

fix: Align Volunteer Activity Navigation Component

Praneeth Ashish requested to merge fix-navigation-bar into develop

Merge Request: Fix Patient Status Component and Tests

Branch

fix-navigation-bardevelop## 🎯 Interactive Patient Status Tracker

Summary

This MR adds interactive click-to-navigate functionality to the vertical patient status display on the "Check Patient Status" page, enhancing user experience with keyboard accessibility, visual feedback, and seamless navigation between patient journey stages.

Features Added

1. Interactive Vertical Status Tracker

  • Click-to-Navigate: Each status step is now clickable and redirects to its corresponding page
  • Keyboard Accessible: Full support for Tab + Enter/Space navigation
  • Visual Feedback:
    • Hover effects with background highlighting
    • Icon scaling animations on hover
    • Text color changes for better interactivity cues
  • Smart Routing:
    • Prevents navigation to the current page
    • Preserves book number across pages
    • Maintains return URL for seamless back navigation
    • Special handling for doctor assignment routing

2. Bug Fixes

  • Connector Line Centering: Fixed vertical connector lines to be perfectly centered within status circles
    • Changed positioning from left-4left-6 to account for padding and icon width
    • Lines now run through the center of each circle instead of along edges

3. Test Coverage Improvements

  • Added test cases for patient search toggle functionality
  • Added test cases for clickable status steps
  • Fixed async timing issue in UpdatePrescriptionPage test
  • Coverage Results:
    • Functions: 59.94% → 60.08% (exceeds 60% threshold)
    • Total: 361 tests passing

📁 Files Changed

Modified:

  • src/pages/volunteer/PatientStatus.tsx - Added interactive navigation logic and UI enhancements
  • src/components/PatientStatusTracker.tsx - Minor formatting fixes
  • tests/volunteers/PatientStatus.test.tsx - Added coverage tests
  • tests/volunteers/UpdatePrescriptionPage.test.tsx - Fixed async test timing
  • package-lock.json - Updated dependencies

🔗 Navigation Routes

Step Route
Registration /volunteer/patient-registration?book_no={bookNumber}
Doctor Assigning /volunteer/assign-doctor/{bookNumber}
Vitals Collection /volunteer/record-vitals?book_no={bookNumber}
Medicines Prescribed /volunteer/update-prescription?book_no={bookNumber}
Medicine Verification /volunteer/verify-medicines?book_no={bookNumber}
Counseling Done /volunteer/counseling?book_no={bookNumber}

🧪 Testing

All tests passing (361/361) with coverage above threshold:

npm run test:coverage -- --run

📸 Visual Changes

  • Vertical status tracker maintains its layout while adding interactivity
  • Hover states provide clear visual feedback
  • Connector lines are properly centered within status circles
  • Smooth transitions and animations enhance UX

Checklist

  • Code follows project style guidelines
  • All tests passing
  • Coverage threshold met (60.08%)
  • No breaking changes
  • Keyboard accessibility implemented
  • Visual feedback for interactive elements
  • Return navigation preserved

Related Issue: # Closes #146 (closed)

Summary

Refactored the PatientStatusPage component to use the reusable PatientStatusTracker component and fixed failing tests related to responsive design rendering.

Changes Made

Component Refactoring

File: src/pages/volunteer/PatientStatus.tsx

What Changed

  • Removed custom inline status tracker implementation (~70 lines)
  • Replaced with reusable PatientStatusTracker component
  • Fixed code style issues (consistent quotes, semicolons, formatting)

Benefits

  • DRY Principle: Eliminated duplicate status tracking logic
  • Consistency: Uses the same tracker component across the application
  • Maintainability: Single source of truth for status display logic
  • Responsive Design: Inherits mobile/desktop optimizations from PatientStatusTracker
  • Code Quality: Cleaner, more maintainable code

Additional Improvements

  • Comprehensive Testing: Now verifies all 6 status steps (not just 3)
  • Correct Labels: Fixed "Doctor Assigning" → "Doctor Assignment" to match STATUS_STEPS
  • Removed Hardcoded Text: Eliminated "Stage Completed" check (not part of new component)

3. Component Updates

File: src/components/PatientStatusTracker.tsx

Minor formatting improvements for consistency.



Breaking Changes

None. This is a refactoring with no API or behavior changes.


Migration Notes

None required. The component behavior remains identical from a user perspective.


Checklist

  • All tests passing (359/359)
  • Code follows project style guidelines
  • Component reusability improved
  • No breaking changes
  • Documentation updated (inline comments)

Related Issues

  • Fixes #146 (closed) UI Fix: Align Volunteer Activity Navigation Component

Screenshots

N/A - No visual changes, internal refactoring only


Reviewer Notes

  • The PatientStatusTracker component uses a responsive design pattern where both mobile and desktop views exist in the DOM simultaneously
  • This is why tests now use getAllByText() - it's the correct approach for this architecture
  • The refactoring significantly reduces code duplication and improves maintainability
Edited by Praneeth Ashish

Merge request reports

Loading