Skip to content

Conversation

@aditya241104
Copy link
Collaborator

@aditya241104 aditya241104 commented Dec 4, 2025

Project

  • QuickClinic
  • QuickMed

Change Type

  • New Feature/Page/API Endpoint
  • Bug Fix
  • UI Redesign
  • Optimization
  • Other

Stack

  • Frontend
  • Backend
  • Both

Page Type

  • Public
  • Patient
  • Doctor
  • Admin

Route/API Endpoint Status

  • New
  • Existing

What Changed

Route/API Affected

all routes

Description

fixes the navigation logic of navbar

Screenshots (If Applicable)

Mobile View

Desktop View

Code Quality

  • Prettier syntax check passed (npx prettier --check .)

Related Issues

Closes #

Summary by CodeRabbit

  • New Features
    • Selecting a suggestion in the navbar now navigates to the corresponding medicine details page, replacing the previous placeholder behavior with functional navigation.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
quick-clinic Ready Ready Preview Comment Dec 4, 2025 5:04am
quick-clinic-m9k7 Ready Ready Preview Comment Dec 4, 2025 5:04am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

Walkthrough

Added dynamic navigation to the Navbar component by importing useNavigate from react-router-dom and replacing a console.log placeholder with navigation logic that routes to /quick-med/medicine/{suggestion} when a suggestion is selected.

Changes

Cohort / File(s) Change Summary
Navbar Navigation Enhancement
client/src/components/quickmed/Navbar.jsx
Added useNavigate hook import and implemented suggestion click handler to navigate dynamically to medicine detail pages, replacing placeholder console.log

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • adds routes for quickmed' #103 — Directly complements this PR by adding the /quick-med/medicine/:medicineName route and mounting Navbar for QuickMed navigation flow.
  • Feature/navbar quickmed #101 — Related update to the same Navbar click-to-select behavior, sharing identical navigation implementation patterns.

Poem

🐰 A hop, a click, a path is found,
Through suggestion fields, the nav goes 'round,
useNavigate guides us true,
To medicine pages, shiny and new! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fixes the suggestion click logic of navbar' directly and clearly summarizes the main change in the changeset, which adds dynamic navigation for suggestion clicks in the Navbar component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/quickmed-navbar

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

📋 PR Auto-Check

📝 Files Changed

client/src/components/quickmed/Navbar.jsx

✨ Code Quality

Prettier Check: ✅ Passed


Auto-generated on 2025-12-04T05:04:52.458Z

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

📋 PR Auto-Check

📝 Files Changed

client/src/components/quickmed/Navbar.jsx

✨ Code Quality

Prettier Check: ✅ Passed


Auto-generated on 2025-12-04T05:06:50.100Z

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 06a44fd and 521e863.

📒 Files selected for processing (1)
  • client/src/components/quickmed/Navbar.jsx (2 hunks)
🔇 Additional comments (2)
client/src/components/quickmed/Navbar.jsx (2)

5-5: LGTM!

The import statement is correct for adding navigation functionality.


13-13: LGTM!

The hook is properly instantiated at the component's top level.

