Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enhance Hotels Route with City Query Parameter Support #47

Closed
iZooGooD opened this issue Feb 9, 2024 · 2 comments · Fixed by #49
Closed

feat: Enhance Hotels Route with City Query Parameter Support #47

iZooGooD opened this issue Feb 9, 2024 · 2 comments · Fixed by #49
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed react

Comments

@iZooGooD
Copy link
Owner

iZooGooD commented Feb 9, 2024

Description:

Issue Summary:
Currently, the application supports navigating to the /hotels route with a city specified through internal state management, such as when a user searches for "Pune" from the homepage. However, this approach does not update the URL with the search parameters, limiting direct URL navigation and bookmarking capabilities. To improve usability and direct access, we aim to introduce support for URL query parameters, specifically for city selection.

Objective:
Enable the /hotels route to accept a city query parameter in the URL, allowing users to directly navigate to a pre-filtered list of hotels based on the city. This feature should support both direct URL entry (e.g., /hotels?city=pune) and navigation from within the application, enhancing flexibility and user experience.

Implementation Steps:

  1. Query Parameter Support:

    • Modify the hotels route to parse the city query parameter from the URL. This involves checking the URL for any city parameters upon route loading.
  2. Prioritize Query Parameter:

    • Adjust the logic within the /hotels route to first check for a city query parameter. If present, use this parameter as the locationInputValue to filter the hotel listings.
    • If the city query parameter is not present, then fallback to using the existing state variable (locationInputValue) as the source for the city filter.
    • There is already a useEffect on location, can we use that ? search for "const location = useLocation()" and see if we can use that, else you can implement as per your requirements.
@iZooGooD iZooGooD added enhancement New feature or request good first issue Good for newcomers react help wanted Extra attention is needed labels Feb 9, 2024
@razouq
Copy link
Contributor

razouq commented Feb 9, 2024

Hello, I want to help here, I already cloned the project and added the feature, I still need to write tests

@iZooGooD
Copy link
Owner Author

Hello, I want to help here, I already cloned the project and added the feature, I still need to write tests

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed react
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants