Skip to content

Conversation

@aditya241104
Copy link
Collaborator

@aditya241104 aditya241104 commented Dec 3, 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

/quick-med

Description

Adds home page for quick med

Screenshots (If Applicable)

Mobile View

image

Desktop View

image

Code Quality

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

Related Issues

Closes #NA

Summary by CodeRabbit

  • New Features
    • Launched a new QuickMed homepage featuring a searchable medicine directory with live suggestions.
    • Implemented keyboard navigation for search results (arrow keys and Enter to select).
    • Added dark mode support with automatic theme detection.
    • Introduced responsive feature showcase with card-based layout.
    • Added promotional banner and footer with quick-tag popular searches for convenient access.

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

@vercel
Copy link

vercel bot commented Dec 3, 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 3, 2025 10:06am
quick-clinic-m9k7 Ready Ready Preview Comment Dec 3, 2025 10:06am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 3, 2025

Walkthrough

This PR introduces a complete QuickMed homepage featuring a centralized medicine search interface, dark mode support, and multiple UI sections. The implementation includes a search bar with keyboard navigation and live suggestions, along with hero, features, info banner, and footer sections. A new homepage route is registered at /quick-med/.

Changes

Cohort / File(s) Summary
Icon Components
client/src/components/quickmed/HomePage/Icons.jsx
New centralized Icons module exporting 9 SVG-based icon components (Search, Sun, Moon, Pill, Shield, Lightning, Database, Close, Spinner).
UI Components
client/src/components/quickmed/HomePage/FeaturesSection.jsx, client/src/components/quickmed/HomePage/Footer.jsx, client/src/components/quickmed/HomePage/HeroSection.jsx, client/src/components/quickmed/HomePage/InfoBanner.jsx
New presentational components rendering hero section with decorative elements, 3-column feature grid with cards, promotional info banner, and responsive footer with brand, disclaimer, and CTA sections.
Search Component
client/src/components/quickmed/HomePage/SearchBar.jsx
New SearchBar component with live medicine suggestions, keyboard navigation (arrow keys, Enter, Escape), quick-tag chips, loading state, and no-results messaging.
Page & Routing
client/src/pages/quickmed/HomePage.jsx, client/src/routes/QuickmedRoutes.jsx
New HomePage page component integrating all sections with dark mode support (localStorage + OS preference), debounced medicine search API integration, keyboard navigation logic, and click-outside dropdown handling. New /quick-med/ route registered.
Cleanup
client/src/pages/quickmed/MedicineDetails.jsx
Removed unused Navbar import; component logic unchanged.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HomePage as HomePage Component
    participant SearchBar as SearchBar Component
    participant API as getMedicineSuggestions API
    participant Router as React Router

    User->>SearchBar: Types in search input
    SearchBar->>HomePage: setSearchQuery updates
    HomePage->>HomePage: Debounce timer starts
    
    Note over HomePage: Query length ≥ 2
    HomePage->>API: Fetch medicine suggestions
    API-->>HomePage: Return suggestions list
    HomePage->>SearchBar: Pass suggestions + loading state
    SearchBar->>User: Display suggestions dropdown

    User->>SearchBar: Press ArrowUp/ArrowDown
    SearchBar->>HomePage: setSelectedIndex updates
    SearchBar->>User: Highlight active suggestion

    User->>SearchBar: Click suggestion / Press Enter
    SearchBar->>HomePage: handleSelectMedicine(name)
    HomePage->>HomePage: Format name to URL slug
    HomePage->>Router: Navigate to /quick-med/medicine/{encodedName}
    Router->>User: Render MedicineDetails page

    User->>SearchBar: Press Escape / Click outside
    SearchBar->>HomePage: setShowSuggestions(false)
    SearchBar->>User: Hide suggestions dropdown
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Areas requiring attention:

  • HomePage.jsx: Verify debounced search implementation, keyboard navigation edge cases (e.g., wrapping at list boundaries), and dark mode persistence logic across localStorage and OS preference detection.
  • SearchBar.jsx: Confirm proper state management for selectedIndex during keyboard navigation and correct rendering of loading/no-results states.
  • Icons.jsx: Validate SVG accessibility (aria-hidden, viewBox attributes) and consistency of sizing across all 9 icon components.

