<commit_before>import { Modal } from 'react-bootstrap';

class DirectionView extends React.Component {
  constructor (props) {
    super(props);
  }

  componentDidUpdate() {
    var context = this;
    if(this.props.location) {
      window.directionsService = new google.maps.DirectionsService();
      window.directionsDisplay = new google.maps.DirectionsRenderer();
      var map;
      var lat;
      var lng;
      var markers;
      var bounds = new google.maps.LatLngBounds();
      var geocoder = new google.maps.Geocoder();                    
      var mapOptions = {
          mapTypeId: 'roadmap'
      };
      map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
      map.setTilt(45);    
      if (geocoder) {
        geocoder.geocode({
          'address': this.props.location,
        }, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
            if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
              lat = results[0].geometry.location.lat();
              lng = results[0].geometry.location.lng();
              window.markers = [
                [lat, lng],
                [37.7836966, -122.4089664]
              ];
              directionsDisplay.setMap(map);
              context.calcRoute();
            } else {
              alert("No results found");
            }
          } else {
            alert("Geocode was not successful for the following reason: " + status);
          }
        });
      } 
    }
  }

  calcRoute() {
    var context = this;
    var selectedMode = document.getElementById('travelType').value;
    var request = {
      origin: new google.maps.LatLng(markers[0][0], markers[0][1]),
      destination: new google.maps.LatLng(markers[1][0], markers[1][1]),
      travelMode: google.maps.TravelMode[selectedMode]
    };
    directionsService.route(request, function(response, status) {
      if (status == google.maps.DirectionsStatus.OK) {
        directionsDisplay.setDirections(response);
        var newDiv = document.getElementById("contents"); 
        newDiv.innerHTML = "Hack Reactor is " + response.routes[0].legs[0].distance.text + " away from " + context.props.location + "<br/><br/>It takes "+response.routes[0].legs[0].duration.text + " by " + selectedMode; 
      }
    });
  }<commit_msg>Make mode of travel display lowercase<commit_after>import { Modal } from 'react-bootstrap';

class DirectionView extends React.Component {
  constructor (props) {
    super(props);
  }

  componentDidUpdate() {
    var context = this;
    if(this.props.location) {
      window.directionsService = new google.maps.DirectionsService();
      window.directionsDisplay = new google.maps.DirectionsRenderer();
      var map;
      var lat;
      var lng;
      var markers;
      var bounds = new google.maps.LatLngBounds();
      var geocoder = new google.maps.Geocoder();                    
      var mapOptions = {
          mapTypeId: 'roadmap'
      };
      map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
      map.setTilt(45);    
      if (geocoder) {
        geocoder.geocode({
          'address': this.props.location,
        }, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
            if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
              lat = results[0].geometry.location.lat();
              lng = results[0].geometry.location.lng();
              window.markers = [
                [lat, lng],
                [37.7836966, -122.4089664]
              ];
              directionsDisplay.setMap(map);
              context.calcRoute();
            } else {
              alert("No results found");
            }
          } else {
            alert("Geocode was not successful for the following reason: " + status);
          }
        });
      } 
    }
  }

  calcRoute() {
    var context = this;
    var selectedMode = document.getElementById('travelType').value;
    var request = {
      origin: new google.maps.LatLng(markers[0][0], markers[0][1]),
      destination: new google.maps.LatLng(markers[1][0], markers[1][1]),
      travelMode: google.maps.TravelMode[selectedMode]
    };
    directionsService.route(request, function(response, status) {
      if (status == google.maps.DirectionsStatus.OK) {
        directionsDisplay.setDirections(response);
        var newDiv = document.getElementById("contents"); 
        newDiv.innerHTML = "Hack Reactor is " + response.routes[0].legs[0].distance.text + " away from " + context.props.location + "<br/><br/>It takes "+response.routes[0].legs[0].duration.text + " by " + (selectedMode.toLowerCase()); 
      }
    });
  }
{'fraction_non_alphanumeric': 0.13046245226983452, 'fraction_numerical': 0.014849384811200678, 'mean_word_length': 2.218430034129693, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6627716', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1356, 'n_words': 259}