Comment on lines 38 to 42
const handleSuggestionClick = (suggestion) => {
setSearchQuery(suggestion);
setShowSuggestions(false);
// Placeholder for future implementation
console.log('Selected medicine:', suggestion);
navigate(`/quick-med/medicine/${suggestion}`);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Search for route definitions for /quick-med/medicine
rg -n --type=jsx --type=js --type=tsx --type=ts '/quick-med/medicine' -C 3

Repository: genzz-dev/QuickClinic

Length of output: 92


🏁 Script executed:

# Also search for route definitions that might match the pattern
fd -e jsx -e js -e tsx -e ts | head -20

Repository: genzz-dev/QuickClinic

Length of output: 1143


🏁 Script executed:

# Search for route parameter extraction patterns
rg -n 'useParams\|params\.' --type=jsx --type=js --type=tsx --type=ts -C 2 | head -50

Repository: genzz-dev/QuickClinic

Length of output: 92


🏁 Script executed:

# Look for the medicine detail component or page
fd -e jsx -e js -e tsx -e ts -i '*medicine*' | grep -v node_modules

Repository: genzz-dev/QuickClinic

Length of output: 354


🏁 Script executed:

# Search for route definitions matching /quick-med/medicine
rg '/quick-med/medicine' -C 3

Repository: genzz-dev/QuickClinic

Length of output: 1642


🏁 Script executed:

# Search for App.jsx to find route definitions
cat client/src/App.jsx

Repository: genzz-dev/QuickClinic

Length of output: 3019


🏁 Script executed:

# Search for useParams usage that might extract medicine name
rg 'useParams' -C 3

Repository: genzz-dev/QuickClinic

Length of output: 9574


🏁 Script executed:

# Look for files in quickmed directory
fd -type f -path '*quickmed*'

Repository: genzz-dev/QuickClinic

Length of output: 235


🏁 Script executed:

# Get full MedicineDetails component to see how medicineName is used
cat client/src/pages/quickmed/MedicineDetails.jsx

Repository: genzz-dev/QuickClinic

Length of output: 1788


🏁 Script executed:

# Check if there's any transformation or decoding in getMedicineDetails service
rg 'getMedicineDetails' -C 5

Repository: genzz-dev/QuickClinic

Length of output: 4651


🏁 Script executed:

# Check the medicine API service to see what format it expects
cat client/src/service/medicineApiService.js

Repository: genzz-dev/QuickClinic

Length of output: 1182


🏁 Script executed:

# Check if there are any tests or documentation about medicine name formats
rg 'medicine.*name|medicineName' client/src/pages/quickmed/HomePage.jsx -A 3 -B 1

Repository: genzz-dev/QuickClinic

Length of output: 297


🏁 Script executed:

# Look at the getMedicineSuggestions API to understand what format it returns
rg 'getMedicineSuggestions|suggestions' server/Controllers/QuickMed/medicineController.js -A 10

Repository: genzz-dev/QuickClinic

Length of output: 2684


URL-encode the medicine name in the navigation call to prevent routing failures.

The suggestion parameter passed from the API can contain special characters (spaces, slashes, parentheses, etc.) found in real medicine names. Without encoding, these break the URL routing—for example, "Amoxicillin/Clavulanate" becomes /quick-med/medicine/Amoxicillin/Clavulanate instead of a single route segment.

The HomePage component already handles this correctly with encodeURIComponent(). Apply the same pattern here:

 const handleSuggestionClick = (suggestion) => {
   setSearchQuery(suggestion);
   setShowSuggestions(false);
-  navigate(`/quick-med/medicine/${suggestion}`);
+  navigate(`/quick-med/medicine/${encodeURIComponent(suggestion)}`);
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const handleSuggestionClick = (suggestion) => {
setSearchQuery(suggestion);
setShowSuggestions(false);
// Placeholder for future implementation
console.log('Selected medicine:', suggestion);
navigate(`/quick-med/medicine/${suggestion}`);
};
const handleSuggestionClick = (suggestion) => {
setSearchQuery(suggestion);
setShowSuggestions(false);
navigate(`/quick-med/medicine/${encodeURIComponent(suggestion)}`);
};
🤖 Prompt for AI Agents
In client/src/components/quickmed/Navbar.jsx around lines 38 to 42, the navigate
call uses the raw suggestion which can contain characters that break routing;
update the navigate invocation to URL-encode the medicine name (use
encodeURIComponent(suggestion)) so the route becomes
/quick-med/medicine/<encoded-name>; leave setSearchQuery and setShowSuggestions
as-is and ensure the encoded value is used only for navigation.

@aditya241104 aditya241104 merged commit f16c5a9 into main Dec 4, 2025
7 checks passed
@aditya241104 aditya241104 deleted the fix/quickmed-navbar branch December 4, 2025 05:13
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