Possibly related PRs

  • PR#100: Implements medicineApiService with getMedicineSuggestions backend integration that this PR directly consumes in HomePage.
  • PR#99: Adds dark mode/theme infrastructure that this PR builds upon for theme persistence and toggle functionality.
  • PR#103: Modifies routing configuration and removes Navbar import from MedicineDetails, overlapping with this PR's routing and dependency updates.

Suggested labels

enhancement, UI

Poem

🐰 A search bar springs to life so bright,
With icons dancing left and right,
Dark mode whispers through the night,
Features gleam in cards so tight—
QuickMed's homepage takes its flight! 🚀

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feature/quick med home page' directly corresponds to the main change: a new QuickMed home page with route /quick-med and associated UI components.
✨ 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 feature/quick-med-home-page

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 3, 2025

📋 PR Auto-Check

📝 Files Changed

client/src/components/quickmed/HomePage/FeaturesSection.jsx
client/src/components/quickmed/HomePage/Footer.jsx
client/src/components/quickmed/HomePage/HeroSection.jsx
client/src/components/quickmed/HomePage/Icons.jsx
client/src/components/quickmed/HomePage/InfoBanner.jsx
client/src/components/quickmed/HomePage/SearchBar.jsx
client/src/pages/quickmed/HomePage.jsx
client/src/pages/quickmed/MedicineDetails.jsx
client/src/routes/QuickmedRoutes.jsx

✨ Code Quality

Prettier Check: ✅ Passed


Auto-generated on 2025-12-03T10:06:24.080Z

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

📋 PR Auto-Check

📝 Files Changed

client/src/components/quickmed/HomePage/FeaturesSection.jsx
client/src/components/quickmed/HomePage/Footer.jsx
client/src/components/quickmed/HomePage/HeroSection.jsx
client/src/components/quickmed/HomePage/Icons.jsx
client/src/components/quickmed/HomePage/InfoBanner.jsx
client/src/components/quickmed/HomePage/SearchBar.jsx
client/src/pages/quickmed/HomePage.jsx
client/src/pages/quickmed/MedicineDetails.jsx
client/src/routes/QuickmedRoutes.jsx

✨ Code Quality

Prettier Check: ✅ Passed


Auto-generated on 2025-12-03T10:08:47.023Z

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

🧹 Nitpick comments (11)
client/src/components/quickmed/HomePage/HeroSection.jsx (2)

2-2: Remove unnecessary React import.

With React 19 and the modern JSX transform (enabled as indicated by the successful Prettier check), the React import is no longer needed for JSX.

Apply this diff:

