cheemaz1 / CozyBnB

CozyBnB is a clone of the website AirBnB that provides the user many features from the original.
https://cozybnb.herokuapp.com/#/
0 stars 0 forks source link
google-maps-api javascript react redux ruby

COZYBNB

Wecome to CozyBnB! This is a clone of the website AirBnB that provides the user many features from the original.

Check it out here => https://cozybnb.herokuapp.com/#/ #

TECHNOLOGIES USED

Starting with the backend, I used Ruby on Rails along with PostGresQL DB, jBuilder DSL to sculpt and limit the json sent up to the frontend. I used React and Redux to deliver the user interface and manage state respectively on the frontend. Mapbox API was used for marking locations. #

FEATURES

CHALLENGES MET

Search By Location

A lot of problems I encountered occured were while creating the search bar and search function. None of the listings were displaying when searching for a particular location. I ended up manipulating my listings controller to add conditionals to check whether searchParams present, created a method to query using searchParams insteade of the ID of homes. I set my state to include the key of city and value of searchParams and called the route for my Homes Index.

SCREENSHOTS

Splash Page

Screen Shot 2021-12-10 at 1 03 20 AM

Different Cities Seeded

Screen Shot 2021-12-10 at 1 03 20 AM

Listing Show Page

Screen Shot 2021-12-10 at 1 03 20 AM

Seeded Reviews on Listing

Screen Shot 2021-12-10 at 1 03 20 AM

CODE SNIPPET

ListingsController.rb

Searching for a listing by its city was complicated and was done by adding data to the backend containing the search params. Searching a city in the search bar would fetch the listings in that city (searchParams)

    def index 
        if !params[:searchParams]   
            # debugger  
            @homes = Home.all    
        elsif params[:searchParams][:city]
            # debugger
            @homes = Home.where(city: params[:searchParams][:city])

        end
        render :index
    end

#

FUTURE IMPLEMENTATION