Code Monkey home page Code Monkey logo

some_trails's Introduction

SomeTrails

Live Link

SomeTrails

CompleteHomepage

About

SomeTrails is a clone of AllTrails where users can browse through parks and the trails within them to gather general information. On the home page, there is a photo slider that showcases some of the trails where users can click on the photo-card they are interested in. The user will be redirected to the trail page where they can look up general information of the trail such as directions, facilities, contact information, etc. Users will also be able to create, read, update, and delete reviews and also upload their own photos.

SomeTrails backend is built using the Ruby on Rails framework, PostgreSQL, AWS S3 storage for photos used in the frontend. The frontend is built using React, Redux, and SCSS. jQuery is used to send all AJAX calls from the frontend to the backend..

Features

CRUD For Reviews

CreateReview

Users will be able to create/read/update/destroy reviews for trails. To create a review, a user simply has to click on the "Write Review" button and a 2-part modal form will popup. One the first page, user will select a rating and write their review. Once done, they can click the next button and select the date, trail condition tags and select the Post button to create the review.

The code below was created to search through the checkboxes to see if each box has an attribute of checked. If found, it setStates to the conditions array.

handleCheckbox() {
  let checkboxes = Array.from(document.getElementsByClassName('checkbox-input'))

  let tagArr = [];
  checkboxes.forEach((input) => {
    if (input.checked) tagArr.push(input.value)
  })
  this.setState({conditions: tagArr})
}

UpdateDestroyReview

Users will also be able to edit any of their reviews and freely change any of the parameters to their liking, including the trail condition tags.

Search Bar

SearchBar

Users can find a park or trail using the search bar in the middle of the home page. The search bar is actually just a text input that when clicked on, will reveal a hidden div below that has an index of all the trails/parks. When a user starts typing in the input box, it will filter out any trail/park that does not contain the letters being inputted. The code below shows the search function that filters the trails/parks.

<div className='search-dropdown hide' id='search-dropdown'>
  {parks.map((park, idx) => {
    if (park.park_name.toLowerCase().startsWith(this.state.params.toLowerCase())) {
      return <div key={'park'+`${idx}`} className="park-search-container">
        <li className="park-search-button" onClick={() => this.handlePath(park.id, 'park')}>
          <div className="park-search-img">
            <img src="https://some-trails-aa-dev.s3.us-west-1.amazonaws.com/buttons/park.png" />
          </div>
          <div className="park-search-info">
            <h1>{park.park_name}</h1>
            <p>{park.state}, {park.country}</p>
          </div>
        </li>
      </div>
    }
  })}

  {trails.map((trail, idx) => {
    if (trail.trail_name.toLowerCase().startsWith(this.state.params.toLowerCase())) {
      return <div key={'trail'+`${idx}`} className="park-search-container">
        <li className="park-search-button" onClick={() => this.handlePath(trail.id, 'trail')}>
          <div className="park-search-img">
            <img src="https://some-trails-aa-dev.s3.us-west-1.amazonaws.com/buttons/trails.png" />
          </div>
          <div className="park-search-info">
            <h1>{trail.trail_name}</h1>
            <p>{trail.state}, {trail.country}</p>
          </div>
        </li>
      </div>
    }
  })}
</div>

WeatherAPI

WeatherAPI

SomeTrails uses the WeatherAPI to dynamically fetch data to get 3-day forecast of the temperature, weather conditions, UV index, sunrise and sunset times.

some_trails's People

Contributors

cpark04 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.