-import React from 'react';
-
 const HeroSection = () => {

4-12: Consider renaming to reflect actual purpose.

This component is named HeroSection but only contains decorative background elements. The actual hero content (heading, search bar, etc.) appears in the "Search Bar Section" within HomePage.jsx. Consider renaming to something like DecorativeBackground or BackgroundBlur to better reflect its purpose.

client/src/components/quickmed/HomePage/InfoBanner.jsx (1)

2-2: Remove unnecessary React import.

With React 19 and the modern JSX transform, the React import is no longer required for JSX.

Apply this diff:

-import React from 'react';
-
 const InfoBanner = ({ navigateToQuickclinic }) => {
client/src/components/quickmed/HomePage/FeaturesSection.jsx (2)

2-2: Remove unnecessary React import.

With React 19 and the modern JSX transform, the React import is no longer needed.

Apply this diff:

-import React from 'react';
 import Icons from './Icons';

6-22: Consider moving features array outside component.

The features array is static and doesn't depend on props or state. Moving it outside the component body prevents unnecessary re-creation on each render.

Apply this diff:

+const features = [
+  {
+    icon: <Icons.Lightning />,
+    title: 'Instant Search',
+    description: 'Get real-time medicine suggestions as you type with our powerful autocomplete.',
+  },
+  {
+    icon: <Icons.Shield />,
+    title: 'FDA Verified Data',
+    description: 'Access reliable drug information directly from the OpenFDA database.',
+  },
+  {
+    icon: <Icons.Database />,
+    title: 'Comprehensive Details',
+    description: 'View usage, side effects, ingredients, warnings, and storage information.',
+  },
+];
+
 const FeaturesSection = () => {
-  const features = [
-    {
-      icon: <Icons.Lightning />,
-      title: 'Instant Search',
-      description: 'Get real-time medicine suggestions as you type with our powerful autocomplete.',
-    },
-    {
-      icon: <Icons.Shield />,
-      title: 'FDA Verified Data',
-      description: 'Access reliable drug information directly from the OpenFDA database.',
-    },
-    {
-      icon: <Icons.Database />,
-      title: 'Comprehensive Details',
-      description: 'View usage, side effects, ingredients, warnings, and storage information.',
-    },
-  ];
-
   return (
client/src/components/quickmed/HomePage/Icons.jsx (1)

2-2: Remove unnecessary React import.

With React 19 and the modern JSX transform, the React import is not required for JSX.

Apply this diff:

-import React from 'react';
-
 const Icons = {
client/src/components/quickmed/HomePage/Footer.jsx (2)

2-2: Remove unnecessary React import.

With React 19 and the modern JSX transform, the React import is no longer needed.

Apply this diff:

-import React from 'react';
 import Icons from './Icons';

45-52: Consider using Icons module for consistency.

The arrow icon is defined inline, while other icons use the centralized Icons module (e.g., Icons.Pill on line 14). For consistency and maintainability, consider adding an Arrow icon to the Icons module.

client/src/pages/quickmed/HomePage.jsx (1)

5-5: Remove unused Icons import.

The Icons module is imported but never used in this file. It's only used by the child components (SearchBar, Footer, etc.).

Apply this diff:

 import { getMedicineSuggestions } from '../../service/medicineApiService';
-import Icons from '../../components/quickmed/HomePage/Icons';
 import SearchBar from '../../components/quickmed/HomePage/SearchBar';
client/src/components/quickmed/HomePage/SearchBar.jsx (2)

2-2: Remove unnecessary React import.

With React 19 and the modern JSX transform, the React import is not required for JSX.

Apply this diff:

-import React from 'react';
 import Icons from './Icons';

64-81: Consider using unique identifiers for suggestion keys.

Using array index as the key for dynamically fetched suggestions can cause issues if the suggestions list changes or reorders between renders (e.g., when the user continues typing). If the API returns unique identifiers for suggestions, use those instead.

If suggestions have unique IDs:

-<li key={index}>
+<li key={suggestion.id || suggestion.name || suggestion}>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd2b527 and 644ac84.

📒 Files selected for processing (9)
  • client/src/components/quickmed/HomePage/FeaturesSection.jsx (1 hunks)
  • client/src/components/quickmed/HomePage/Footer.jsx (1 hunks)
  • client/src/components/quickmed/HomePage/HeroSection.jsx (1 hunks)
  • client/src/components/quickmed/HomePage/Icons.jsx (1 hunks)
  • client/src/components/quickmed/HomePage/InfoBanner.jsx (1 hunks)
  • client/src/components/quickmed/HomePage/SearchBar.jsx (1 hunks)
  • client/src/pages/quickmed/HomePage.jsx (1 hunks)
  • client/src/pages/quickmed/MedicineDetails.jsx (0 hunks)
  • client/src/routes/QuickmedRoutes.jsx (1 hunks)
💤 Files with no reviewable changes (1)
  • client/src/pages/quickmed/MedicineDetails.jsx
🧰 Additional context used
🧬 Code graph analysis (4)
client/src/components/quickmed/HomePage/FeaturesSection.jsx (1)
client/src/components/quickmed/HomePage/Icons.jsx (1)
  • Icons (4-90)
client/src/components/quickmed/HomePage/Footer.jsx (2)
client/src/components/quickmed/HomePage/Icons.jsx (1)
  • Icons (4-90)
client/src/pages/quickmed/HomePage.jsx (1)
  • navigateToQuickclinic (93-95)
client/src/components/quickmed/HomePage/InfoBanner.jsx (1)
client/src/pages/quickmed/HomePage.jsx (1)
  • navigateToQuickclinic (93-95)
client/src/pages/quickmed/HomePage.jsx (6)
client/src/pages/quickmed/MedicineDetails.jsx (2)
  • navigate (11-11)
  • error (14-14)
client/src/components/quickmed/HomePage/HeroSection.jsx (1)
  • HeroSection (4-12)
client/src/components/quickmed/HomePage/SearchBar.jsx (1)
  • SearchBar (5-108)
client/src/components/quickmed/HomePage/FeaturesSection.jsx (1)
  • FeaturesSection (5-51)
client/src/components/quickmed/HomePage/InfoBanner.jsx (1)
  • InfoBanner (4-31)
client/src/components/quickmed/HomePage/Footer.jsx (1)
  • Footer (5-59)
🔇 Additional comments (11)
client/src/routes/QuickmedRoutes.jsx (1)

5-5: LGTM!

The route addition is clean and follows the existing pattern. The route ordering is correct, with the more specific medicine detail route before the general homepage route.

Also applies to: 12-12

client/src/components/quickmed/HomePage/InfoBanner.jsx (1)

4-31: LGTM!

The component correctly receives and uses the navigateToQuickclinic callback, and the UI structure is clean and responsive.

client/src/components/quickmed/HomePage/FeaturesSection.jsx (1)

24-51: LGTM!

The component structure is clean, responsive, and includes nice hover effects. Using index as the key is acceptable here since the features array is static.

client/src/components/quickmed/HomePage/Icons.jsx (1)

4-90: LGTM!

The centralized Icons module provides a clean, maintainable way to manage SVG icons across the QuickMed components.

client/src/components/quickmed/HomePage/Footer.jsx (1)

5-59: LGTM!

The Footer component is well-structured with responsive layout and clear CTAs. The navigation callback is properly wired.

client/src/pages/quickmed/HomePage.jsx (5)

13-41: Dark mode state without toggle UI.

The component initializes and persists dark mode state, but I don't see a UI element (like a toggle button) that allows users to switch between light and dark modes. The state is initialized based on localStorage and system preferences, but users have no way to change it.

Verify whether a dark mode toggle UI element exists elsewhere or if this is intentional (system preference only). If users should be able to toggle dark mode, consider adding a toggle button to the Navbar or header area.


44-60: LGTM! Well-implemented debounced search.

The debounced search implementation is solid with proper error handling, loading state management, and a stable fetchSuggestions callback via useCallback.

Also applies to: 63-73


76-85: LGTM! Proper click-outside handling.

The click-outside handler correctly closes the suggestions dropdown and properly cleans up the event listener.


98-123: LGTM! Solid keyboard navigation.

The keyboard navigation implementation properly handles ArrowUp, ArrowDown, Enter, and Escape keys with correct boundary checks and state updates.


125-181: LGTM! Clean page composition.

The page structure is well-organized, composing multiple sections with proper prop drilling for state and callbacks.

client/src/components/quickmed/HomePage/SearchBar.jsx (1)

5-107: LGTM! Well-structured search component.

The SearchBar component provides an excellent user experience with loading states, clear button, keyboard navigation support, and helpful visual feedback. The popular tags feature is a nice touch for discoverability.

Comment on lines +88 to +91
const handleSelectMedicine = (medicineName) => {
const encodedName = encodeURIComponent(medicineName.toLowerCase().replace(/\s+/g, '-'));
navigate(`/quick-med/medicine/${encodedName}`);
};
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:

#!/bin/bash
# Check how MedicineDetails decodes the medicine name parameter
rg -n -A10 -B2 "useParams|medicineName" client/src/pages/quickmed/MedicineDetails.jsx

Repository: genzz-dev/QuickClinic

Length of output: 1586


🏁 Script executed:

#!/bin/bash
# Check how getMedicineDetails handles the medicine name parameter
rg -n -A15 "getMedicineDetails" client/src/service/medicineApiService.js

Repository: genzz-dev/QuickClinic

Length of output: 225


Fix double URL-encoding of medicine name.

The medicine name is encoded in HomePage (lowercase, hyphens for spaces, then encodeURIComponent), but getMedicineDetails() in medicineApiService.js applies encodeURIComponent() again at line 36. This causes double encoding and will break API requests. Remove the encoding from medicineApiService since the parameter arrives pre-encoded from the route.

🤖 Prompt for AI Agents
In client/src/pages/quickmed/HomePage.jsx around lines 88-91 and in
medicineApiService.js around line 36: HomePage now sends a pre-encoded medicine
name in the route (lowercased and spaces -> hyphens then encodeURIComponent),
but medicineApiService.getMedicineDetails currently calls encodeURIComponent
again causing double-encoding; remove the encodeURIComponent() call in
medicineApiService.getMedicineDetails and use the incoming route parameter as-is
(optionally validate it is a non-empty string) so the API request uses the
already-encoded value.

@aditya241104 aditya241104 merged commit 06a44fd into main Dec 4, 2025
7 checks passed
@aditya241104 aditya241104 deleted the feature/quick-med-home-page branch December 4, 2025 04:53
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